|
None | __init__ (self) |
|
Variable | decision_variable (self) |
|
VariableMatrix | decision_variable (self, int rows, int cols=1) |
|
VariableMatrix | symmetric_decision_variable (self, int rows) |
|
None | minimize (self, Variable cost) |
|
None | minimize (self, VariableMatrix cost) |
|
None | minimize (self, float cost) |
|
None | maximize (self, Variable objective) |
|
None | maximize (self, VariableMatrix objective) |
|
None | maximize (self, float objective) |
|
None | subject_to (self, EqualityConstraints constraint) |
|
None | subject_to (self, InequalityConstraints constraint) |
|
SolverStatus | solve (self, **kwargs) |
|
None | callback (self, Callable[[SolverIterationInfo], bool] callback) |
|
This class allows the user to pose a constrained nonlinear
optimization problem in natural mathematical notation and solve it.
This class supports problems of the form: @verbatim minₓ f(x) subject
to cₑ(x) = 0 cᵢ(x) ≥ 0 @endverbatim
where f(x) is the scalar cost function, x is the vector of decision
variables (variables the solver can tweak to minimize the cost
function), cᵢ(x) are the inequality constraints, and cₑ(x) are the
equality constraints. Constraints are equations or inequalities of the
decision variables that constrain what values the solver is allowed to
use when searching for an optimal solution.
The nice thing about this class is users don't have to put their
system in the form shown above manually; they can write it in natural
mathematical form and it'll be converted for them.
SolverStatus jormungandr.optimization.OptimizationProblem.solve |
( |
|
self, |
|
|
** |
kwargs |
|
) |
| |
Solve the optimization problem. The solution will be stored in the
original variables used to construct the problem.
Parameter ``tolerance``:
The solver will stop once the error is below this tolerance.
(default: 1e-8)
Parameter ``max_iterations``:
The maximum number of solver iterations before returning a solution.
(default: 5000)
Parameter ``acceptable_tolerance``:
The solver will stop once the error is below this tolerance for
`acceptable_iterations` iterations. This is useful in cases where the
solver might not be able to achieve the desired level of accuracy due to
floating-point round-off.
(default: 1e-6)
Parameter ``max_acceptable_iterations``:
The solver will stop once the error is below `acceptable_tolerance` for
this many iterations.
(default: 15)
Parameter ``timeout``:
The maximum elapsed wall clock time before returning a solution.
(default: infinity)
Parameter ``feasible_ipm``:
Enables the feasible interior-point method. When the inequality
constraints are all feasible, step sizes are reduced when necessary to
prevent them becoming infeasible again. This is useful when parts of the
problem are ill-conditioned in infeasible regions (e.g., square root of a
negative value). This can slow or prevent progress toward a solution
though, so only enable it if necessary.
(default: False)
Parameter ``diagnostics``:
Enables diagnostic prints.
(default: False)
Parameter ``spy``:
Enables writing sparsity patterns of H, Aₑ, and Aᵢ to files named H.spy,
A_e.spy, and A_i.spy respectively during solve.
Use tools/spy.py to plot them.
(default: False)