Python API Reference#

Inner PANOC solver#

class alpaqa._alpaqa.PANOCSolver

C++ documentation: alpaqa::PANOCSolver

__call__(self: alpaqa._alpaqa.PANOCSolver, problem: alpaqa._alpaqa.Problem, Σ: numpy.ndarray[numpy.float64[m, 1]], ε: float, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], dict]

Solve.

Parameters
  • problem – Problem to solve

  • Σ – Penalty factor

  • ε – Desired tolerance

  • x – Initial guess

  • y – Initial Lagrange multipliers

Returns

  • Solution \(x\)

  • Updated Lagrange multipliers \(y\)

  • Slack variable error \(g(x) - z\)

  • Statistics

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.PANOCSolver) -> None

  2. __init__(self: alpaqa._alpaqa.PANOCSolver, panoc_params: Union[alpaqa._alpaqa.PANOCParams, dict], lbfgs_direction: alpaqa._alpaqa.LBFGSDirection) -> None

  3. __init__(self: alpaqa._alpaqa.PANOCSolver, panoc_params: Union[alpaqa._alpaqa.PANOCParams, dict], lbfgs_params: Union[alpaqa._alpaqa.LBFGSParams, dict]) -> None

  4. __init__(self: alpaqa._alpaqa.PANOCSolver, panoc_params: Union[alpaqa._alpaqa.PANOCParams, dict], direction: alpaqa._alpaqa.PANOCDirection) -> None

set_progress_callback(self: alpaqa._alpaqa.PANOCSolver, callback: Callable[[alpaqa._alpaqa.PANOCProgressInfo], None]) None

Attach a callback that is called on each iteration of the solver.

property direction
property params
class alpaqa._alpaqa.PANOCParams

C++ documentation: alpaqa::PANOCParams

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.PANOCParams) -> None

  2. __init__(self: alpaqa._alpaqa.PANOCParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.PANOCParams) dict
property L_max
property L_min
property Lipschitz
property alternative_linesearch_cond
property lbfgs_stepsize
property max_iter
property max_no_progress
property max_time
property print_interval
property quadratic_upperbound_tolerance_factor
property update_lipschitz_in_linesearch
property τ_min
class alpaqa._alpaqa.LBFGSParams

C++ documentation: alpaqa::LBFGSParams

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.LBFGSParams) -> None

  2. __init__(self: alpaqa._alpaqa.LBFGSParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.LBFGSParams) dict
property cbfgs
property memory
property rescale_when_γ_changes

Inner Structured PANOC solver#

class alpaqa._alpaqa.StructuredPANOCLBFGSSolver

C++ documentation: alpaqa::StructuredPANOCLBFGSSolver

__call__(self: alpaqa._alpaqa.StructuredPANOCLBFGSSolver, problem: alpaqa._alpaqa.Problem, Σ: numpy.ndarray[numpy.float64[m, 1]], ε: float, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], dict]

Solve.

Parameters
  • problem – Problem to solve

  • Σ – Penalty factor

  • ε – Desired tolerance

  • x – Initial guess

  • y – Initial Lagrange multipliers

Returns

  • Solution \(x\)

  • Updated Lagrange multipliers \(y\)

  • Slack variable error \(g(x) - z\)

  • Statistics

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.StructuredPANOCLBFGSSolver) -> None

  2. __init__(self: alpaqa._alpaqa.StructuredPANOCLBFGSSolver, panoc_params: Union[alpaqa._alpaqa.StructuredPANOCLBFGSParams, dict], lbfgs_params: Union[alpaqa._alpaqa.LBFGSParams, dict]) -> None

set_progress_callback(self: alpaqa._alpaqa.StructuredPANOCLBFGSSolver, callback: Callable[[alpaqa._alpaqa.StructuredPANOCLBFGSProgressInfo], None]) None

Attach a callback that is called on each iteration of the solver.

property params
class alpaqa._alpaqa.StructuredPANOCLBFGSParams

C++ documentation: alpaqa::StructuredPANOCLBFGSParams

__init__(self: alpaqa._alpaqa.StructuredPANOCLBFGSParams, **kwargs) None
to_dict(self: alpaqa._alpaqa.StructuredPANOCLBFGSParams) dict
property L_max
property L_min
property Lipschitz
property alternative_linesearch_cond
property full_augmented_hessian
property hessian_step_size_heuristic
property hessian_vec
property hessian_vec_finite_differences
property lbfgs_stepsize
property max_iter
property max_no_progress
property max_time
property nonmonotone_linesearch
property print_interval
property quadratic_upperbound_tolerance_factor
property stop_crit
property update_lipschitz_in_linesearch
property τ_min

