Configuration Templates¶
Ready-to-use templates live in the repository under templates/:
File |
Purpose |
|---|---|
|
Config template for |
|
Config template for |
|
Config template for |
|
Config template for |
|
Generic runner: build a solver from a YAML config and call |
|
Stub |
Each YAML template lists every parameter that solver’s _BASE_DEFAULTS accepts plus its solver-specific params, with the library defaults filled in and required fields marked.
Usage¶
Copy the template matching your representation:
cp templates/smiles.yaml my_project/config.yaml.Copy
templates/assembler_and_fitness.pyinto your project and fill inassemble()(chromosome → object to score) andscore()(object → fitness). Point your YAML’sfitness_function/chromosome_to_*at them by dotted reference, e.g.fitness_function: my_project.assembler_and_fitness:score.Fill in
paramsfor your problem (n_genesis always required).Copy
templates/launcher.pyinto your project and run it:
python launcher.py --config my_project/config.yaml
Or build and run inline:
from navicatGA.config import build_solver_from_yaml
solver, config = build_solver_from_yaml("my_project/config.yaml")
result = solver.solve()
Runtime-computed values¶
Anything computed at runtime rather than static (an alphabet read from a database, a starting population generated from a directory of structures) isn’t expressible in YAML. Build it in your launcher and pass it as an extra keyword argument, which overrides/extends the YAML’s params block:
alphabet_list = my_alphabet_builder(...)
solver, config = build_solver_from_yaml("my_project/config.yaml", alphabet_list=alphabet_list)
Reference resolution¶
fitness_function, chromosome_to_*, and scalarizer.class are resolved by dotted module.path:attr reference:
module.path:attr: the attribute used directly.module.path:attr(): call it with no arguments first (several of navicatGA’s own bundled example assemblers are factories, e.g.navicatGA.wrappers_smiles:chromosome_to_smiles()).module.path:attr(10)/module.path:attr(target=350.0, function_number=6): call it with literal positional/keyword arguments, e.g.navicatGA.fitness_functions_selfies:fitness_function_selfies(1).
Full walkthrough¶
See Tutorial 7 for a complete worked example: writing assemble()/score() from scratch, wiring them into a YAML config, and the two launcher patterns (runtime-computed values, multi-cycle runs with per-cycle logging).