navicatGA.config¶
Build a GenAlgSolver from a YAML/dict config instead of hand-wiring constructor calls in every downstream script.
Only handles what’s genuinely declarative: picking the solver class and resolving importable references (assembler, fitness_function, scalarizer) by dotted path. Anything that needs runtime computation (e.g. an alphabet built from a project-specific database) stays the caller’s job and is passed in as an extra kwarg to build_solver().
Attributes¶
Functions¶
|
|
|
|
|
|
|
Import 'package.module:attr' and return the attribute. |
Module Contents¶
- navicatGA.config.build_solver(solver_config: dict, **extra_params)¶
- Parameters:
solver_config – the ‘solver’ block of a config (type, fitness_function, chromosome_to_*, scalarizer, params)
extra_params – additional/overriding solver kwargs computed at runtime (e.g. alphabet_list), merged on top of solver_config[‘params’]
- Returns:
an instantiated, unsolved GenAlgSolver subclass
- navicatGA.config.build_solver_from_yaml(path, **extra_params)¶
- navicatGA.config.load_yaml(path)¶
- navicatGA.config.resolve(dotted_path: str)¶
Import ‘package.module:attr’ and return the attribute.
Several of navicatGA’s own example assemblers/fitness functions are factories rather than plain callables (e.g. concatenate_list(), fitness_function_selfies(1)) - append a literal ‘(…)’ call to the reference to call the resolved attribute and use its return value instead, e.g. ‘navicatGA.fitness_functions_selfies:fitness_function_selfies(1)’ or ‘navicatGA.wrappers_smiles:chromosome_to_smiles()’. Only literal positional/keyword arguments are supported (numbers, strings, lists, dicts, … - anything ast.literal_eval accepts), not arbitrary expressions.
- navicatGA.config.SOLVERS¶
- navicatGA.config.UNAVAILABLE_SOLVERS¶