Outer ALM solver#

class alpaqa._alpaqa.ALMSolver

Main augmented Lagrangian solver.

C++ documentation: alpaqa::ALMSolver

__call__(self: alpaqa._alpaqa.ALMSolver, problem: alpaqa._alpaqa.Problem, x: Optional[numpy.ndarray[numpy.float64[m, 1]]] = None, y: Optional[numpy.ndarray[numpy.float64[m, 1]]] = None) Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], dict]

Solve.

Parameters
  • problem – Problem to solve.

  • y – Initial guess for Lagrange multipliers \(y\)

  • x – Initial guess for decision variables \(x\)

Returns

  • Lagrange multipliers \(y\) at the solution

  • Solution \(x\)

  • Statistics

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.ALMSolver) -> None

Build an ALM solver using Structured PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: Union[alpaqa._alpaqa.ALMParams, dict], panoc_solver: alpaqa._alpaqa.PANOCSolver) -> None

Build an ALM solver using PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: Union[alpaqa._alpaqa.ALMParams, dict], pga_solver: alpaqa._alpaqa.PGASolver) -> None

Build an ALM solver using the projected gradient algorithm as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: Union[alpaqa._alpaqa.ALMParams, dict], structuredpanoc_solver: alpaqa._alpaqa.StructuredPANOCLBFGSSolver) -> None

Build an ALM solver using Structured PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: Union[alpaqa._alpaqa.ALMParams, dict], inner_solver: alpaqa._alpaqa.InnerSolver) -> None

Build an ALM solver using a custom inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, panoc_solver: alpaqa._alpaqa.PANOCSolver) -> None

Build an ALM solver using PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, pga_solver: alpaqa._alpaqa.PGASolver) -> None

Build an ALM solver using the projected gradient algorithm as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, structuredpanoc_solver: alpaqa._alpaqa.StructuredPANOCLBFGSSolver) -> None

Build an ALM solver using Structured PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, inner_solver: alpaqa._alpaqa.InnerSolver) -> None

Build an ALM solver using a custom inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: alpaqa._alpaqa.ALMParams) -> None

Build an ALM solver using Structured PANOC as inner solver.

property inner_solver
property params
class alpaqa._alpaqa.ALMParams

C++ documentation: alpaqa::ALMParams

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.ALMParams) -> None

  2. __init__(self: alpaqa._alpaqa.ALMParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.ALMParams) dict
property M
property max_iter
property max_num_initial_retries
property max_num_retries
property max_time
property max_total_num_retries
property preconditioning
property print_interval
property single_penalty_factor
property Δ
property Δ_lower
property Σ_0
property Σ_0_lower
property Σ_max
property Σ_min
property δ
property ε
property ε_0
property ε_0_increase
property θ
property ρ
property ρ_increase
property σ_0

Problem formulation#

class alpaqa._alpaqa.Problem

C++ documentation: alpaqa::Problem

__init__(self: alpaqa._alpaqa.Problem, n: int, m: int) None
Parameters
  • n – Number of unknowns

  • m – Number of constraints

property C

Box constraints on \(x\)

property D

Box constraints on \(g(x)\)

property f

Objective funcion, \(f(x)\)

property g

Constraint function, \(g(x)\)

property grad_f

Gradient of the objective function, \(\nabla f(x)\)

property grad_g_prod

Gradient of constraint function times vector, \(\nabla g(x)\, v\)

property grad_gi

Gradient vector of the \(i\)-th component of the constriant function, \(\nabla g_i(x)\)

property hess_L

Hessian of the Lagrangian function, \(\nabla^2_{xx} L(x,y)\)

property hess_L_prod

Hessian of the Lagrangian function times vector, \(\nabla^2_{xx} L(x,y)\, v\)

property m

Number of general constraints, dimension of \(g(x)\)

property n

Number of unknowns, dimension of \(x\)

class alpaqa._alpaqa.ProblemWithParam

C++ documentation: alpaqa::ProblemWithParam

See alpaqa._alpaqa.Problem for the full documentation.

__init__(*args, **kwargs)
property C
property D
property f
property g
property grad_f
property grad_g_prod
property grad_gi
property hess_L
property hess_L_prod
property m
property n
property param

Parameter vector \(p\) of the problem

CasADi Interface#

