3. API Reference¶
3.1. Linear Solvers¶
-
optalg.lin_solver.
new_linsolver
(name, prop)[source]¶ Creates a linear solver.
Parameters: - name : string
- prop : string
Returns: - solver :
LinSolver
-
class
optalg.lin_solver.lin_solver.
LinSolver
(prop='unsymmetric')[source]¶ Linear solver class.
Parameters: - prop : {
symmetric
,unsymmetric
}
-
analyzed
= None¶ Flag that specifies whether the matrix has been analyzed.
-
is_analyzed
(self)[source]¶ Determine whether the matrix has been analyzed.
Returns: - flags : {
True
,False
}
- flags : {
-
name
= None¶ Name (string)
-
prop
= None¶ Linear system property {
'symmetric'
,'unsymmetric'
}.
- prop : {
-
class
optalg.lin_solver.mumps.
LinSolverMUMPS
(prop='unsymmetric')[source]¶ Linear solver based on MUMPS.
3.2. Optimization Problems¶
-
class
optalg.opt_solver.problem.
OptProblem
[source]¶ Class for representing general optimization problems.
Parameters: - problem : Object
-
A
= None¶ Matrix for linear equality constraints
-
H_combined
= None¶ Linear combination of Hessians of nonlinear constraints
-
Hphi
= None¶ Objective function Hessian (lower triangular)
-
J
= None¶ Jacobian of nonlinear constraints
-
P
= None¶ Integer flags (boolean array)
-
b
= None¶ Right-hand side for linear equality constraints
-
combine_H
(self, coeff, ensure_psd=False)[source]¶ Forms and saves a linear combination of the individual constraint Hessians.
Parameters: - coeff : vector
- ensure_psd : {
True
,``False``}
-
eval
(self, x)[source]¶ Evaluates the objective value and constraints at the give point.
Parameters: - x : vector
-
f
= None¶ Nonlinear equality constraint function
-
get_num_linear_equality_constraints
(self)[source]¶ Gets number of linear equality constraints.
Returns: - num : int
-
get_num_nonlinear_equality_constraints
(self)[source]¶ Gets number of nonlinear equality constraints.
Returns: - num : int
-
gphi
= None¶ Objective function gradient
-
l
= None¶ Lower limits
-
lam
= None¶ Lagrande multipliers for linear equality constraints
-
mu
= None¶ Lagrande multipliers for upper limits
-
nu
= None¶ Lagrande multipliers for nonlinear equality constraints
-
phi
= None¶ Objective function value
-
pi
= None¶ Lagrande multipliers for lower limits
-
recover_dual_variables
(self, lam, nu, mu, pi)[source]¶ Recovers dual variables for original problem.
Parameters: - lam : ndarray
- nu : ndarray
- mu : ndarray
- pi : ndarray
-
recover_primal_variables
(self, x)[source]¶ Recovers primal variables for original problem.
Parameters: - x : ndarray
-
u
= None¶ Upper limits
-
wrapped_problem
= None¶ Wrapped problem
-
x
= None¶ Initial point
-
class
optalg.opt_solver.problem_lin.
LinProblem
(c, A, b, l, u, x=None, lam=None, mu=None, pi=None)[source]¶ Linear program class.
Parameters: - c : vector
- A : matrix
- l : vector
- u : vector
- x : vector
3.3. Optimization Solvers¶
-
class
optalg.opt_solver.opt_solver.
OptSolver
[source]¶ Optimization solver class.
-
callbacks
= None¶ List of callback functions.
-
fdata
= None¶ Function data container.
-
get_dual_variables
(self)[source]¶ Gets dual variables.
Returns: - lam : vector
- nu : vector
- mu : vector
- pi : vector
-
info_printer
= None¶ Information printer (function).
-
is_status_solved
(self)[source]¶ Determines whether the solver solved the given problem.
Returns: - flag : {
True
,False
}
- flag : {
-
line_search
(self, x, p, F, GradF, func, smax=inf, maxiter=40)[source]¶ Finds steplength along search direction p that satisfies the strong Wolfe conditions.
Parameters: - x : current point (ndarray)
- p : search direction (ndarray)
- F : function value at x (float)
- GradF : gradient of function at x (ndarray)
- func : function of x that returns function object with attributes F and GradF (function)
- smax : maximum allowed steplength (float)
Returns: - s : stephlength that satisfies the Wolfe conditions (float).
-
parameters
= None¶ Parameters dictionary.
-
set_info_printer
(self, printer)[source]¶ Sets function for printing algorithm progress.
Parameters: - printer : Function.
-
terminations
= None¶ List of termination conditions.
-