saealib.Optimizer

class saealib.Optimizer(problem)[source]

Bases: object

Optimizer class for evolutionary algorithms.

Integrates problem definition, evolutionary algorithm, surrogate model, model manager, and termination condition, and manages the optimization process.

Parameters:

problem (Problem)

problem

The optimization problem.

Type:

Problem

algorithm

The evolutionary algorithm.

Type:

Algorithm

surrogate

The surrogate model.

Type:

Surrogate

strategy

The optimization strategy.

Type:

OptimizationStrategy

termination

The termination condition.

Type:

Termination

archive

The archive of evaluated solutions.

Type:

Archive

popsize

The population size.

Type:

int

seed

The random seed.

Type:

int

rng

The random number generator.

Type:

numpy.random.Generator

fe

The current number of function evaluations.

Type:

int

gen

The current generation number.

Type:

int

cbmanager

The callback event manager.

Type:

CallbackManager

instance_name

The name of the optimizer instance.

Type:

str

Methods

__init__

Initialize the Optimizer.

dispatch

Dispatch an event to the callback manager.

iterate

Iterate the optimization process.

run

Run the optimization process.

set_algorithm

Set the evolutionary algorithm.

set_initializer

Set the initializer.

set_instance_name

Set the instance name.

set_strategy

Set the optimization strategy.

set_surrogate

Wrap a raw Surrogate in a LocalSurrogateManager.

set_surrogate_manager

Set the surrogate manager.

set_termination

Set the termination condition.

validate

Check configuration consistency.

Method Details

Optimizer.__init__(problem)[source]

Initialize the Optimizer.

Parameters:

problem (Problem) – The optimization problem.

Optimizer.dispatch(event)[source]

Dispatch an event to the callback manager.

Parameters:

event (Event)

Return type:

None

Optimizer.iterate()[source]

Iterate the optimization process.

Returns:

Generator of OptimizationContext.

Return type:

Generator[OptimizationContext]

Optimizer.run()[source]

Run the optimization process.

Returns:

The optimization context.

Return type:

OptimizationContext

Optimizer.set_algorithm(algorithm)[source]

Set the evolutionary algorithm. Returns self.

Parameters:

algorithm (Algorithm)

Return type:

Optimizer

Optimizer.set_initializer(initializer)[source]

Set the initializer. Returns self.

Parameters:

initializer (Initializer)

Return type:

Optimizer

Optimizer.set_instance_name(name)[source]

Set the instance name. Returns self.

Parameters:

name (str)

Return type:

Optimizer

Optimizer.set_strategy(strategy)[source]

Set the optimization strategy. Returns self.

Parameters:

strategy (OptimizationStrategy)

Return type:

Optimizer

Optimizer.set_surrogate(surrogate, n_neighbors=50)[source]

Wrap a raw Surrogate in a LocalSurrogateManager. Returns self.

Equivalent to set_surrogate_manager(LocalSurrogateManager(surrogate, ...)). Provided for backward compatibility.

Parameters:
Return type:

Optimizer

Optimizer.set_surrogate_manager(manager)[source]

Set the surrogate manager. Returns self.

Parameters:

manager (SurrogateManager)

Return type:

Optimizer

Optimizer.set_termination(termination)[source]

Set the termination condition. Returns self.

Parameters:

termination (Termination)

Return type:

Optimizer

Optimizer.validate()[source]

Check configuration consistency. Returns list of issues.

Return type:

list[str]