alpaqa.casadi_problem.generate_and_compile_casadi_problem(f: casadi.casadi.Function, g: casadi.casadi.Function, second_order: bool = False, name: str = 'alpaqa_problem') Union[alpaqa._alpaqa.Problem, alpaqa._alpaqa.ProblemWithParam][source]

Compile the objective and constraint functions into a alpaqa Problem.

Parameters
  • f – Objective function.

  • g – Constraint function.

  • second_order – Whether to generate functions for evaluating Hessians.

  • name – Optional string description of the problem (used for filename).

Returns

  • Problem specification that can be passed to the solvers.

alpaqa.casadi_problem.generate_casadi_problem(f: casadi.casadi.Function, g: casadi.casadi.Function, second_order: bool = False, name: str = 'alpaqa_problem') Tuple[casadi.casadi.CodeGenerator, int, int, int][source]

Convert the objective and constraint functions into a CasADi code generator.

Parameters
  • f – Objective function.

  • g – Constraint function.

  • second_order – Whether to generate functions for evaluating Hessians.

  • name – Optional string description of the problem (used for filename).

Returns

  • Code generator that generates the functions and derivatives used by the solvers.

  • Dimensions of the decision variables (primal dimension).

  • Number of nonlinear constraints (dual dimension).

  • Number of parameters.

All#

PANOC+ALM solvers

class alpaqa._alpaqa.ALMParams#

C++ documentation: alpaqa::ALMParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.ALMParams) -> None

  2. __init__(self: alpaqa._alpaqa.ALMParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.ALMParams) dict#
property M#
property max_iter#
property max_num_initial_retries#
property max_num_retries#
property max_time#
property max_total_num_retries#
property preconditioning#
property print_interval#
property single_penalty_factor#
property Δ#
property Δ_lower#
property Σ_0#
property Σ_0_lower#
property Σ_max#
property Σ_min#
property δ#
property ε#
property ε_0#
property ε_0_increase#
property θ#
property ρ#
property ρ_increase#
property σ_0#
class alpaqa._alpaqa.ALMSolver#

Main augmented Lagrangian solver.

C++ documentation: alpaqa::ALMSolver

__call__(self: alpaqa._alpaqa.ALMSolver, problem: alpaqa._alpaqa.Problem, x: Optional[numpy.ndarray[numpy.float64[m, 1]]] = None, y: Optional[numpy.ndarray[numpy.float64[m, 1]]] = None) Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], dict]#

Solve.

Parameters
  • problem – Problem to solve.

  • y – Initial guess for Lagrange multipliers \(y\)

  • x – Initial guess for decision variables \(x\)

Returns

  • Lagrange multipliers \(y\) at the solution

  • Solution \(x\)

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.ALMSolver) -> None

Build an ALM solver using Structured PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: Union[alpaqa._alpaqa.ALMParams, dict], panoc_solver: alpaqa._alpaqa.PANOCSolver) -> None

Build an ALM solver using PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: Union[alpaqa._alpaqa.ALMParams, dict], pga_solver: alpaqa._alpaqa.PGASolver) -> None

Build an ALM solver using the projected gradient algorithm as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: Union[alpaqa._alpaqa.ALMParams, dict], structuredpanoc_solver: alpaqa._alpaqa.StructuredPANOCLBFGSSolver) -> None

Build an ALM solver using Structured PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: Union[alpaqa._alpaqa.ALMParams, dict], inner_solver: alpaqa._alpaqa.InnerSolver) -> None

Build an ALM solver using a custom inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, panoc_solver: alpaqa._alpaqa.PANOCSolver) -> None

Build an ALM solver using PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, pga_solver: alpaqa._alpaqa.PGASolver) -> None

Build an ALM solver using the projected gradient algorithm as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, structuredpanoc_solver: alpaqa._alpaqa.StructuredPANOCLBFGSSolver) -> None

Build an ALM solver using Structured PANOC as inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, inner_solver: alpaqa._alpaqa.InnerSolver) -> None

Build an ALM solver using a custom inner solver.

  1. __init__(self: alpaqa._alpaqa.ALMSolver, alm_params: alpaqa._alpaqa.ALMParams) -> None

Build an ALM solver using Structured PANOC as inner solver.

property inner_solver#
property params#
class alpaqa._alpaqa.Box#

C++ documentation: alpaqa::Box

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.Box, n: int) -> None

Create an \(n\)-dimensional box at with bounds at \(\pm\infty\) (no constraints).

  1. __init__(self: alpaqa._alpaqa.Box, ub: numpy.ndarray[numpy.float64[m, 1]], lb: numpy.ndarray[numpy.float64[m, 1]]) -> None

