saealib.PymooAlgorithm#
- class saealib.PymooAlgorithm(pymoo_algorithm, *, allow_partial_tell=False)[ソース]#
ベースクラス:
AskTellAlgorithmAdapter wrapping a pymoo Algorithm (e.g.
NSGA2()) as saealib'sAlgorithm.Lets researchers who already have a pymoo algorithm reuse it unchanged inside saealib's ask-tell loop and surrogate-assisted strategies.
- パラメータ:
pymoo_algorithm (pymoo.core.algorithm.Algorithm) -- An already-constructed pymoo algorithm instance (not yet
setup()).allow_partial_tell (bool, optional) --
PreSelectionStrategytruncates offspring beforetell(), sotell()may receive only a subset of whatask()produced. By default this raisesConfigurationError, since index-coupled pymoo algorithms (e.g. differential evolution) would silently misalign parents and offspring under a subset. SetTrueto opt in and pass the subset through anyway. Default: False.
メモ
Engine mode. The wrapped pymoo algorithm owns its own population and internal state (survival mechanics, index-coupled operators, adaptive parameters).
ctx.populationis a mirror, refreshed from the pymoo algorithm's own.popat the end of everytell(), not the source of truth. This is the only way to reuse a pymoo algorithm's own tested logic unchanged, but it comes with real limitations:No checkpoint/resume.
OptimizationState.save()only serializes saealib's own arrays; the wrapped pymoo algorithm's internal state is not captured.``n_offspring`` is ignored. The offspring count is fixed by the wrapped algorithm's own configuration (e.g. its
pop_size); strategies that request a larger candidate pool for pre-selection cannot enlarge it here.Constrained problems combined with surrogate-only generations are unsupported. When a candidate never receives a true evaluation, saealib leaves its
g/cvat schema defaults (0.0, looking falsely feasible) — this is an existing, library-wide limitation (SurrogatePredictionhas nocvfield), not something specific to this adapter, but it meansPymooAlgorithm's constraint handling should not be trusted underSurrogateOnlyLoopStage/IB's untrue tail.
Initialization is handled by mirroring saealib's already-evaluated initial population into the pymoo algorithm's own initial
ask()result before callingtell()on it, so the initial design-of- experiments is not duplicated or discarded.A
pymoo_idxcolumn tracks each candidate's position in the pymoo infill population, so thattell()can recover the correct mapping even afterSortByScoreStage/TopKSelectionStagereorder or truncatestate.offspringbetweenaskandtell.
Methods
Generate offspring via the wrapped pymoo algorithm's own |
|
Return the family contract with optional partial-feedback capability. |
|
Create a ParetoArchive with the correct direction for the problem. |
|
Add a |
|
Update the wrapped pymoo algorithm, then mirror its population into |
Method Details
- PymooAlgorithm.__init__(pymoo_algorithm, *, allow_partial_tell=False)[ソース]#
- パラメータ:
pymoo_algorithm (_PymooAlgorithmLike)
allow_partial_tell (bool)
- 戻り値の型:
None
- PymooAlgorithm.ask(request, state)[ソース]#
Generate offspring via the wrapped pymoo algorithm's own
ask().- パラメータ:
ctx (ExecutionContext) -- Current optimization context.
provider (Dispatchable) -- Component provider.
n_offspring (int or None, optional) -- Ignored; the offspring count is fixed by the wrapped pymoo algorithm's own configuration.
request (ProposalRequest)
state (StateView)
- 戻り値:
Candidates with
xandpymoo_idxset.- 戻り値の型:
- PymooAlgorithm.contract()[ソース]#
Return the family contract with optional partial-feedback capability.
- 戻り値の型:
- PymooAlgorithm.create_pareto_archive(attrs, init_capacity, problem)#
Create a ParetoArchive with the correct direction for the problem.
- パラメータ:
attrs (list[PopulationAttribute])
init_capacity (int)
problem (Problem)
- 戻り値の型:
- PymooAlgorithm.get_required_attrs(problem)[ソース]#
Add a
pymoo_idxcolumn tracking position in the pymoo infill pop.- パラメータ:
problem (Problem)
- 戻り値の型:
list[PopulationAttribute]
- PymooAlgorithm.tell(feedback, state)[ソース]#
Update the wrapped pymoo algorithm, then mirror its population into
ctx.- パラメータ:
ctx (ExecutionContext) -- Current optimization context.
provider (Dispatchable) -- Component provider.
offspring (Population) -- Offspring population, possibly reordered or truncated relative to what
ask()produced.feedback (FeedbackBatch)
state (StateView)
- 戻り値の型: