Simulation Specs
Used to specify the simulation function, its inputs and outputs, and user data.
Can be constructed and passed to libEnsemble as a Python class or a dictionary.
1...
2from libensemble import SimSpecs
3from simulator import sim_find_sine
4
5...
6
7sim_specs = SimSpecs(
8 sim_f=sim_find_sine,
9 inputs=["x"],
10 out=[("y", float)],
11 user={"batch": 1234},
12)
13...
1...
2from simulator import six_hump_camel
3
4...
5
6sim_specs = {
7 "sim_f": six_hump_camel,
8 "in": ["x"],
9 "out": [("y", float)],
10 "user": {"batch": 1234},
11}
12...
test_uniform_sampling.py has a
sim_specs
that declares the name of the"in"
field variable,"x"
(as specified by the corresponding generator"out"
field"x"
from the gen_specs example). Only the field name is required insim_specs["in"]
.
sim_specs = {
"sim_f": six_hump_camel, # Function whose output is being minimized
"in": ["x"], # Keys to be given to sim_f
"out": [("f", float)], # Name of the outputs from sim_f
}
run_libe_forces.py has a longer
sim_specs
declaration with a number of user-specific fields. These are given to the corresponding sim_f, which can be found at forces_simf.py.
"sim_f": run_forces, # Function whose output is being minimized
"in": ["x"], # Name of input for sim_f
"out": [("energy", float)], # Name, type of output from sim_f
"user": {
"keys": ["seed"],
"cores": 2,
"sim_particles": 1e3,
"sim_timesteps": 5,
"sim_kill_minutes": 10.0,
"particle_variance": 0.2,
"kill_rate": 0.5,
"fail_on_sim": False,
"fail_on_submit": False, # Won't occur if 'fail_on_sim' True
},
}