Create a box with the given bounds.

property lowerbound#
property upperbound#
class alpaqa._alpaqa.EvalCounter#

C++ documentation: alpaqa::EvalCounter

__init__(*args, **kwargs)#
property f#
property g#
property grad_f#
property grad_g_prod#
property grad_gi#
property hess_L#
property hess_L_prod#
property time#
class alpaqa._alpaqa.EvalTimer#

C++ documentation: alpaqa::EvalCounter::EvalTimer

__init__(*args, **kwargs)#
property f#
property g#
property grad_f#
property grad_g_prod#
property grad_gi#
property hess_L#
property hess_L_prod#
class alpaqa._alpaqa.GAAPGAParams#

C++ documentation: alpaqa::GAAPGAParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.GAAPGAParams) -> None

  2. __init__(self: alpaqa._alpaqa.GAAPGAParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.GAAPGAParams) dict#
property L_max#
property L_min#
property Lipschitz#
property full_flush_on_γ_change#
property limitedqr_mem#
property max_iter#
property max_no_progress#
property max_time#
property print_interval#
property quadratic_upperbound_tolerance_factor#
property stop_crit#
class alpaqa._alpaqa.GAAPGAProgressInfo#

C++ documentation: alpaqa::GAAPGAProgressInfo

__init__(*args, **kwargs)#
property L#
property fpr#
property grad_ψ#
property grad_ψ_hat#
property k#
property norm_sq_p#
property p#
property x#
property x_hat#
property y#
property Σ#
property γ#
property ε#
property ψ#
property ψ_hat#
class alpaqa._alpaqa.GAAPGASolver#

C++ documentation: alpaqa::GAAPGASolver

__call__(self: alpaqa._alpaqa.GAAPGASolver, problem: alpaqa._alpaqa.Problem, Σ: numpy.ndarray[numpy.float64[m, 1]], ε: float, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], dict]#

Solve.

Parameters
  • problem – Problem to solve

  • Σ – Penalty factor

  • ε – Desired tolerance

  • x – Initial guess

  • y – Initial Lagrange multipliers

Returns

  • Solution \(x\)

  • Updated Lagrange multipliers \(y\)

  • Slack variable error \(g(x) - z\)

  • Statistics

__init__(self: alpaqa._alpaqa.GAAPGASolver, arg0: alpaqa._alpaqa.GAAPGAParams) None#
set_progress_callback(self: alpaqa._alpaqa.GAAPGASolver, callback: Callable[[alpaqa._alpaqa.GAAPGAProgressInfo], None]) None#

Attach a callback that is called on each iteration of the solver.

property params#
class alpaqa._alpaqa.InnerSolver#
__call__(self: alpaqa._alpaqa.InnerSolver, arg0: alpaqa._alpaqa.Problem, arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: float, arg3: bool, arg4: numpy.ndarray[numpy.float64[m, 1], flags.writeable], arg5: numpy.ndarray[numpy.float64[m, 1], flags.writeable], arg6: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) alpaqa._alpaqa.InnerSolverStats#
__init__(self: alpaqa._alpaqa.InnerSolver) None#
get_name(self: alpaqa._alpaqa.InnerSolver) str#
get_params(self: alpaqa._alpaqa.InnerSolver) object#
stop(self: alpaqa._alpaqa.InnerSolver) None#
class alpaqa._alpaqa.InnerSolverStats#
__init__(self: alpaqa._alpaqa.InnerSolverStats, arg0: dict) None#
class alpaqa._alpaqa.LBFGSDirection#

C++ documentation: alpaqa::LBFGSDirection

__init__(self: alpaqa._alpaqa.LBFGSDirection, params: alpaqa._alpaqa.LBFGSParams) None#
apply(self: alpaqa._alpaqa.LBFGSDirection, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: numpy.ndarray[numpy.float64[m, 1]], arg3: float) numpy.ndarray[numpy.float64[m, 1]]#
changed_γ(self: alpaqa._alpaqa.LBFGSDirection, arg0: float, arg1: float) None#
get_name(self: alpaqa._alpaqa.LBFGSDirection) str#
initialize(self: alpaqa._alpaqa.LBFGSDirection, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: numpy.ndarray[numpy.float64[m, 1]], arg3: numpy.ndarray[numpy.float64[m, 1]]) None#
reset(self: alpaqa._alpaqa.LBFGSDirection) None#
update(self: alpaqa._alpaqa.LBFGSDirection, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: numpy.ndarray[numpy.float64[m, 1]], arg3: numpy.ndarray[numpy.float64[m, 1]], arg4: numpy.ndarray[numpy.float64[m, 1]], arg5: alpaqa._alpaqa.Box, arg6: float) bool#
property params#
class alpaqa._alpaqa.LBFGSParams#

