optimization.optimizer.scipy.base#
Optiland Scipy Optimization Module
This module contains classes for various optimization algorithms that can be used to solve optimization problems defined in the OptimizationProblem class. This module provides a generic optimizer class and several specific optimizers that utilize different algorithms from the SciPy library.
Kramer Harrison, 2024
Classes
|
Generic optimizer class for solving optimization problems. |
- class OptimizerGeneric(problem: OptimizationProblem)[source]#
Generic optimizer class for solving optimization problems.
- Parameters:
problem (OptimizationProblem) – The optimization problem to be solved.
- Variables:
problem (OptimizationProblem) – The optimization problem to be solved.
_x (list) – List to store the values of the variables during optimization.
- Methods:
optimize (maxiter=1000, disp=True, tol=1e-3) – Optimize the problem using the specified parameters.
undo() – Undo the last optimization step.
_fun (x) – Internal function to evaluate the objective function.
- optimize(method: str | None = None, maxiter: int = 1000, disp: bool = True, tol: float = 0.001, callback: Callable | None = None, plot: bool = False) optimize.OptimizeResult[source]#
Optimize the problem using the specified parameters.
- Parameters:
method (str, optional) – The optimization method to use. Default is chosen to be one of BFGS, L-BFGS-B, SLSQP, depending on whether contraints or bounds given. Follows scipy.optimize.minimize method.
maxiter (int, optional) – Maximum number of iterations. Default is 1000.
disp (bool, optional) – Whether to display optimization information. Default is True.
tol (float, optional) – Tolerance for convergence. Default is 1e-3.
callback (callable) – A callable called after each iteration.
plot – If True, update live plots during optimization.
- Returns:
The optimization result.
- Return type:
result (OptimizeResult)