saealib.CompositeSurrogateManager#

class saealib.CompositeSurrogateManager(managers)[source]#

Bases: SurrogateManager

Surrogate manager that composes predictions from multiple named sub-managers.

This manager owns named child managers, calls each child’s predict(), and returns a single SurrogatePrediction whose channels mapping contains one named PredictionChannel per child. It never combines acquisition scores itself – pair it with CompositeAcquisition, which evaluates each configured channel’s acquisition and combines the resulting score arrays:

ei_manager = GlobalSurrogateManager(GP())
pof_manager = GlobalSurrogateManager(
    PerObjectiveSurrogate([GP()] * n_constraints)
)
composite_acq = CompositeAcquisition(
    {
        "objective": ExpectedImprovement(),
        "feasibility": ProductOfFeasibility(),
    },
    combine_fn=product_combine,
)
surrogate_manager = CompositeSurrogateManager(
    {"objective": ei_manager, "feasibility": pof_manager},
)
Parameters:

managers (dict[str, SurrogateManager]) – Named sub-managers to compose. Must be non-empty. Each key becomes the corresponding PredictionChannel’s name in predict()’s result.

Methods

__init__

contract

Return the surrogate-manager contract.

fit

Pre-fit all sub-managers.

on_generation_end

End-of-generation hook; override to update internal state.

predict

Predict via every sub-manager, one named channel each.

with_on_generation_end

Return a copy of this manager with fn appended to the hook.

Method Details

CompositeSurrogateManager.__init__(managers)[source]#
Parameters:

managers (dict[str, SurrogateManager])

CompositeSurrogateManager.contract()#

Return the surrogate-manager contract.

Return type:

ComponentContract

CompositeSurrogateManager.fit(archive, ctx=None)[source]#

Pre-fit all sub-managers.

last_accuracy is propagated from the first sub-manager (in configuration insertion order) so callers can read a representative accuracy value from this composite manager.

Parameters:
  • archive (Archive)

  • ctx (OptimizationState | None)

Return type:

None

CompositeSurrogateManager.on_generation_end(gen, archive, ctx=None)#

End-of-generation hook; override to update internal state.

Parameters:
  • gen (int)

  • archive (Archive)

  • ctx (OptimizationState | None)

Return type:

None

CompositeSurrogateManager.predict(candidates_x, archive, ctx=None, *, refit=True)[source]#

Predict via every sub-manager, one named channel each.

Returns:

channels maps each configuration key to a PredictionChannel built from that sub-manager’s own value/std (i.e. its own primary/objective channel). If a sub-manager’s predict() exposes no "objective" channel, accessing .value/.std raises KeyError – a genuine misconfiguration, not handled defensively here.

Return type:

SurrogatePrediction

Parameters:
  • candidates_x (np.ndarray)

  • archive (Archive)

  • ctx (OptimizationState | None)

  • refit (bool)

CompositeSurrogateManager.with_on_generation_end(fn)#

Return a copy of this manager with fn appended to the hook.

Parameters:

fn (callable) – fn(gen, archive, ctx) -> None

Returns:

Shallow copy with the hook registered.

Return type:

SurrogateManager