C++ documentation: alpaqa::LBFGSParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.LBFGSParams) -> None

  2. __init__(self: alpaqa._alpaqa.LBFGSParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.LBFGSParams) dict#
property cbfgs#
property memory#
property rescale_when_γ_changes#
class alpaqa._alpaqa.LBFGSParamsCBFGS#

C++ documentation: alpaqa::LBFGSParams::cbfgs

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.LBFGSParamsCBFGS) -> None

  2. __init__(self: alpaqa._alpaqa.LBFGSParamsCBFGS, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.LBFGSParamsCBFGS) dict#
property α#
property ϵ#
class alpaqa._alpaqa.LBFGSStepsize#

C++ documentation: alpaqa::LBFGSStepSize

Members:

BasedOnGradientStepSize

BasedOnCurvature

__init__(self: alpaqa._alpaqa.LBFGSStepsize, value: int) None#
BasedOnCurvature = <LBFGSStepsize.BasedOnCurvature: 1>#
BasedOnGradientStepSize = <LBFGSStepsize.BasedOnGradientStepSize: 0>#
property name#
property value#
class alpaqa._alpaqa.LipschitzEstimateParams#

C++ documentation: alpaqa::LipschitzEstimateParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.LipschitzEstimateParams) -> None

  2. __init__(self: alpaqa._alpaqa.LipschitzEstimateParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.LipschitzEstimateParams) dict#
property L_0#
property Lγ_factor#
property δ#
property ε#
class alpaqa._alpaqa.PANOCDirection#

Class that provides fast directions for the PANOC algorithm (e.g. L-BFGS)

__init__(self: alpaqa._alpaqa.PANOCDirection) None#
apply(self: alpaqa._alpaqa.PANOCDirection, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: numpy.ndarray[numpy.float64[m, 1]], arg3: float) numpy.ndarray[numpy.float64[m, 1]]#
changed_γ(self: alpaqa._alpaqa.PANOCDirection, arg0: float, arg1: float) None#
get_name(self: alpaqa._alpaqa.PANOCDirection) str#
initialize(self: alpaqa._alpaqa.PANOCDirection, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: numpy.ndarray[numpy.float64[m, 1]], arg3: numpy.ndarray[numpy.float64[m, 1]]) None#
reset(self: alpaqa._alpaqa.PANOCDirection) None#
update(self: alpaqa._alpaqa.PANOCDirection, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: numpy.ndarray[numpy.float64[m, 1]], arg3: numpy.ndarray[numpy.float64[m, 1]], arg4: numpy.ndarray[numpy.float64[m, 1]], arg5: alpaqa._alpaqa.Box, arg6: float) bool#
class alpaqa._alpaqa.PANOCParams#

C++ documentation: alpaqa::PANOCParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.PANOCParams) -> None

  2. __init__(self: alpaqa._alpaqa.PANOCParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.PANOCParams) dict#
property L_max#
property L_min#
property Lipschitz#
property alternative_linesearch_cond#
property lbfgs_stepsize#
property max_iter#
property max_no_progress#
property max_time#
property print_interval#
property quadratic_upperbound_tolerance_factor#
property update_lipschitz_in_linesearch#
property τ_min#
class alpaqa._alpaqa.PANOCProgressInfo#

Data passed to the PANOC progress callback.

C++ documentation: alpaqa::PANOCProgressInfo

__init__(*args, **kwargs)#
property L#

Estimate of Lipschitz constant of objective \(L\)

property fpr#

Fixed-point residual \(\left\|p\right\| / \gamma\)

property grad_ψ#

Gradient of objective \(\nabla\psi(x)\)

property grad_ψ_hat#
property k#

Iteration

property norm_sq_p#

\(\left\|p\right\|^2\)

property p#

Projected gradient step \(p\)

property x#

Decision variable \(x\)

property x_hat#

Decision variable after projected gradient step \(\hat x\)

property y#

Lagrange multipliers \(y\)

property Σ#

Penalty factor \(\Sigma\)

property γ#

Step size \(\gamma\)

property ε#

Tolerance reached \(\varepsilon_k\)

property τ#

Line search parameter \(\tau\)

property φγ#

Forward-backward envelope \(\varphi_\gamma(x)\)

property ψ#

Objective value \(\psi(x)\)

