saealib.Optimizer¶
- class saealib.Optimizer(problem)[source]¶
Bases:
objectOptimizer class for evolutionary algorithms.
Integrates problem definition, evolutionary algorithm, surrogate model, model manager, and termination condition, and manages the optimization process.
- Parameters:
problem (Problem)
- strategy¶
The optimization strategy.
- Type:
- termination¶
The termination condition.
- Type:
- 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:
- instance_name¶
The name of the optimizer instance.
- Type:
str
Methods
Initialize the Optimizer. |
|
Dispatch an event to the callback manager. |
|
Iterate the optimization process. |
|
Run the optimization process. |
|
Set the evolutionary algorithm. |
|
Set the evaluator. |
|
Set the initializer. |
|
Set the instance name. |
|
Set the optimization strategy. |
|
Wrap a raw Surrogate in a LocalSurrogateManager. |
|
Set the surrogate manager. |
|
Set the termination condition. |
|
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_initializer(initializer)[source]¶
Set the initializer. Returns self.
- Parameters:
initializer (Initializer)
- Return type:
- Optimizer.set_instance_name(name)[source]¶
Set the instance name. Returns self.
- Parameters:
name (str)
- Return type:
- Optimizer.set_strategy(strategy)[source]¶
Set the optimization strategy. Returns self.
- Parameters:
strategy (OptimizationStrategy)
- Return type:
- 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.
- Optimizer.set_surrogate_manager(manager)[source]¶
Set the surrogate manager. Returns self.
- Parameters:
manager (SurrogateManager)
- Return type:
- Optimizer.set_termination(termination)[source]¶
Set the termination condition. Returns self.
- Parameters:
termination (Termination)
- Return type: