5"""Run a small Bayesian search with genuine evaluations and a fixed grid."""
12def evaluate(candidate):
13 """Return the raw cost and the product descriptor."""
15 return ((x - 0.2) ** 2 + (y - 0.4) ** 2,), (x * y,)
18if __name__ ==
"__main__":
20 archive = Grid(shape=4, fitness_domain=((0, 2),), features_domain=(unit,))
22 archive, budget=24, dimension=2, ind_domain=unit, quality_floor=-2,
23 initial_samples=8, candidate_pool=16, restarts=2,
25 result = run(search, evaluate, seed=42)
26 print(f
"Evaluations: {result.evaluations}")
27 print(f
"Finite observations: {search.n_observations}")
28 print(f
"Occupied cells: {archive.filled_bins}/{len(archive.solutions)}")
29 for cell, entries
in archive.solutions.items():
32 print(f
"Cell {cell}: descriptor {elite.features[0]:.4f}, raw cost {elite.fitness.values[0]:.4f}")