property ψ_hat#
class alpaqa._alpaqa.PANOCSolver#

C++ documentation: alpaqa::PANOCSolver

__call__(self: alpaqa._alpaqa.PANOCSolver, problem: alpaqa._alpaqa.Problem, Σ: numpy.ndarray[numpy.float64[m, 1]], ε: float, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], dict]#

Solve.

Parameters
  • problem – Problem to solve

  • Σ – Penalty factor

  • ε – Desired tolerance

  • x – Initial guess

  • y – Initial Lagrange multipliers

Returns

  • Solution \(x\)

  • Updated Lagrange multipliers \(y\)

  • Slack variable error \(g(x) - z\)

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.PANOCSolver) -> None

  2. __init__(self: alpaqa._alpaqa.PANOCSolver, panoc_params: Union[alpaqa._alpaqa.PANOCParams, dict], lbfgs_direction: alpaqa._alpaqa.LBFGSDirection) -> None

  3. __init__(self: alpaqa._alpaqa.PANOCSolver, panoc_params: Union[alpaqa._alpaqa.PANOCParams, dict], lbfgs_params: Union[alpaqa._alpaqa.LBFGSParams, dict]) -> None

  4. __init__(self: alpaqa._alpaqa.PANOCSolver, panoc_params: Union[alpaqa._alpaqa.PANOCParams, dict], direction: alpaqa._alpaqa.PANOCDirection) -> None

set_progress_callback(self: alpaqa._alpaqa.PANOCSolver, callback: Callable[[alpaqa._alpaqa.PANOCProgressInfo], None]) None#

Attach a callback that is called on each iteration of the solver.

property direction#
property params#
class alpaqa._alpaqa.PANOCStopCrit#

C++ documentation: alpaqa::PANOCStopCrit

Members:

ApproxKKT

ApproxKKT2

ProjGradNorm

ProjGradNorm2

ProjGradUnitNorm

ProjGradUnitNorm2

FPRNorm

FPRNorm2

Ipopt

__init__(self: alpaqa._alpaqa.PANOCStopCrit, value: int) None#
ApproxKKT = <PANOCStopCrit.ApproxKKT: 0>#
ApproxKKT2 = <PANOCStopCrit.ApproxKKT2: 1>#
FPRNorm = <PANOCStopCrit.FPRNorm: 6>#
FPRNorm2 = <PANOCStopCrit.FPRNorm2: 7>#
Ipopt = <PANOCStopCrit.Ipopt: 8>#
ProjGradNorm = <PANOCStopCrit.ProjGradNorm: 2>#
ProjGradNorm2 = <PANOCStopCrit.ProjGradNorm2: 3>#
ProjGradUnitNorm = <PANOCStopCrit.ProjGradUnitNorm: 4>#
ProjGradUnitNorm2 = <PANOCStopCrit.ProjGradUnitNorm2: 5>#
property name#
property value#
class alpaqa._alpaqa.PGAParams#

C++ documentation: alpaqa::PGAParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.PGAParams) -> None

  2. __init__(self: alpaqa._alpaqa.PGAParams, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.PGAParams) dict#
property L_max#
property L_min#
property Lipschitz#
property max_iter#
property max_time#
property print_interval#
property quadratic_upperbound_tolerance_factor#
property stop_crit#
class alpaqa._alpaqa.PGAProgressInfo#

C++ documentation: alpaqa::PGAProgressInfo

__init__(*args, **kwargs)#
property L#
property fpr#
property grad_ψ#
property grad_ψ_hat#
property k#
property norm_sq_p#
property p#
property x#
property x_hat#
property y#
property Σ#
property γ#
property ε#
property ψ#
property ψ_hat#
class alpaqa._alpaqa.PGASolver#

C++ documentation: alpaqa::PGASolver

__call__(self: alpaqa._alpaqa.PGASolver, problem: alpaqa._alpaqa.Problem, Σ: numpy.ndarray[numpy.float64[m, 1]], ε: float, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], dict]#

Solve.

Parameters
  • problem – Problem to solve

  • Σ – Penalty factor

  • ε – Desired tolerance

  • x – Initial guess

  • y – Initial Lagrange multipliers

Returns

  • Solution \(x\)

  • Updated Lagrange multipliers \(y\)

  • Slack variable error \(g(x) - z\)

  • Statistics

__init__(self: alpaqa._alpaqa.PGASolver, arg0: alpaqa._alpaqa.PGAParams) None#
set_progress_callback(self: alpaqa._alpaqa.PGASolver, callback: Callable[[alpaqa._alpaqa.PGAProgressInfo], None]) None#

