sim_specsΒΆ

Used to specify the simulation function, its inputs and outputs, and user data:

sim_specs: [dict]:

    'sim_f' [func]:
        the simulation function being evaluated
    'in' [list]:
        field names (as strings) to be given to sim_f by alloc_f
    'out' [list of tuples (field name, data type, [size])]:
        sim_f outputs to be stored in the libEnsemble history
    'user' [dict, optional]:
        Data structure to contain problem specific constants and/or input data

Note

  • The entirety of sim_specs is passed from the worker each time a simulation is requested by the allocation function.

  • The tuples in sim_specs['out'] are entered into the master history array.

See also

  • 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 in sim_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_specs = {'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
             }