gpCAM
- class gen_classes.gpCAM.GP_CAM(VOCS, ask_max_iter=10, random_seed=1, *args, **kwargs)
Bases:
LibensembleGeneratorThis generation function constructs a global surrogate of f values.
It is a batched method that produces a first batch uniformly random from (lb, ub). On subsequent iterations, it calls an optimization method to produce the next batch of points. This optimization might be too slow (relative to the simulation evaluation time) for some use cases.
- Parameters:
VOCS (VOCS)
ask_max_iter (int)
random_seed (int)
- suggest(num_points=0)
Request the next set of points to evaluate.
- Parameters:
num_points (int | None)
- Return type:
List[dict]
- ingest(results)
Send the results of evaluations to the generator.
- Parameters:
results (List[dict])
- Return type:
None
- class gen_classes.gpCAM.GP_CAM_Covar(VOCS, test_points_file=None, use_grid=False, *args, **kwargs)
Bases:
GP_CAMThis generation function constructs a global surrogate of f values.
It is a batched method that produces a first batch uniformly random from (lb, ub) and on following iterations samples the GP posterior covariance function to find sample points.
- Parameters:
test_points_file (str)
use_grid (bool)
- suggest(num_points=0)
Request the next set of points to evaluate.
- Parameters:
num_points (int | None)
- Return type:
List[dict]
- ingest(results)
Send the results of evaluations to the generator.
- Parameters:
results (List[dict])
- Return type:
None
See also
1 vocs = VOCS(variables={"x0": [-3, 3], "x1": [-2, 2], "x2": [-1, 1], "x3": [-1, 1]}, objectives={"f": "MINIMIZE"})
2
3 alloc_specs = {"alloc_f": alloc_f}
4
5 gen = GP_CAM_Covar(vocs)
6
7 for inst in range(3):
8 if inst == 0:
9 gen_specs["generator"] = gen
10 num_batches = 10
11 exit_criteria = {"sim_max": num_batches * batch_size, "wallclock_max": 300}
12 libE_specs["save_every_k_gens"] = 150
13 libE_specs["H_file_prefix"] = "gpCAM_nongrid"
14 if inst == 1:
15 gen = GP_CAM_Covar(vocs, use_grid=True, test_points_file="gpCAM_nongrid_after_gen_150.npy")
16 gen_specs["generator"] = gen
17 libE_specs["final_gen_send"] = True
18 del libE_specs["H_file_prefix"]
19 del libE_specs["save_every_k_gens"]
20 elif inst == 2:
21 gen = GP_CAM(vocs, ask_max_iter=1)
22 gen_specs["generator"] = gen
23 num_batches = 3 # Few because the ask_tell gen can be slow
24 exit_criteria = {"sim_max": num_batches * batch_size, "wallclock_max": 300}
25
26 # Perform the run
27 H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, {}, alloc_specs, libE_specs)