Attach a callback that is called on each iteration of the solver.

property params#
class alpaqa._alpaqa.Problem#

C++ documentation: alpaqa::Problem

__init__(self: alpaqa._alpaqa.Problem, n: int, m: int) None#
Parameters
  • n – Number of unknowns

  • m – Number of constraints

property C#

Box constraints on \(x\)

property D#

Box constraints on \(g(x)\)

property f#

Objective funcion, \(f(x)\)

property g#

Constraint function, \(g(x)\)

property grad_f#

Gradient of the objective function, \(\nabla f(x)\)

property grad_g_prod#

Gradient of constraint function times vector, \(\nabla g(x)\, v\)

property grad_gi#

Gradient vector of the \(i\)-th component of the constriant function, \(\nabla g_i(x)\)

property hess_L#

Hessian of the Lagrangian function, \(\nabla^2_{xx} L(x,y)\)

property hess_L_prod#

Hessian of the Lagrangian function times vector, \(\nabla^2_{xx} L(x,y)\, v\)

property m#

Number of general constraints, dimension of \(g(x)\)

property n#

Number of unknowns, dimension of \(x\)

class alpaqa._alpaqa.ProblemWithCounters#

C++ documentation: alpaqa::ProblemWithCounters

See alpaqa._alpaqa.Problem for the full documentation.

__init__(self: alpaqa._alpaqa.ProblemWithCounters, problem: alpaqa._alpaqa.Problem) None#
property C#
property D#
property evaluations#
property f#
property g#
property grad_f#
property grad_g_prod#
property grad_gi#
property hess_L#
property hess_L_prod#
property m#
property n#
class alpaqa._alpaqa.ProblemWithParam#

C++ documentation: alpaqa::ProblemWithParam

See alpaqa._alpaqa.Problem for the full documentation.

__init__(*args, **kwargs)#
property C#
property D#
property f#
property g#
property grad_f#
property grad_g_prod#
property grad_gi#
property hess_L#
property hess_L_prod#
property m#
property n#
property param#

Parameter vector \(p\) of the problem

class alpaqa._alpaqa.ProblemWithParamWithCounters#

C++ documentation: alpaqa::ProblemWithCounters

See alpaqa._alpaqa.Problem for the full documentation.

__init__(self: alpaqa._alpaqa.ProblemWithParamWithCounters, problem: alpaqa._alpaqa.ProblemWithParam) None#
property C#
property D#
property evaluations#
property f#
property g#
property grad_f#
property grad_g_prod#
property grad_gi#
property hess_L#
property hess_L_prod#
property m#
property n#
property param#

Parameter vector \(p\) of the problem

class alpaqa._alpaqa.SolverStatus#

C++ documentation: alpaqa::SolverStatus

Members:

Unknown : Initial value

Converged : Converged and reached given tolerance

MaxTime : Maximum allowed execution time exceeded

MaxIter : Maximum number of iterations exceeded

NotFinite : Intermediate results were infinite or not-a-number

NoProgress : No progress was made in the last iteration

Interrupted : Solver was interrupted by the user

__init__(self: alpaqa._alpaqa.SolverStatus, value: int) None#
Converged = <SolverStatus.Converged: 1>#
Interrupted = <SolverStatus.Interrupted: 6>#
MaxIter = <SolverStatus.MaxIter: 3>#
MaxTime = <SolverStatus.MaxTime: 2>#
NoProgress = <SolverStatus.NoProgress: 5>#
NotFinite = <SolverStatus.NotFinite: 4>#
Unknown = <SolverStatus.Unknown: 0>#
property name#
property value#
class alpaqa._alpaqa.StructuredPANOCLBFGSParams#

C++ documentation: alpaqa::StructuredPANOCLBFGSParams

__init__(self: alpaqa._alpaqa.StructuredPANOCLBFGSParams, **kwargs) None#
to_dict(self: alpaqa._alpaqa.StructuredPANOCLBFGSParams) dict#
property L_max#
property L_min#
property Lipschitz#
property alternative_linesearch_cond#
property full_augmented_hessian#
property hessian_step_size_heuristic#
property hessian_vec#
property hessian_vec_finite_differences#
property lbfgs_stepsize#
property max_iter#
property max_no_progress#
property max_time#
property nonmonotone_linesearch#
property print_interval#
property quadratic_upperbound_tolerance_factor#
property stop_crit#
property update_lipschitz_in_linesearch#
property τ_min#
class alpaqa._alpaqa.StructuredPANOCLBFGSProgressInfo#

