gen_specs

Generation function specifications to be set in user calling script and passed to main libE() routine:

gen_specs: [dict]:

    'gen_f' [func]:
        generates inputs to sim_f
    'in' [list]:
        field names (as strings) that will be given to gen_f
    'out' [list of tuples (field name, data type, [size])]:
        gen_f outputs that will be stored in the libEnsemble history
    'user' [dict]:
        Data structure to contain problem specific constants and/or input data

Note

  • The user may define fields only in 'user' to be passed to the generator function.

  • The tuples defined in the ‘out’ list are entered into the master history array.

  • The generator 'out' field will usually include variable(s) appearing as a simulator ‘in’ field, in which case only the variable name is required for the simulator 'in' field. The example below, matches the corresponding sim_specs example, where 'x' is defined in the gen_specs 'out' field to give two-dimensional floats.

See also

  • test_uniform_sampling.py In this example, the generation function uniform_random_sample in sampling.py will generate 500 random points uniformly over the 2D domain defined by gen_specs['ub'] and gen_specs['lb'].

gen_specs = {'gen_f': uniform_random_sample,     # Function generating sim_f input
             'out': [('x', float, (2,))],        # Tell libE gen_f output, type, size
             'user': {'gen_batch_size': 500,     # Used by this specific gen_f
                      'lb': np.array([-3, -2]),  # Used by this specific gen_f
                      'ub': np.array([3, 2])     # Used by this specific gen_f
                      }
             }