Allocation Specs

Allocation function specifications to be set in the user calling script. Optional.

Can be constructed and passed to libEnsemble as a Python class or a dictionary.

pydantic model libensemble.specs.AllocSpecs

Specifications for configuring an Allocation Function.

Fields:
field alloc_f: object = <function only_persistent_gens>

Python function matching the alloc_f interface. Decides when simulator and generator functions should be called, and with what resources and parameters.

Note

For libEnsemble v2.0, the default allocation function is now only_persistent_gens, instead of give_sim_work_first.

field user: dict | None = {}

A user-data dictionary to place bounds, constants, settings, or other parameters for customizing the allocation function.

Note

As of libEnsemble v2.0, options related to the default allocation function (e.g., async_return, num_active_gens) have been moved to GenSpecs.

Note

  • libEnsemble uses the following defaults if the user doesn’t provide their own alloc_specs:

Default settings for alloc_specs
    alloc_f: object = only_persistent_gens
    """
    Python function matching the ``alloc_f`` interface. Decides when simulator and generator functions
    should be called, and with what resources and parameters.

    .. note::
        For libEnsemble v2.0, the default allocation function is now ``only_persistent_gens``, instead
        of ``give_sim_work_first``.
    """

    user: dict | None = {}
    """
    A user-data dictionary to place bounds, constants, settings, or other parameters
    for customizing the allocation function.

    .. note::
        As of libEnsemble v2.0, options related to the default allocation function
        (e.g., ``async_return``, ``num_active_gens``) have been moved to
        :class:`GenSpecs<libensemble.specs.GenSpecs>`.
    """
  • Users can import and adjust these defaults using:

from libensemble.specs import AllocSpecs
my_new_alloc = AllocSpecs()
my_new_alloc.alloc_f = another_function