Data passed to the structured PANOC progress callback.

C++ documentation: alpaqa::StructuredPANOCLBFGSProgressInfo

__init__(*args, **kwargs)#
property L#
property fpr#
property grad_ψ#
property grad_ψ_hat#
property k#
property norm_sq_p#
property p#
property x#
property x_hat#
property y#
property Σ#
property γ#
property ε#
property τ#
property φγ#
property ψ#
property ψ_hat#
class alpaqa._alpaqa.StructuredPANOCLBFGSSolver#

C++ documentation: alpaqa::StructuredPANOCLBFGSSolver

__call__(self: alpaqa._alpaqa.StructuredPANOCLBFGSSolver, problem: alpaqa._alpaqa.Problem, Σ: numpy.ndarray[numpy.float64[m, 1]], ε: float, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], dict]#

Solve.

Parameters
  • problem – Problem to solve

  • Σ – Penalty factor

  • ε – Desired tolerance

  • x – Initial guess

  • y – Initial Lagrange multipliers

Returns

  • Solution \(x\)

  • Updated Lagrange multipliers \(y\)

  • Slack variable error \(g(x) - z\)

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.StructuredPANOCLBFGSSolver) -> None

  2. __init__(self: alpaqa._alpaqa.StructuredPANOCLBFGSSolver, panoc_params: Union[alpaqa._alpaqa.StructuredPANOCLBFGSParams, dict], lbfgs_params: Union[alpaqa._alpaqa.LBFGSParams, dict]) -> None

set_progress_callback(self: alpaqa._alpaqa.StructuredPANOCLBFGSSolver, callback: Callable[[alpaqa._alpaqa.StructuredPANOCLBFGSProgressInfo], None]) None#

Attach a callback that is called on each iteration of the solver.

property params#
alpaqa._alpaqa.load_casadi_problem(so_name: str, n: int = 0, m: int = 0, second_order: bool = False) alpaqa._alpaqa.Problem#

Load a compiled CasADi problem without parameters.

C++ documentation: alpaqa::load_CasADi_problem()

alpaqa._alpaqa.load_casadi_problem_with_param(so_name: str, n: int = 0, m: int = 0, p: int = 0, second_order: bool = False) alpaqa._alpaqa.ProblemWithParam#

Load a compiled CasADi problem with parameters.

C++ documentation: alpaqa::load_CasADi_problem_with_param()

alpaqa._alpaqa.panoc(ψ: Callable[[numpy.ndarray[numpy.float64[m, 1]]], float], grad_ψ: Callable[[numpy.ndarray[numpy.float64[m, 1]]], numpy.ndarray[numpy.float64[m, 1]]], C: alpaqa._alpaqa.Box, x0: Optional[numpy.ndarray[numpy.float64[m, 1]]] = None, ε: float = 1e-08, params: alpaqa._alpaqa.PANOCParams = <alpaqa._alpaqa.PANOCParams object at 0x7fb8e7fd65f0>, lbfgs_params: alpaqa._alpaqa.LBFGSParams = <alpaqa._alpaqa.LBFGSParams object at 0x7fb8e7108670>) Tuple[numpy.ndarray[numpy.float64[m, 1]], dict]#
alpaqa.casadi_problem.generate_and_compile_casadi_problem(f: casadi.casadi.Function, g: casadi.casadi.Function, second_order: bool = False, name: str = 'alpaqa_problem') Union[alpaqa._alpaqa.Problem, alpaqa._alpaqa.ProblemWithParam][source]#

Compile the objective and constraint functions into a alpaqa Problem.

Parameters
  • f – Objective function.

  • g – Constraint function.

  • second_order – Whether to generate functions for evaluating Hessians.

  • name – Optional string description of the problem (used for filename).

Returns

  • Problem specification that can be passed to the solvers.

alpaqa.casadi_problem.generate_casadi_problem(f: casadi.casadi.Function, g: casadi.casadi.Function, second_order: bool = False, name: str = 'alpaqa_problem') Tuple[casadi.casadi.CodeGenerator, int, int, int][source]#

Convert the objective and constraint functions into a CasADi code generator.

Parameters
  • f – Objective function.

  • g – Constraint function.

  • second_order – Whether to generate functions for evaluating Hessians.

  • name – Optional string description of the problem (used for filename).

Returns

  • Code generator that generates the functions and derivatives used by the solvers.

  • Dimensions of the decision variables (primal dimension).

  • Number of nonlinear constraints (dual dimension).

  • Number of parameters.