Simulation Specs¶
Used to specify the simulation function, its inputs and outputs, and user data.
1from libensemble import SimSpecs
2from gest_api.vocs import VOCS
3from my_package import my_sim_callable
4
5vocs = VOCS(
6 variables={"x": [-3.0, 3.0]},
7 objectives={"y": "MINIMIZE"},
8)
9
10sim_specs = SimSpecs(
11 simulator=my_sim_callable,
12 vocs=vocs,
13)
14...
1from libensemble import SimSpecs
2from simulator import sim_find_sine
3
4sim_specs = SimSpecs(
5 sim_f=sim_find_sine,
6 inputs=["x"],
7 outputs=[("y", float)],
8 user={"batch": 1234},
9)
10...
- pydantic model libensemble.specs.SimSpecs¶
Specifications for configuring a Simulation Function.
- Fields:
- field globus_compute_endpoint: str | None = ''¶
A Globus Compute (https://www.globus.org/compute) ID corresponding to an active endpoint on a remote system. libEnsemble’s workers will submit simulator function instances to this endpoint instead of calling them locally.
- field inputs: list[str] | None = [] (alias 'in')¶
list of field names out of the complete history to pass into the simulation function upon calling.
- field outputs: list[tuple] = [] (alias 'out')¶
list of 2- or 3-tuples corresponding to NumPy dtypes. e.g.
("dim", int, (3,)), or("path", str). Typically used to initialize an output array within the simulation function:out = np.zeros(100, dtype=sim_specs["out"]). Also necessary to construct libEnsemble’s history array.
- field persis_in: list[str] | None = []¶
list of field names to send to a persistent simulation function throughout the run, following initialization.
- field sim_f: object = None¶
Python function matching the
sim_finterface. Evaluates parameters produced by a generator function.
- field simulator: object | None = None¶
A callable (function) in gest-api format. When provided,
sim_fdefaults to thegest_api_simwrapper.
- field threaded: bool | None = False¶
Instruct Worker process to launch user function to a thread.
- field user: dict | None = {}¶
A user-data dictionary to place bounds, constants, settings, or other parameters for customizing the simulator function.
- field vocs: object | None = None¶
A VOCS object. If provided and inputs/outputs are not explicitly set, they will be automatically derived from VOCS.