Conditional design search with HiGeME¶
Use HiGeME when selecting an architecture changes which parameters and constraints apply. For example, a reinforced design may have a layer count while a light design has a material choice. Both designs can compete in the same archive using measurements in shared units.
See Conditional Bayesian QD for the same configuration schema with surrogate-guided simulation budgets.
from qdpy.algorithms import ConditionalConfiguration, HiGeME, IntegerVariable, RealVariable
from qdpy.containers import Grid
archive = Grid(shape=(8,), features_domain=((0.0, 1.0),), fitness_domain=((0.0, 3.0),))
search = HiGeME(
archive, 32, {"size": RealVariable(0, 1), "layers": IntegerVariable(1, 4)},
configurations=(
ConditionalConfiguration({"style": "light"}, ("size",)),
ConditionalConfiguration({"style": "reinforced"}, ("size", "layers"), ("strength",)),
),
batch_size=4, seed=11,
)
def evaluate(candidate):
design = search.decode(candidate)
size = design["size"]
layers = design.get("layers", 0)
residuals = {"strength": 0.6 - size - 0.15 * layers} if layers else {}
return (size + 0.25 * layers,), (size,), residuals
search.optimise(evaluate)
print(search.decode(search.best()))
The numeric genome starts with a configuration index and allocates one slot
to every variable. Decode it before evaluating a design. When a variable
becomes inactive, its value stays in the genome and is available when
the same branch becomes active again. Constraint residuals must be
nonpositive. Supply the named scores for the currently active
configuration. Use ask_batch() and tell_batch() to drive evaluation
yourself. Failed slots use None and still count toward the budget.
The search seeds every declared configuration once. It then samples parents
from the feasible archive and mutates the whole configuration with
probability 0.4. Each mutable active gene is perturbed independently with
probability 0.5. Real mutations have a standard deviation of 0.3 times the
coordinate’s span. These defaults use the authors’ uniform-configuration
and active-gene options, with one uniform seed per explicit configuration.
List each allowed configuration, including combinations of nested selectors.
The same method works with a fixed CVTGrid.
Run the comparison with the base package installed.
python examples/higeme.py --budget 512 --seeds 11 29 47
The example compares a shared archive against three separate searches
that split the same budget. Both methods covered all 24 cells in these
runs. Median raw QD scores were 235.92 for HiGeME and 235.96 for separate
searches. The reported oracle gap sums the difference from the analytic
best in each cell. Raw runs.
See Baraton et al., Hidden-genes multi-dimensional archive of phenotypic elites, and chapter 4 of the author’s thesis.