Python API Reference#

Index#

Augmented Lagrangian and PANOC solvers for nonconvex numerical optimization.

class alpaqa.ALMParams#

C++ documentation: alpaqa::ALMParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.ALMParams, params: dict) -> None

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

property dual_tolerance#
property initial_penalty#
property initial_penalty_factor#
property initial_tolerance#
property max_iter#
property max_multiplier#
property max_penalty#
property max_time#
property min_penalty#
property penalty_update_factor#
property print_interval#
property print_precision#
property rel_penalty_increase_threshold#
property single_penalty_factor#
to_dict(self: alpaqa._alpaqa.float64.ALMParams) dict#
property tolerance#
property tolerance_update_factor#
class alpaqa.ALMSolver#

Main augmented Lagrangian solver.

C++ documentation: alpaqa::ALMSolver

__call__(self: alpaqa._alpaqa.float64.ALMSolver, problem: alpaqa._alpaqa.float64.Problem | alpaqa._alpaqa.float64.ControlProblem, x: numpy.ndarray[numpy.float64[m, 1]] | None = None, y: numpy.ndarray[numpy.float64[m, 1]] | None = None, *, asynchronous: bool = True, suppress_interrupt: bool = False) tuple#

Solve.

Parameters:
  • problem – Problem to solve.

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

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

  • asynchronous – Release the GIL and run the solver on a separate thread

  • suppress_interrupt – If the solver is interrupted by a KeyboardInterrupt, don’t propagate this exception back to the Python interpreter, but stop the solver early, and return a solution with the status set to alpaqa.SolverStatus.Interrupted.

Returns:

  • Solution \(x\)

  • Lagrange multipliers \(y\) at the solution

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

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

Create a copy

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

Build an ALM solver using Structured PANOC as inner solver.

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

Build an ALM solver using the given inner solver.

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

Build an ALM solver using the given inner solver.

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

Build an ALM solver using the given inner solver.

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

Build an ALM solver using the given inner solver.

property inner_solver#
property name#
property params#
stop(self: alpaqa._alpaqa.float64.ALMSolver) None#
class alpaqa.AndersonAccel#

C++ documentation alpaqa::AndersonAccel

class Params#

C++ documentation alpaqa::AndersonAccelParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.AndersonAccel.Params, params: dict) -> None

  2. __init__(self: alpaqa._alpaqa.float64.AndersonAccel.Params, **kwargs) -> None

property memory#
property min_div_fac#
to_dict(self: alpaqa._alpaqa.float64.AndersonAccel.Params) dict#
property Q#
property R#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.AndersonAccel, params: Union[alpaqa._alpaqa.float64.AndersonAccel.Params, dict]) -> None

  2. __init__(self: alpaqa._alpaqa.float64.AndersonAccel, params: Union[alpaqa._alpaqa.float64.AndersonAccel.Params, dict], n: int) -> None

compute(*args, **kwargs)#

Overloaded function.

  1. compute(self: alpaqa._alpaqa.float64.AndersonAccel, g_k: numpy.ndarray[numpy.float64[m, 1]], r_k: numpy.ndarray[numpy.float64[m, 1]], x_k_aa: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. compute(self: alpaqa._alpaqa.float64.AndersonAccel, g_k: numpy.ndarray[numpy.float64[m, 1]], r_k: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

property current_history#
property history#
initialize(self: alpaqa._alpaqa.float64.AndersonAccel, g_0: numpy.ndarray[numpy.float64[m, 1]], r_0: numpy.ndarray[numpy.float64[m, 1]]) None#
property n#
property params#
reset(self: alpaqa._alpaqa.float64.AndersonAccel) None#
resize(self: alpaqa._alpaqa.float64.AndersonAccel, n: int) None#
class alpaqa.AndersonDirection#

C++ documentation: alpaqa::AndersonDirection

class DirectionParams#

C++ documentation: alpaqa::AndersonDirection::DirectionParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.AndersonDirection.DirectionParams, params: dict) -> None

  2. __init__(self: alpaqa._alpaqa.float64.AndersonDirection.DirectionParams, **kwargs) -> None

property rescale_on_step_size_changes#
to_dict(self: alpaqa._alpaqa.float64.AndersonDirection.DirectionParams) dict#
__init__(self: alpaqa._alpaqa.float64.AndersonDirection, anderson_params: alpaqa._alpaqa.float64.AndersonAccel.Params | dict = {}, direction_params: alpaqa._alpaqa.float64.AndersonDirection.DirectionParams | dict = {}) None#
property params#
class alpaqa.Box#

C++ documentation: alpaqa::Box

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.Box, other: alpaqa._alpaqa.float64.Box) -> None

Create a copy

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

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

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

Create a box with the given bounds.

property lowerbound#
property upperbound#
class alpaqa.BoxConstrProblem#

C++ documentation: alpaqa::BoxConstrProblem

property C#

Box constraints on \(x\)

property D#

Box constraints on \(g(x)\)

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.BoxConstrProblem, other: alpaqa._alpaqa.float64.BoxConstrProblem) -> None

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.BoxConstrProblem, n: int, m: int) -> None

Parameters:
  • n – Number of unknowns

  • m – Number of constraints

eval_inactive_indices_res_lna(*args, **kwargs)#

Overloaded function.

  1. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.BoxConstrProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], J: numpy.ndarray[numpy.int64[m, 1], flags.writeable]) -> int

  2. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.BoxConstrProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.int64[m, 1]]

eval_proj_diff_g(*args, **kwargs)#

Overloaded function.

  1. eval_proj_diff_g(self: alpaqa._alpaqa.float64.BoxConstrProblem, z: numpy.ndarray[numpy.float64[m, 1]], e: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_proj_diff_g(self: alpaqa._alpaqa.float64.BoxConstrProblem, z: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_proj_multipliers(self: alpaqa._alpaqa.float64.BoxConstrProblem, y: numpy.ndarray[numpy.float64[m, 1], flags.writeable], M: float) None#
eval_prox_grad_step(*args, **kwargs)#

Overloaded function.

  1. eval_prox_grad_step(self: alpaqa._alpaqa.float64.BoxConstrProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], x_hat: numpy.ndarray[numpy.float64[m, 1], flags.writeable], p: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_prox_grad_step(self: alpaqa._alpaqa.float64.BoxConstrProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], float]

get_box_C(self: alpaqa._alpaqa.float64.BoxConstrProblem) alpaqa._alpaqa.float64.Box#
get_box_D(self: alpaqa._alpaqa.float64.BoxConstrProblem) alpaqa._alpaqa.float64.Box#
property l1_reg#

\(\ell_1\) regularization on \(x\)

property m#

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

property n#

Number of decision variables, dimension of \(x\)

property penalty_alm_split#

Index between quadratic penalty and augmented Lagrangian constraints

resize(self: alpaqa._alpaqa.float64.BoxConstrProblem, n: int, m: int) None#
class alpaqa.CUTEstProblem#

C++ documentation: alpaqa::CUTEstProblem

See alpaqa.Problem for the full documentation.

class Report#
class Calls#
__init__(*args, **kwargs)#
property constraints#
property constraints_grad#
property constraints_hess#
property hessian_times_vector#
property objective#
property objective_grad#
property objective_hess#
__init__(*args, **kwargs)#
property calls#
property time#
property time_setup#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.CUTEstProblem, so_filename: str, outsdiff_filename: str = None, sparse: bool = False) -> None

Load a CUTEst problem from the given shared library and OUTSDIF.d file

  1. __init__(self: alpaqa._alpaqa.float64.CUTEstProblem, other: alpaqa._alpaqa.float64.CUTEstProblem) -> None

Create a copy

check(self: alpaqa._alpaqa.float64.CUTEstProblem) None#
eval_f(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]]) float#
eval_f_g(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], g: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) float#
eval_f_grad_f(*args, **kwargs)#

Overloaded function.

  1. eval_f_grad_f(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_f_grad_f(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> tuple

eval_g(*args, **kwargs)#

Overloaded function.

  1. eval_g(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], gx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_g(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_L(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_L: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_f(*args, **kwargs)#

Overloaded function.

  1. eval_grad_f(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_f(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_g_prod(*args, **kwargs)#

Overloaded function.

  1. eval_grad_g_prod(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_gxy: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_g_prod(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_gi(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], i: int, grad_gi: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_hess_L(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], scale: float = 1.0) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Hessian of the Lagrangian and its symmetry.

eval_hess_L_prod(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], scale: float, v: numpy.ndarray[numpy.float64[m, 1]], Hv: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_hess_ψ_prod(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], scale: float, v: numpy.ndarray[numpy.float64[m, 1]], Hv: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_inactive_indices_res_lna(*args, **kwargs)#

Overloaded function.

  1. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.CUTEstProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], J: numpy.ndarray[numpy.int64[m, 1], flags.writeable]) -> int

  2. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.CUTEstProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.int64[m, 1]]

eval_jac_g(self: alpaqa._alpaqa.float64.CUTEstProblem, x: numpy.ndarray[numpy.float64[m, 1]]) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Jacobian of the constraints and its symmetry.

eval_proj_diff_g(*args, **kwargs)#

Overloaded function.

  1. eval_proj_diff_g(self: alpaqa._alpaqa.float64.CUTEstProblem, z: numpy.ndarray[numpy.float64[m, 1]], e: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_proj_diff_g(self: alpaqa._alpaqa.float64.CUTEstProblem, z: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_proj_multipliers(self: alpaqa._alpaqa.float64.CUTEstProblem, y: numpy.ndarray[numpy.float64[m, 1], flags.writeable], M: float) None#
eval_prox_grad_step(*args, **kwargs)#

Overloaded function.

  1. eval_prox_grad_step(self: alpaqa._alpaqa.float64.CUTEstProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], x_hat: numpy.ndarray[numpy.float64[m, 1], flags.writeable], p: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_prox_grad_step(self: alpaqa._alpaqa.float64.CUTEstProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], float]

format_report(self: alpaqa._alpaqa.float64.CUTEstProblem, report: alpaqa._alpaqa.float64.CUTEstProblem.Report | None = None) str#

Convert the given report to a string.

get_box_C(self: alpaqa._alpaqa.float64.CUTEstProblem) alpaqa._alpaqa.float64.Box#
get_box_D(self: alpaqa._alpaqa.float64.CUTEstProblem) alpaqa._alpaqa.float64.Box#
get_report(self: alpaqa._alpaqa.float64.CUTEstProblem) alpaqa._alpaqa.float64.CUTEstProblem.Report#

Get the report generated by cutest_creport.

property m#

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

property n#

Number of decision variables, dimension of \(x\)

property name#

CUTEst problem name.

provides_get_box_C(self: alpaqa._alpaqa.float64.CUTEstProblem) bool#
property x0#

Initial guess for decision variables.

property y0#

Initial guess for multipliers.

class alpaqa.CasADiControlProblem#

C++ documentation: alpaqa::CasADiControlProblem

See alpaqa.ControlProblem for the full documentation.

property D#
property D_N#
property N#
property U#
__init__(self: alpaqa._alpaqa.float64.CasADiControlProblem, other: alpaqa._alpaqa.float64.CasADiControlProblem) None#

Create a copy

property nc#
property nc_N#
property nh#
property nh_N#
property nu#
property nx#
property param#

Parameter vector \(p\) of the problem

property x_init#

Initial state vector \(x^0\) of the problem

class alpaqa.CasADiProblem#

C++ documentation: alpaqa::CasADiProblem

See alpaqa.Problem for the full documentation.

__init__(self: alpaqa._alpaqa.float64.CasADiProblem, other: alpaqa._alpaqa.float64.CasADiProblem) None#

Create a copy

check(self: alpaqa._alpaqa.float64.CasADiProblem) None#
eval_f(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]]) float#
eval_f_grad_f(*args, **kwargs)#

Overloaded function.

  1. eval_f_grad_f(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_f_grad_f(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> tuple

eval_g(*args, **kwargs)#

Overloaded function.

  1. eval_g(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], gx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_g(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_L(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_L: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_f(*args, **kwargs)#

Overloaded function.

  1. eval_grad_f(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_f(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_g_prod(*args, **kwargs)#

Overloaded function.

  1. eval_grad_g_prod(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_gxy: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_g_prod(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_gi(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], i: int, grad_gi: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_grad_ψ(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_m: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_ψ(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_hess_L(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], scale: float = 1.0) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Hessian of the Lagrangian and its symmetry.

eval_hess_L_prod(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], scale: float, v: numpy.ndarray[numpy.float64[m, 1]], Hv: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_hess_ψ(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], scale: float = 1.0) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Hessian of the augmented Lagrangian and its symmetry.

eval_hess_ψ_prod(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], scale: float, v: numpy.ndarray[numpy.float64[m, 1]], Hv: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_inactive_indices_res_lna(*args, **kwargs)#

Overloaded function.

  1. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.CasADiProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], J: numpy.ndarray[numpy.int64[m, 1], flags.writeable]) -> int

  2. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.CasADiProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.int64[m, 1]]

eval_jac_g(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]]) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Jacobian of the constraints and its symmetry.

eval_proj_diff_g(*args, **kwargs)#

Overloaded function.

  1. eval_proj_diff_g(self: alpaqa._alpaqa.float64.CasADiProblem, z: numpy.ndarray[numpy.float64[m, 1]], e: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_proj_diff_g(self: alpaqa._alpaqa.float64.CasADiProblem, z: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_proj_multipliers(self: alpaqa._alpaqa.float64.CasADiProblem, y: numpy.ndarray[numpy.float64[m, 1], flags.writeable], M: float) None#
eval_prox_grad_step(*args, **kwargs)#

Overloaded function.

  1. eval_prox_grad_step(self: alpaqa._alpaqa.float64.CasADiProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], x_hat: numpy.ndarray[numpy.float64[m, 1], flags.writeable], p: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_prox_grad_step(self: alpaqa._alpaqa.float64.CasADiProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], float]

eval_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_ψ(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], ŷ: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_ψ(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[float, numpy.ndarray[numpy.float64[m, 1]]]

eval_ψ_grad_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_m: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[float, numpy.ndarray[numpy.float64[m, 1]]]

get_box_C(self: alpaqa._alpaqa.float64.CasADiProblem) alpaqa._alpaqa.float64.Box#
get_box_D(self: alpaqa._alpaqa.float64.CasADiProblem) alpaqa._alpaqa.float64.Box#
property m#

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

property n#

Number of decision variables, dimension of \(x\)

property param#

Parameter vector \(p\) of the problem

provides_eval_grad_L(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_grad_gi(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_grad_ψ(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_hess_L(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_hess_L_prod(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_hess_ψ(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_hess_ψ_prod(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_jac_g(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_ψ(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
provides_get_box_C(self: alpaqa._alpaqa.float64.CasADiProblem) bool#
class alpaqa.ControlProblem#

C++ documentation: alpaqa::TypeErasedControlProblem

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.ControlProblem, other: alpaqa._alpaqa.float64.ControlProblem) -> None

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.ControlProblem, problem: alpaqa._alpaqa.float64.CasADiControlProblem) -> None

Explicit conversion

class alpaqa.ControlProblemWithCounters#
__init__(*args, **kwargs)#
property evaluations#
property problem#
class alpaqa.DLProblem#

C++ documentation: alpaqa::dl::DLProblem

See alpaqa.Problem for the full documentation.

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.DLProblem, so_filename: str, *args, function_name: str = ‘register_alpaqa_problem’, user_param_str: bool = False, **kwargs) -> None

Load a problem from the given shared library file. By default, extra arguments are passed to the problem as a void pointer to a std::any which contains a std::tuple<pybind11::args, pybind11::kwargs>. If the keyword argument user_param_str=True is used, the args is converted to a list of strings, and passed as a void pointer to a std::any containing a std::span<std::string_view>.

  1. __init__(self: alpaqa._alpaqa.float64.DLProblem, other: alpaqa._alpaqa.float64.DLProblem) -> None

Create a copy

call_extra_func(self: alpaqa._alpaqa.float64.DLProblem, name: str, *args, **kwargs) object#

Call the given extra member function registered by the problem, with the signature pybind11::object(pybind11::args, pybind11::kwargs).

check(self: alpaqa._alpaqa.float64.DLProblem) None#
eval_f(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]]) float#
eval_f_g(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], g: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) float#
eval_f_grad_f(*args, **kwargs)#

Overloaded function.

  1. eval_f_grad_f(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_f_grad_f(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> tuple

eval_g(*args, **kwargs)#

Overloaded function.

  1. eval_g(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], gx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_g(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_L(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_L: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_f(*args, **kwargs)#

Overloaded function.

  1. eval_grad_f(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_f(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_f_grad_g_prod(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_f: numpy.ndarray[numpy.float64[m, 1], flags.writeable], grad_gxy: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_g_prod(*args, **kwargs)#

Overloaded function.

  1. eval_grad_g_prod(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_gxy: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_g_prod(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_gi(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], i: int, grad_gi: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_grad_ψ(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_m: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_ψ(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_hess_L(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], scale: float = 1.0) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Hessian of the Lagrangian and its symmetry.

eval_hess_L_prod(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], scale: float, v: numpy.ndarray[numpy.float64[m, 1]], Hv: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_hess_ψ(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], scale: float = 1.0) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Hessian of the augmented Lagrangian and its symmetry.

eval_hess_ψ_prod(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], scale: float, v: numpy.ndarray[numpy.float64[m, 1]], Hv: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_inactive_indices_res_lna(*args, **kwargs)#

Overloaded function.

  1. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.DLProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], J: numpy.ndarray[numpy.int64[m, 1], flags.writeable]) -> int

  2. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.DLProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.int64[m, 1]]

eval_jac_g(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]]) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Jacobian of the constraints and its symmetry.

eval_proj_diff_g(*args, **kwargs)#

Overloaded function.

  1. eval_proj_diff_g(self: alpaqa._alpaqa.float64.DLProblem, z: numpy.ndarray[numpy.float64[m, 1]], e: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_proj_diff_g(self: alpaqa._alpaqa.float64.DLProblem, z: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_proj_multipliers(self: alpaqa._alpaqa.float64.DLProblem, y: numpy.ndarray[numpy.float64[m, 1], flags.writeable], M: float) None#
eval_prox_grad_step(*args, **kwargs)#

Overloaded function.

  1. eval_prox_grad_step(self: alpaqa._alpaqa.float64.DLProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], x_hat: numpy.ndarray[numpy.float64[m, 1], flags.writeable], p: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_prox_grad_step(self: alpaqa._alpaqa.float64.DLProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], float]

eval_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_ψ(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], ŷ: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_ψ(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[float, numpy.ndarray[numpy.float64[m, 1]]]

eval_ψ_grad_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_m: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.DLProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[float, numpy.ndarray[numpy.float64[m, 1]]]

get_box_C(self: alpaqa._alpaqa.float64.DLProblem) alpaqa._alpaqa.float64.Box#
get_box_D(self: alpaqa._alpaqa.float64.DLProblem) alpaqa._alpaqa.float64.Box#
property m#

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

property n#

Number of decision variables, dimension of \(x\)

provides_eval_f_g(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_f_grad_f(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_grad_L(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_grad_f_grad_g_prod(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_grad_gi(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_grad_ψ(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_hess_L(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_hess_L_prod(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_hess_ψ(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_hess_ψ_prod(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_jac_g(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_ψ(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_get_box_C(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_get_hess_L_sparsity(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_get_hess_ψ_sparsity(self: alpaqa._alpaqa.float64.DLProblem) bool#
provides_get_jac_g_sparsity(self: alpaqa._alpaqa.float64.DLProblem) bool#
class alpaqa.EvalCounter#

C++ documentation: alpaqa::EvalCounter

class EvalTimer#

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

__init__(*args, **kwargs)#
property f#
property f_g#
property f_grad_f#
property g#
property grad_L#
property grad_f#
property grad_f_grad_g_prod#
property grad_g_prod#
property grad_gi#
property grad_ψ#
property hess_L#
property hess_L_prod#
property hess_ψ#
property hess_ψ_prod#
property inactive_indices_res_lna#
property jac_g#
property proj_diff_g#
property proj_multipliers#
property prox_grad_step#
property ψ#
property ψ_grad_ψ#
__init__(*args, **kwargs)#
property f#
property f_g#
property f_grad_f#
property g#
property grad_L#
property grad_f#
property grad_f_grad_g_prod#
property grad_g_prod#
property grad_gi#
property grad_ψ#
property hess_L#
property hess_L_prod#
property hess_ψ#
property hess_ψ_prod#
property inactive_indices_res_lna#
property jac_g#
property proj_diff_g#
property proj_multipliers#
property prox_grad_step#
property time#
property ψ#
property ψ_grad_ψ#
class alpaqa.FISTAParams#

C++ documentation: alpaqa::FISTAParams

property L_max#
property L_min#
property Lipschitz#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.FISTAParams, params: dict) -> None

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

property max_iter#
property max_no_progress#
property max_time#
property print_interval#
property print_precision#
property quadratic_upperbound_tolerance_factor#
property stop_crit#
to_dict(self: alpaqa._alpaqa.float64.FISTAParams) dict#
class alpaqa.FISTAProgressInfo#

Data passed to the FISTA progress callback.

C++ documentation: alpaqa::FISTAProgressInfo

property L#

Estimate of Lipschitz constant of objective \(L\)

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

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

property grad_ψ#

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

property grad_ψ_hat#

Gradient of objective at x̂ \(\nabla\psi(\hat x)\)

property k#

Iteration

property norm_sq_p#

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

property p#

Projected gradient step \(p\)

property params#

Solver parameters

property problem#

Problem being solved

property status#

Current solver status

property t#

Acceleration parameter \(t\)

property x#

Decision variable \(x\)

property x_hat#

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

property y#

Lagrange multipliers \(y\)

property y_hat#

Candidate updated multipliers at x̂ \(\hat y(\hat x)\)

property Σ#

Penalty factor \(\Sigma\)

property γ#

Step size \(\gamma\)

property ε#

Tolerance reached \(\varepsilon_k\)

property φγ#

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

property ψ#

Objective value \(\psi(x)\)

property ψ_hat#

Objective at x̂ \(\psi(\hat x)\)

class alpaqa.FISTASolver#

C++ documentation: alpaqa::FISTASolver

__call__(self: alpaqa._alpaqa.float64.FISTASolver, problem: alpaqa._alpaqa.float64.Problem, opts: alpaqa._alpaqa.float64.InnerSolveOptions = {}, x: numpy.ndarray[numpy.float64[m, 1]] | None = None, y: numpy.ndarray[numpy.float64[m, 1]] | None = None, Σ: numpy.ndarray[numpy.float64[m, 1]] | None = None, *, asynchronous: bool = True, suppress_interrupt: bool = False) tuple#

Solve.

Parameters:
  • problem – Problem to solve

  • opts – Options

  • u – Initial guess

  • y – Lagrange multipliers

  • Σ – Penalty factors

  • asynchronous – Release the GIL and run the solver on a separate thread

  • suppress_interrupt – If the solver is interrupted by a KeyboardInterrupt, don’t propagate this exception back to the Python interpreter, but stop the solver early, and return a solution with the status set to alpaqa.SolverStatus.Interrupted.

Returns:

  • Solution \(u\)

  • Updated Lagrange multipliers (only if parameter y was not None)

  • Constraint violation (only if parameter y was not None)

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.FISTASolver, other: alpaqa._alpaqa.float64.FISTASolver) -> None

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.FISTASolver, fista_params: Union[alpaqa._alpaqa.float64.FISTAParams, dict] = {}) -> None

Create a FISTA solver using structured L-BFGS directions.

property name#
set_progress_callback(self: alpaqa._alpaqa.float64.FISTASolver, callback: Callable[[alpaqa._alpaqa.float64.FISTAProgressInfo], None]) alpaqa._alpaqa.float64.FISTASolver#

Specify a callable that is invoked with some intermediate results on each iteration of the algorithm.

stop(self: alpaqa._alpaqa.float64.FISTASolver) None#
class alpaqa.InnerOCPSolver#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.InnerOCPSolver, other: alpaqa._alpaqa.float64.InnerOCPSolver) -> None

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.InnerOCPSolver, inner_solver: alpaqa._alpaqa.float64.PANOCOCPSolver) -> None

Explicit conversion.

property name#
stop(self: alpaqa._alpaqa.float64.InnerOCPSolver) None#
class alpaqa.InnerSolveOptions#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.InnerSolveOptions, params: dict) -> None

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

property always_overwrite_results#
property max_time#
to_dict(self: alpaqa._alpaqa.float64.InnerSolveOptions) dict#
property tolerance#
class alpaqa.InnerSolver#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.InnerSolver, other: alpaqa._alpaqa.float64.InnerSolver) -> None

Create a copy

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

Explicit conversion.

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

Explicit conversion.

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

Explicit conversion.

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

Explicit conversion.

property name#
stop(self: alpaqa._alpaqa.float64.InnerSolver) None#
class alpaqa.LBFGS#

C++ documentation alpaqa::LBFGS

Negative = <Sign.Negative: 1>#
class Params#

C++ documentation alpaqa::LBFGSParams

class CBFGS#

C++ documentation alpaqa::CBFGSParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.LBFGS.Params.CBFGS, params: dict) -> None

  2. __init__(self: alpaqa._alpaqa.float64.LBFGS.Params.CBFGS, **kwargs) -> None

to_dict(self: alpaqa._alpaqa.float64.LBFGS.Params.CBFGS) dict#
property α#
property ϵ#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.LBFGS.Params, params: dict) -> None

  2. __init__(self: alpaqa._alpaqa.float64.LBFGS.Params, **kwargs) -> None

property cbfgs#
property force_pos_def#
property memory#
property min_abs_s#
property min_div_fac#
property stepsize#
to_dict(self: alpaqa._alpaqa.float64.LBFGS.Params) dict#
Positive = <Sign.Positive: 0>#
class Sign#

C++ documentation alpaqa::LBFGS::Sign

Members:

Positive

Negative

Negative = <Sign.Negative: 1>#
Positive = <Sign.Positive: 0>#
__init__(self: alpaqa._alpaqa.float64.LBFGS.Sign, value: int) None#
property name#
property value#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.LBFGS, params: Union[alpaqa._alpaqa.float64.LBFGS.Params, dict]) -> None

  2. __init__(self: alpaqa._alpaqa.float64.LBFGS, params: Union[alpaqa._alpaqa.float64.LBFGS.Params, dict], n: int) -> None

apply(self: alpaqa._alpaqa.float64.LBFGS, q: numpy.ndarray[numpy.float64[m, 1], flags.writeable], γ: float) bool#
apply_masked(self: alpaqa._alpaqa.float64.LBFGS, q: numpy.ndarray[numpy.float64[m, 1], flags.writeable], γ: float, J: List[int]) bool#
current_history(self: alpaqa._alpaqa.float64.LBFGS) int#
property n#
property params#
reset(self: alpaqa._alpaqa.float64.LBFGS) None#
resize(self: alpaqa._alpaqa.float64.LBFGS, n: int) None#
s(self: alpaqa._alpaqa.float64.LBFGS, i: int) numpy.ndarray[numpy.float64[m, 1], flags.writeable]#
scale_y(self: alpaqa._alpaqa.float64.LBFGS, factor: float) None#
update(self: alpaqa._alpaqa.float64.LBFGS, xk: numpy.ndarray[numpy.float64[m, 1]], xkp1: numpy.ndarray[numpy.float64[m, 1]], pk: numpy.ndarray[numpy.float64[m, 1]], pkp1: numpy.ndarray[numpy.float64[m, 1]], sign: alpaqa._alpaqa.float64.LBFGS.Sign = <Sign.Positive: 0>, forced: bool = False) bool#
update_sy(self: alpaqa._alpaqa.float64.LBFGS, sk: numpy.ndarray[numpy.float64[m, 1]], yk: numpy.ndarray[numpy.float64[m, 1]], pkp1Tpkp1: float, forced: bool = False) bool#
static update_valid(params: alpaqa._alpaqa.float64.LBFGS.Params, yTs: float, sTs: float, pTp: float) bool#
y(self: alpaqa._alpaqa.float64.LBFGS, i: int) numpy.ndarray[numpy.float64[m, 1], flags.writeable]#
α(self: alpaqa._alpaqa.float64.LBFGS, i: int) float#
ρ(self: alpaqa._alpaqa.float64.LBFGS, i: int) float#
class alpaqa.LBFGSDirection#

C++ documentation: alpaqa::LBFGSDirection

class DirectionParams#

C++ documentation: alpaqa::LBFGSDirection::DirectionParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.LBFGSDirection.DirectionParams, params: dict) -> None

  2. __init__(self: alpaqa._alpaqa.float64.LBFGSDirection.DirectionParams, **kwargs) -> None

property rescale_on_step_size_changes#
to_dict(self: alpaqa._alpaqa.float64.LBFGSDirection.DirectionParams) dict#
__init__(self: alpaqa._alpaqa.float64.LBFGSDirection, lbfgs_params: alpaqa._alpaqa.float64.LBFGS.Params | dict = {}, direction_params: alpaqa._alpaqa.float64.LBFGSDirection.DirectionParams | dict = {}) None#
property params#
class alpaqa.LBFGSStepsize#

C++ documentation: alpaqa::LBFGSStepSize

Members:

BasedOnExternalStepSize

BasedOnCurvature

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

C++ documentation: alpaqa::LipschitzEstimateParams

property L_0#
property Lγ_factor#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.LipschitzEstimateParams, params: dict) -> None

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

to_dict(self: alpaqa._alpaqa.float64.LipschitzEstimateParams) dict#
property δ#
property ε#
class alpaqa.MinimizationProblemDescription(objective_expr: SX | MX, variable: SX | MX, constraints_expr: SX | MX | None = None, penalty_constraints_expr: SX | MX | None = None, parameter: SX | MX | None = None, parameter_value: ndarray | None = None, regularizer: float | ndarray | None = None, bounds: Tuple[ndarray, ndarray] | None = None, constraints_bounds: Tuple[ndarray, ndarray] | None = None, penalty_constraints_bounds: Tuple[ndarray, ndarray] | None = None)[source]#

High-level description of a minimization problem.

objective_expr: SX | MX#
variable: SX | MX#
constraints_expr: SX | MX | None = None#
penalty_constraints_expr: SX | MX | None = None#
parameter: SX | MX | None = None#
parameter_value: ndarray | None = None#
regularizer: float | ndarray | None = None#
bounds: Tuple[ndarray, ndarray] | None = None#
constraints_bounds: Tuple[ndarray, ndarray] | None = None#
penalty_constraints_bounds: Tuple[ndarray, ndarray] | None = None#
subject_to_box(C: Tuple[ndarray, ndarray])[source]#

Add box constraints \(x \in C\) on the problem variables.

subject_to(g: SX | MX, D: ndarray | Tuple[ndarray, ndarray] | None = None)[source]#

Add general constraints \(g(x) \in D\), handled using an augmented Lagrangian method.

subject_to_penalty(g: SX | MX, D: ndarray | Tuple[ndarray, ndarray] | None = None)[source]#

Add general constraints \(g(x) \in D\), handled using a quadratic penalty method.

with_l1_regularizer(λ: float | ndarray)[source]#

Add an \(\ell_1\)-regularization term \(\|\lambda x\|_1\) to the objective.

with_param(p: SX | MX, value: ndarray = None)[source]#

Make the problem depend on a symbolic parameter, with an optional default value. The value can be changed after the problem has been loaded, as wel as in between solves.

with_param_value(value: ndarray)[source]#

Explicitly change the parameter value for the parameter added by with_param().

compile(**kwargs) CasADiProblem[source]#

Generate, compile and load the problem.

A C compiler is required (e.g. GCC or Clang on Linux, Xcode on macOS, or Visual Studio on Windows). If no compiler is available, you could use the alpaqa.MinimizationProblemDescription.build() method instead.

Parameters:

**kwargs – Arguments passed to alpaqa.casadi_loader.generate_and_compile_casadi_problem().

Keyword Arguments:
  • second_order: str – Whether to generate functions for evaluating second-order derivatives:

    • 'no': only first-order derivatives (default).

    • 'full': Hessians and Hessian-vector products of the Lagrangian and the augmented Lagrangian.

    • 'prod': Hessian-vector products of the Lagrangian and the augmented Lagrangian.

    • 'L': Hessian of the Lagrangian.

    • 'L_prod': Hessian-vector product of the Lagrangian.

    • 'psi': Hessian of the augmented Lagrangian.

    • 'psi_prod': Hessian-vector product of the augmented Lagrangian.

  • name: str – Optional string description of the problem (used for filenames).

  • sym: Callable – Symbolic variable constructor, usually either cs.SX.sym (default) or cs.MX.sym. SX expands the expressions and generally results in better run-time performance, while MX usually has faster compile times.

build(**kwargs) CasADiProblem[source]#

Finalize the problem formulation and return a problem type that can be used by the solvers.

This method is usually not recommended: the alpaqa.MinimizationProblemDescription.compile() method is preferred because it pre-compiles the problem for better performance.

Keyword Arguments:
  • second_order: str – Whether to generate functions for evaluating second-order derivatives:

    • 'no': only first-order derivatives (default).

    • 'full': Hessians and Hessian-vector products of the Lagrangian and the augmented Lagrangian.

    • 'prod': Hessian-vector products of the Lagrangian and the augmented Lagrangian.

    • 'L': Hessian of the Lagrangian.

    • 'L_prod': Hessian-vector product of the Lagrangian.

    • 'psi': Hessian of the augmented Lagrangian.

    • 'psi_prod': Hessian-vector product of the augmented Lagrangian.

  • sym: Callable – Symbolic variable constructor, usually either cs.SX.sym (default) or cs.MX.sym. SX expands the expressions and generally results in better run-time performance.

__init__(objective_expr: SX | MX, variable: SX | MX, constraints_expr: SX | MX | None = None, penalty_constraints_expr: SX | MX | None = None, parameter: SX | MX | None = None, parameter_value: ndarray | None = None, regularizer: float | ndarray | None = None, bounds: Tuple[ndarray, ndarray] | None = None, constraints_bounds: Tuple[ndarray, ndarray] | None = None, penalty_constraints_bounds: Tuple[ndarray, ndarray] | None = None) None#
class alpaqa.NewtonTRDirection#

C++ documentation: alpaqa::NewtonTRDirection

__init__(self: alpaqa._alpaqa.float64.NewtonTRDirection, accelerator_params: alpaqa._alpaqa.float64.SteihaugCGParams | dict = {}, direction_params: alpaqa._alpaqa.float64.NewtonTRDirectionParams | dict = {}) None#
property params#
class alpaqa.NewtonTRDirectionParams#

C++ documentation: alpaqa::NewtonTRDirectionParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.NewtonTRDirectionParams, params: dict) -> None

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

property finite_diff#
property finite_diff_stepsize#
property hessian_vec_factor#
to_dict(self: alpaqa._alpaqa.float64.NewtonTRDirectionParams) dict#
class alpaqa.NoopDirection#

C++ documentation: alpaqa::NoopDirection

AcceleratorParams = None#
DirectionParams = None#
__init__(self: alpaqa._alpaqa.float64.NoopDirection) None#
params = None#
class alpaqa.OCPEvalCounter#

C++ documentation: alpaqa::OCPEvalCounter

class OCPEvalTimer#

C++ documentation: alpaqa::OCPEvalCounter::OCPEvalTimer

__init__(*args, **kwargs)#
property add_Q#
property add_Q_N#
property add_R_masked#
property add_R_prod_masked#
property add_S_masked#
property add_S_prod_masked#
property add_gn_hess_constr#
property add_gn_hess_constr_N#
property constr#
property constr_N#
property f#
property grad_constr_prod#
property grad_constr_prod_N#
property grad_f_prod#
property h#
property h_N#
property jac_f#
property l#
property l_N#
property q_N#
property qr#
__init__(*args, **kwargs)#
property add_Q#
property add_Q_N#
property add_R_masked#
property add_R_prod_masked#
property add_S_masked#
property add_S_prod_masked#
property add_gn_hess_constr#
property add_gn_hess_constr_N#
property constr#
property constr_N#
property f#
property grad_constr_prod#
property grad_constr_prod_N#
property grad_f_prod#
property h#
property h_N#
property jac_f#
property l#
property l_N#
property q_N#
property qr#
property time#
class alpaqa.OCPEvaluator#
Qk(self: alpaqa._alpaqa.float64.OCPEvaluator, k: int, u: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]] | None = None, μ: numpy.ndarray[numpy.float64[m, 1]] | None = None) numpy.ndarray[numpy.float64[m, n]]#
Rk(self: alpaqa._alpaqa.float64.OCPEvaluator, k: int, u: numpy.ndarray[numpy.float64[m, 1]], mask: numpy.ndarray[numpy.int64[m, 1]]) numpy.ndarray[numpy.float64[m, n]]#
Sk(self: alpaqa._alpaqa.float64.OCPEvaluator, k: int, u: numpy.ndarray[numpy.float64[m, 1]], mask: numpy.ndarray[numpy.int64[m, 1]]) numpy.ndarray[numpy.float64[m, n]]#
__init__(self: alpaqa._alpaqa.float64.OCPEvaluator, problem: alpaqa._alpaqa.float64.ControlProblem) None#
forward_backward(self: alpaqa._alpaqa.float64.OCPEvaluator, u: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]] | None = None, μ: numpy.ndarray[numpy.float64[m, 1]] | None = None) Tuple[float, numpy.ndarray[numpy.float64[m, 1]]]#
Returns:

  • Cost

  • Gradient

lqr_factor_solve(self: alpaqa._alpaqa.float64.OCPEvaluator, u: numpy.ndarray[numpy.float64[m, 1]], γ: float, y: numpy.ndarray[numpy.float64[m, 1]] | None = None, μ: numpy.ndarray[numpy.float64[m, 1]] | None = None) numpy.ndarray[numpy.float64[m, 1]]#
lqr_factor_solve_QRS(self: alpaqa._alpaqa.float64.OCPEvaluator, u: numpy.ndarray[numpy.float64[m, 1]], γ: float, Q: list, R: list, S: list, y: numpy.ndarray[numpy.float64[m, 1]] | None = None, μ: numpy.ndarray[numpy.float64[m, 1]] | None = None, masked: bool = True) numpy.ndarray[numpy.float64[m, 1]]#
class alpaqa.PANOCDirection#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCDirection, direction: alpaqa._alpaqa.float64.NoopDirection) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCDirection, direction: alpaqa._alpaqa.float64.LBFGSDirection) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCDirection, direction: alpaqa._alpaqa.float64.StructuredLBFGSDirection) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCDirection, direction: alpaqa._alpaqa.float64.StructuredNewtonDirection) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCDirection, direction: alpaqa._alpaqa.float64.AndersonDirection) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCDirection, direction: object) -> None

Explicit conversion from a custom Python class.

property params#
class alpaqa.PANOCOCPParams#

C++ documentation: alpaqa::PANOCOCPParams

property L_max#
property L_max_inc#
property L_min#
property Lipschitz#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCOCPParams, params: dict) -> None

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

property disable_acceleration#
property gn_interval#
property gn_sticky#
property lbfgs_params#
property linesearch_strictness_factor#
property linesearch_tolerance_factor#
property lqr_factor_cholesky#
property max_iter#
property max_no_progress#
property max_time#
property min_linesearch_coefficient#
property print_interval#
property print_precision#
property quadratic_upperbound_tolerance_factor#
property reset_lbfgs_on_gn_step#
property stop_crit#
to_dict(self: alpaqa._alpaqa.float64.PANOCOCPParams) dict#
class alpaqa.PANOCOCPProgressInfo#

Data passed to the PANOC progress callback.

C++ documentation: alpaqa::PANOCOCPProgressInfo

property L#

Estimate of Lipschitz constant of objective \(L\)

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

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

property gn#

Was \(q\) a Gauss-Newton or L-BFGS step?

property grad_ψ#

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

property k#

Iteration

property lqr_min_rcond#

Minimum reciprocal condition number encountered in LQR factorization

property nJ#

Number of inactive constraints \(\#\mathcal J\)

property norm_sq_p#

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

property p#

Projected gradient step \(p\)

property params#

Solver parameters

property problem#

Problem being solved

property q#

Previous accelerated step \(q\)

property status#

Current solver status

property u#

Inputs

property u_hat#

Inputs after projected gradient step

property x#

States

property x_hat#

States after projected gradient step

property xu#

States \(x\) and inputs \(u\)

property xu_hat#

Variables after projected gradient step \(\hat u\)

property γ#

Step size \(\gamma\)

property ε#

Tolerance reached \(\varepsilon_k\)

property τ#

Line search parameter \(\tau\)

property φγ#

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

property ψ#

Objective value \(\psi(u)\)

property ψ_hat#

Objective at x̂ \(\psi(\hat u)\)

class alpaqa.PANOCOCPSolver#

C++ documentation: alpaqa::PANOCOCPSolver

__call__(self: alpaqa._alpaqa.float64.PANOCOCPSolver, problem: alpaqa._alpaqa.float64.ControlProblem, opts: alpaqa._alpaqa.float64.InnerSolveOptions = {}, x: numpy.ndarray[numpy.float64[m, 1]] | None = None, y: numpy.ndarray[numpy.float64[m, 1]] | None = None, Σ: numpy.ndarray[numpy.float64[m, 1]] | None = None, *, asynchronous: bool = True, suppress_interrupt: bool = False) tuple#

Solve.

Parameters:
  • problem – Problem to solve

  • opts – Options

  • u – Initial guess

  • y – Lagrange multipliers

  • Σ – Penalty factors

  • asynchronous – Release the GIL and run the solver on a separate thread

  • suppress_interrupt – If the solver is interrupted by a KeyboardInterrupt, don’t propagate this exception back to the Python interpreter, but stop the solver early, and return a solution with the status set to alpaqa.SolverStatus.Interrupted.

Returns:

  • Solution \(u\)

  • Updated Lagrange multipliers (only if parameter y was not None)

  • Constraint violation (only if parameter y was not None)

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCOCPSolver, other: alpaqa._alpaqa.float64.PANOCOCPSolver) -> None

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.PANOCOCPSolver, panoc_params: Union[alpaqa._alpaqa.float64.PANOCOCPParams, dict]) -> None

Create a PANOC solver.

property name#
set_progress_callback(self: alpaqa._alpaqa.float64.PANOCOCPSolver, callback: Callable[[alpaqa._alpaqa.float64.PANOCOCPProgressInfo], None]) alpaqa._alpaqa.float64.PANOCOCPSolver#

Specify a callable that is invoked with some intermediate results on each iteration of the algorithm.

stop(self: alpaqa._alpaqa.float64.PANOCOCPSolver) None#
class alpaqa.PANOCParams#

C++ documentation: alpaqa::PANOCParams

property L_max#
property L_min#
property Lipschitz#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.PANOCParams, params: dict) -> None

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

property eager_gradient_eval#
property force_linesearch#
property linesearch_strictness_factor#
property linesearch_tolerance_factor#
property max_iter#
property max_no_progress#
property max_time#
property min_linesearch_coefficient#
property print_interval#
property print_precision#
property quadratic_upperbound_tolerance_factor#
property recompute_last_prox_step_after_stepsize_change#
property stop_crit#
to_dict(self: alpaqa._alpaqa.float64.PANOCParams) dict#
property update_direction_in_candidate#
class alpaqa.PANOCProgressInfo#

Data passed to the PANOC progress callback.

C++ documentation: alpaqa::PANOCProgressInfo

property L#

Estimate of Lipschitz constant of objective \(L\)

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

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

property grad_ψ#

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

property grad_ψ_hat#

Gradient of objective at x̂ \(\nabla\psi(\hat x)\)

property k#

Iteration

property norm_sq_p#

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

property p#

Projected gradient step \(p\)

property params#

Solver parameters

property problem#

Problem being solved

property q#

Previous quasi-Newton step \(\nabla\psi(\hat x)\)

property status#

Current solver status

property x#

Decision variable \(x\)

property x_hat#

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

property y#

Lagrange multipliers \(y\)

property y_hat#

Candidate updated multipliers at x̂ \(\hat y(\hat x)\)

property Σ#

Penalty factor \(\Sigma\)

property γ#

Step size \(\gamma\)

property ε#

Tolerance reached \(\varepsilon_k\)

property τ#

Previous line search parameter \(\tau\)

property φγ#

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

property ψ#

Objective value \(\psi(x)\)

property ψ_hat#

Objective at x̂ \(\psi(\hat x)\)

class alpaqa.PANOCSolver#

C++ documentation: alpaqa::PANOCSolver

__call__(self: alpaqa._alpaqa.float64.PANOCSolver, problem: alpaqa._alpaqa.float64.Problem, opts: alpaqa._alpaqa.float64.InnerSolveOptions = {}, x: numpy.ndarray[numpy.float64[m, 1]] | None = None, y: numpy.ndarray[numpy.float64[m, 1]] | None = None, Σ: numpy.ndarray[numpy.float64[m, 1]] | None = None, *, asynchronous: bool = True, suppress_interrupt: bool = False) tuple#

Solve.

Parameters:
  • problem – Problem to solve

  • opts – Options

  • u – Initial guess

  • y – Lagrange multipliers

  • Σ – Penalty factors

  • asynchronous – Release the GIL and run the solver on a separate thread

  • suppress_interrupt – If the solver is interrupted by a KeyboardInterrupt, don’t propagate this exception back to the Python interpreter, but stop the solver early, and return a solution with the status set to alpaqa.SolverStatus.Interrupted.

Returns:

  • Solution \(u\)

  • Updated Lagrange multipliers (only if parameter y was not None)

  • Constraint violation (only if parameter y was not None)

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

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

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.PANOCSolver, panoc_params: Union[alpaqa._alpaqa.float64.PANOCParams, dict] = {}, lbfgs_params: Union[alpaqa._alpaqa.float64.LBFGS.Params, dict] = {}, direction_params: Union[alpaqa._alpaqa.float64.StructuredLBFGSDirection.DirectionParams, dict] = {}) -> None

Create a PANOC solver using structured L-BFGS directions.

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

Create a PANOC solver using a custom direction.

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

Specify a callable that is invoked with some intermediate results on each iteration of the algorithm.

stop(self: alpaqa._alpaqa.float64.PANOCSolver) None#
class alpaqa.PANOCStopCrit#

C++ documentation: alpaqa::PANOCStopCrit

Members:

ApproxKKT

ApproxKKT2

ProjGradNorm

ProjGradNorm2

ProjGradUnitNorm

ProjGradUnitNorm2

FPRNorm

FPRNorm2

Ipopt

LBFGSBpp

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

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.PANTRDirection, direction: alpaqa._alpaqa.float64.NewtonTRDirection) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.PANTRDirection, direction: object) -> None

Explicit conversion from a custom Python class.

property params#
class alpaqa.PANTRParams#

C++ documentation: alpaqa::PANTRParams

property L_max#
property L_min#
property Lipschitz#
property TR_tolerance_factor#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.PANTRParams, params: dict) -> None

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

property compute_ratio_using_new_stepsize#
property disable_acceleration#
property initial_radius#
property max_iter#
property max_no_progress#
property max_time#
property min_radius#
property print_interval#
property print_precision#
property quadratic_upperbound_tolerance_factor#
property radius_factor_acceptable#
property radius_factor_good#
property radius_factor_rejected#
property ratio_approx_fbe_quadratic_model#
property ratio_threshold_acceptable#
property ratio_threshold_good#
property recompute_last_prox_step_after_direction_reset#
property stop_crit#
to_dict(self: alpaqa._alpaqa.float64.PANTRParams) dict#
property update_direction_on_prox_step#
class alpaqa.PANTRProgressInfo#

Data passed to the PANTR progress callback.

C++ documentation: alpaqa::PANTRProgressInfo

property L#

Estimate of Lipschitz constant of objective \(L\)

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

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

property grad_ψ#

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

property grad_ψ_hat#

Gradient of objective at x̂ \(\nabla\psi(\hat x)\)

property k#

Iteration

property norm_sq_p#

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

property p#

Projected gradient step \(p\)

property params#

Solver parameters

property problem#

Problem being solved

property q#

Previous quasi-Newton step \(\nabla\psi(\hat x)\)

property status#

Current solver status

property x#

Decision variable \(x\)

property x_hat#

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

property y#

Lagrange multipliers \(y\)

property y_hat#

Candidate updated multipliers at x̂ \(\hat y(\hat x)\)

property Δ#

Previous trust radius \(\Delta\)

property Σ#

Penalty factor \(\Sigma\)

property γ#

Step size \(\gamma\)

property ε#

Tolerance reached \(\varepsilon_k\)

property ρ#

Previous decrease ratio \(\rho\)

property τ#

Acceptance (1) or rejection (0) of previous accelerated step \(\tau\)

property φγ#

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

property ψ#

Objective value \(\psi(x)\)

property ψ_hat#

Objective at x̂ \(\psi(\hat x)\)

class alpaqa.PANTRSolver#

C++ documentation: alpaqa::PANTRSolver

__call__(self: alpaqa._alpaqa.float64.PANTRSolver, problem: alpaqa._alpaqa.float64.Problem, opts: alpaqa._alpaqa.float64.InnerSolveOptions = {}, x: numpy.ndarray[numpy.float64[m, 1]] | None = None, y: numpy.ndarray[numpy.float64[m, 1]] | None = None, Σ: numpy.ndarray[numpy.float64[m, 1]] | None = None, *, asynchronous: bool = True, suppress_interrupt: bool = False) tuple#

Solve.

Parameters:
  • problem – Problem to solve

  • opts – Options

  • u – Initial guess

  • y – Lagrange multipliers

  • Σ – Penalty factors

  • asynchronous – Release the GIL and run the solver on a separate thread

  • suppress_interrupt – If the solver is interrupted by a KeyboardInterrupt, don’t propagate this exception back to the Python interpreter, but stop the solver early, and return a solution with the status set to alpaqa.SolverStatus.Interrupted.

Returns:

  • Solution \(u\)

  • Updated Lagrange multipliers (only if parameter y was not None)

  • Constraint violation (only if parameter y was not None)

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.PANTRSolver, other: alpaqa._alpaqa.float64.PANTRSolver) -> None

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.PANTRSolver, pantr_params: Union[alpaqa._alpaqa.float64.PANTRParams, dict] = {}, steihaug_params: Union[alpaqa._alpaqa.float64.SteihaugCGParams, dict] = {}, direction_params: Union[alpaqa._alpaqa.float64.NewtonTRDirectionParams, dict] = {}) -> None

Create a PANTR solver using a structured Newton CG subproblem solver.

  1. __init__(self: alpaqa._alpaqa.float64.PANTRSolver, pantr_params: Union[alpaqa._alpaqa.float64.PANTRParams, dict], direction: alpaqa._alpaqa.float64.PANTRDirection) -> None

Create a PANTR solver using a custom direction.

property direction#
property name#
set_progress_callback(self: alpaqa._alpaqa.float64.PANTRSolver, callback: Callable[[alpaqa._alpaqa.float64.PANTRProgressInfo], None]) alpaqa._alpaqa.float64.PANTRSolver#

Specify a callable that is invoked with some intermediate results on each iteration of the algorithm.

stop(self: alpaqa._alpaqa.float64.PANTRSolver) None#
class alpaqa.Problem#

C++ documentation: alpaqa::TypeErasedProblem

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.Problem, other: alpaqa._alpaqa.float64.Problem) -> None

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.Problem, problem: alpaqa._alpaqa.float64.CasADiProblem) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.Problem, problem: alpaqa._alpaqa.float64.CUTEstProblem) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.Problem, problem: alpaqa._alpaqa.float64.DLProblem) -> None

Explicit conversion.

  1. __init__(self: alpaqa._alpaqa.float64.Problem, problem: object) -> None

Explicit conversion from a custom Python class.

check(self: alpaqa._alpaqa.float64.Problem) None#
eval_f(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]]) float#
eval_f_g(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], g: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) float#
eval_f_grad_f(*args, **kwargs)#

Overloaded function.

  1. eval_f_grad_f(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_f_grad_f(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]]) -> tuple

eval_g(*args, **kwargs)#

Overloaded function.

  1. eval_g(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], gx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_g(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_L(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_L: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_f(*args, **kwargs)#

Overloaded function.

  1. eval_grad_f(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_f(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_f_grad_g_prod(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_f: numpy.ndarray[numpy.float64[m, 1], flags.writeable], grad_gxy: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_g_prod(*args, **kwargs)#

Overloaded function.

  1. eval_grad_g_prod(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_gxy: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_g_prod(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_grad_gi(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], i: int, grad_gi: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_grad_ψ(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_m: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_grad_ψ(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_hess_L(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], scale: float = 1.0) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Hessian of the Lagrangian and its symmetry.

eval_hess_L_prod(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], scale: float, v: numpy.ndarray[numpy.float64[m, 1]], Hv: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_hess_ψ(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], scale: float = 1.0) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Hessian of the augmented Lagrangian and its symmetry.

eval_hess_ψ_prod(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], scale: float, v: numpy.ndarray[numpy.float64[m, 1]], Hv: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_inactive_indices_res_lna(*args, **kwargs)#

Overloaded function.

  1. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.Problem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], J: numpy.ndarray[numpy.int64[m, 1], flags.writeable]) -> int

  2. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.Problem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.int64[m, 1]]

eval_jac_g(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]]) Tuple[object, alpaqa._alpaqa.Symmetry]#

Returns the Jacobian of the constraints and its symmetry.

eval_proj_diff_g(*args, **kwargs)#

Overloaded function.

  1. eval_proj_diff_g(self: alpaqa._alpaqa.float64.Problem, z: numpy.ndarray[numpy.float64[m, 1]], e: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_proj_diff_g(self: alpaqa._alpaqa.float64.Problem, z: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_proj_multipliers(self: alpaqa._alpaqa.float64.Problem, y: numpy.ndarray[numpy.float64[m, 1], flags.writeable], M: float) None#
eval_prox_grad_step(*args, **kwargs)#

Overloaded function.

  1. eval_prox_grad_step(self: alpaqa._alpaqa.float64.Problem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], x_hat: numpy.ndarray[numpy.float64[m, 1], flags.writeable], p: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_prox_grad_step(self: alpaqa._alpaqa.float64.Problem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], float]

eval_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_ψ(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], ŷ: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_ψ(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[float, numpy.ndarray[numpy.float64[m, 1]]]

eval_ψ_grad_ψ(*args, **kwargs)#

Overloaded function.

  1. eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_n: numpy.ndarray[numpy.float64[m, 1], flags.writeable], work_m: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], Σ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[float, numpy.ndarray[numpy.float64[m, 1]]]

get_box_C(self: alpaqa._alpaqa.float64.Problem) alpaqa._alpaqa.float64.Box#
get_box_D(self: alpaqa._alpaqa.float64.Problem) alpaqa._alpaqa.float64.Box#
property m#

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

property n#

Number of decision variables, dimension of \(x\)

provides_check(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_f_g(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_f_grad_f(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_grad_L(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_grad_f_grad_g_prod(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_grad_gi(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_grad_ψ(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_hess_L(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_hess_L_prod(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_hess_ψ(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_hess_ψ_prod(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_jac_g(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_ψ(self: alpaqa._alpaqa.float64.Problem) bool#
provides_eval_ψ_grad_ψ(self: alpaqa._alpaqa.float64.Problem) bool#
provides_get_box_C(self: alpaqa._alpaqa.float64.Problem) bool#
provides_get_box_D(self: alpaqa._alpaqa.float64.Problem) bool#
provides_get_hess_L_sparsity(self: alpaqa._alpaqa.float64.Problem) bool#
provides_get_hess_ψ_sparsity(self: alpaqa._alpaqa.float64.Problem) bool#
provides_get_jac_g_sparsity(self: alpaqa._alpaqa.float64.Problem) bool#
class alpaqa.ProblemWithCounters#
__init__(*args, **kwargs)#
property evaluations#
property problem#
class alpaqa.SolverStatus#

C++ documentation: alpaqa::SolverStatus

Members:

Busy : In progress.

Converged : Converged and reached given tolerance

MaxTime : Maximum allowed execution time exceeded

MaxIter : Maximum number of iterations exceeded

NotFinite : Intermediate results were infinite or NaN

NoProgress : No progress was made in the last iteration

Interrupted : Solver was interrupted by the user

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

C++ documentation: alpaqa::SteihaugCGParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.SteihaugCGParams, params: dict) -> None

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

property max_iter_factor#
to_dict(self: alpaqa._alpaqa.float64.SteihaugCGParams) dict#
property tol_max#
property tol_scale#
property tol_scale_root#
class alpaqa.StructuredLBFGSDirection#

C++ documentation: alpaqa::StructuredLBFGSDirection

class DirectionParams#

C++ documentation: alpaqa::StructuredLBFGSDirection::DirectionParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.StructuredLBFGSDirection.DirectionParams, params: dict) -> None

  2. __init__(self: alpaqa._alpaqa.float64.StructuredLBFGSDirection.DirectionParams, **kwargs) -> None

property full_augmented_hessian#
property hessian_vec_factor#
property hessian_vec_finite_differences#
to_dict(self: alpaqa._alpaqa.float64.StructuredLBFGSDirection.DirectionParams) dict#
__init__(self: alpaqa._alpaqa.float64.StructuredLBFGSDirection, lbfgs_params: alpaqa._alpaqa.float64.LBFGS.Params | dict = {}, direction_params: alpaqa._alpaqa.float64.StructuredLBFGSDirection.DirectionParams | dict = {}) None#
property params#
class alpaqa.StructuredNewtonDirection#

C++ documentation: alpaqa::StructuredNewtonDirection

class DirectionParams#

C++ documentation: alpaqa::StructuredNewtonDirection::DirectionParams

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.StructuredNewtonDirection.DirectionParams, params: dict) -> None

  2. __init__(self: alpaqa._alpaqa.float64.StructuredNewtonDirection.DirectionParams, **kwargs) -> None

property hessian_vec_factor#
to_dict(self: alpaqa._alpaqa.float64.StructuredNewtonDirection.DirectionParams) dict#
__init__(self: alpaqa._alpaqa.float64.StructuredNewtonDirection, direction_params: alpaqa._alpaqa.float64.StructuredNewtonDirection.DirectionParams | dict = {}) None#
property params#
class alpaqa.Symmetry#

C++ documentation: alpaqa::sparsity::Symmetry

Members:

Unsymmetric

Upper

Lower

Lower = <Symmetry.Lower: 2>#
Unsymmetric = <Symmetry.Unsymmetric: 0>#
Upper = <Symmetry.Upper: 1>#
__init__(self: alpaqa._alpaqa.Symmetry, value: int) None#
property name#
property value#
class alpaqa.UnconstrProblem#

C++ documentation: alpaqa::UnconstrProblem

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.UnconstrProblem, other: alpaqa._alpaqa.float64.UnconstrProblem) -> None

Create a copy

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

Parameters:

n – Number of unknowns

eval_g(self: alpaqa._alpaqa.float64.UnconstrProblem, x: numpy.ndarray[numpy.float64[m, 1]], g: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_g_prod(self: alpaqa._alpaqa.float64.UnconstrProblem, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], grad_gxy: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_grad_gi(self: alpaqa._alpaqa.float64.UnconstrProblem, x: numpy.ndarray[numpy.float64[m, 1]], i: int, grad_gi: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_inactive_indices_res_lna(*args, **kwargs)#

Overloaded function.

  1. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.UnconstrProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], J: numpy.ndarray[numpy.int64[m, 1], flags.writeable]) -> int

  2. eval_inactive_indices_res_lna(self: alpaqa._alpaqa.float64.UnconstrProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.int64[m, 1]]

eval_jac_g(self: alpaqa._alpaqa.float64.UnconstrProblem, x: numpy.ndarray[numpy.float64[m, 1]], J_values: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None#
eval_proj_diff_g(*args, **kwargs)#

Overloaded function.

  1. eval_proj_diff_g(self: alpaqa._alpaqa.float64.UnconstrProblem, z: numpy.ndarray[numpy.float64[m, 1]], e: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None

  2. eval_proj_diff_g(self: alpaqa._alpaqa.float64.UnconstrProblem, z: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]

eval_proj_multipliers(self: alpaqa._alpaqa.float64.UnconstrProblem, y: numpy.ndarray[numpy.float64[m, 1], flags.writeable], M: float) None#
eval_prox_grad_step(*args, **kwargs)#

Overloaded function.

  1. eval_prox_grad_step(self: alpaqa._alpaqa.float64.UnconstrProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]], x_hat: numpy.ndarray[numpy.float64[m, 1], flags.writeable], p: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> float

  2. eval_prox_grad_step(self: alpaqa._alpaqa.float64.UnconstrProblem, γ: float, x: numpy.ndarray[numpy.float64[m, 1]], grad_ψ: numpy.ndarray[numpy.float64[m, 1]]) -> Tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], float]

property m#

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

property n#

Number of decision variables, dimension of \(x\)

resize(self: alpaqa._alpaqa.float64.UnconstrProblem, n: int) None#
class alpaqa.ZeroFPRParams#

C++ documentation: alpaqa::ZeroFPRParams

property L_max#
property L_min#
property Lipschitz#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.ZeroFPRParams, params: dict) -> None

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

property force_linesearch#
property linesearch_strictness_factor#
property linesearch_tolerance_factor#
property max_iter#
property max_no_progress#
property max_time#
property min_linesearch_coefficient#
property print_interval#
property print_precision#
property quadratic_upperbound_tolerance_factor#
property recompute_last_prox_step_after_stepsize_change#
property stop_crit#
to_dict(self: alpaqa._alpaqa.float64.ZeroFPRParams) dict#
property update_direction_from_prox_step#
property update_direction_in_candidate#
class alpaqa.ZeroFPRProgressInfo#

Data passed to the ZeroFPR progress callback.

C++ documentation: alpaqa::ZeroFPRProgressInfo

property L#

Estimate of Lipschitz constant of objective \(L\)

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

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

property grad_ψ#

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

property grad_ψ_hat#

Gradient of objective at x̂ \(\nabla\psi(\hat x)\)

property k#

Iteration

property norm_sq_p#

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

property p#

Projected gradient step \(p\)

property params#

Solver parameters

property problem#

Problem being solved

property q#

Previous quasi-Newton step \(\nabla\psi(\hat x)\)

property status#

Current solver status

property x#

Decision variable \(x\)

property x_hat#

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

property y#

Lagrange multipliers \(y\)

property y_hat#

Candidate updated multipliers at x̂ \(\hat y(\hat x)\)

property Σ#

Penalty factor \(\Sigma\)

property γ#

Step size \(\gamma\)

property ε#

Tolerance reached \(\varepsilon_k\)

property τ#

Previous line search parameter \(\tau\)

property φγ#

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

property ψ#

Objective value \(\psi(x)\)

property ψ_hat#

Objective at x̂ \(\psi(\hat x)\)

class alpaqa.ZeroFPRSolver#

C++ documentation: alpaqa::ZeroFPRSolver

__call__(self: alpaqa._alpaqa.float64.ZeroFPRSolver, problem: alpaqa._alpaqa.float64.Problem, opts: alpaqa._alpaqa.float64.InnerSolveOptions = {}, x: numpy.ndarray[numpy.float64[m, 1]] | None = None, y: numpy.ndarray[numpy.float64[m, 1]] | None = None, Σ: numpy.ndarray[numpy.float64[m, 1]] | None = None, *, asynchronous: bool = True, suppress_interrupt: bool = False) tuple#

Solve.

Parameters:
  • problem – Problem to solve

  • opts – Options

  • u – Initial guess

  • y – Lagrange multipliers

  • Σ – Penalty factors

  • asynchronous – Release the GIL and run the solver on a separate thread

  • suppress_interrupt – If the solver is interrupted by a KeyboardInterrupt, don’t propagate this exception back to the Python interpreter, but stop the solver early, and return a solution with the status set to alpaqa.SolverStatus.Interrupted.

Returns:

  • Solution \(u\)

  • Updated Lagrange multipliers (only if parameter y was not None)

  • Constraint violation (only if parameter y was not None)

  • Statistics

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: alpaqa._alpaqa.float64.ZeroFPRSolver, other: alpaqa._alpaqa.float64.ZeroFPRSolver) -> None

Create a copy

  1. __init__(self: alpaqa._alpaqa.float64.ZeroFPRSolver, zerofpr_params: Union[alpaqa._alpaqa.float64.ZeroFPRParams, dict] = {}, lbfgs_params: Union[alpaqa._alpaqa.float64.LBFGS.Params, dict] = {}, direction_params: Union[alpaqa._alpaqa.float64.StructuredLBFGSDirection.DirectionParams, dict] = {}) -> None

Create a ZeroFPR solver using structured L-BFGS directions.

  1. __init__(self: alpaqa._alpaqa.float64.ZeroFPRSolver, zerofpr_params: Union[alpaqa._alpaqa.float64.ZeroFPRParams, dict], direction: alpaqa._alpaqa.float64.PANOCDirection) -> None

Create a ZeroFPR solver using a custom direction.

property direction#
property name#
set_progress_callback(self: alpaqa._alpaqa.float64.ZeroFPRSolver, callback: Callable[[alpaqa._alpaqa.float64.ZeroFPRProgressInfo], None]) alpaqa._alpaqa.float64.ZeroFPRSolver#

Specify a callable that is invoked with some intermediate results on each iteration of the algorithm.

stop(self: alpaqa._alpaqa.float64.ZeroFPRSolver) None#
alpaqa.control_problem_with_counters(problem: alpaqa._alpaqa.float64.CasADiControlProblem) alpaqa._alpaqa.float64.ControlProblemWithCounters#

Wrap the problem to count all function evaluations.

Parameters:

problem – The original problem to wrap. Copied.

Returns:

  • Wrapped problem.

  • Counters for wrapped problem.

alpaqa.deserialize_casadi_problem(functions: Dict[str, str]) alpaqa._alpaqa.float64.CasADiProblem#

Deserialize a CasADi problem from the given serialized functions.

alpaqa.load_casadi_control_problem(so_name: str, N: int) alpaqa._alpaqa.float64.CasADiControlProblem#

Load a compiled CasADi optimal control problem.

alpaqa.load_casadi_problem(so_name: str) alpaqa._alpaqa.float64.CasADiProblem#

Load a compiled CasADi problem.

alpaqa.minimize(f: SX | MX, x: SX | MX) MinimizationProblemDescription[source]#

Formulate a minimization problem with objective function \(f(x)\) and unknown variables \(x\).

exception alpaqa.not_implemented_error#
alpaqa.problem_with_counters(*args, **kwargs)#

Overloaded function.

  1. problem_with_counters(problem: alpaqa._alpaqa.float64.CasADiProblem) -> alpaqa._alpaqa.float64.ProblemWithCounters

Wrap the problem to count all function evaluations.

Parameters:

problem – The original problem to wrap. Copied.

Returns:

  • Wrapped problem.

  • Counters for wrapped problem.

  1. problem_with_counters(problem: object) -> alpaqa._alpaqa.float64.ProblemWithCounters

alpaqa.provided_functions(problem: alpaqa._alpaqa.float64.Problem) str#

Returns a string representing the functions provided by the problem.

alpaqa.prox(*args, **kwargs)#

Overloaded function.

  1. prox(self: alpaqa._alpaqa.float64.functions.NuclearNorm, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], output: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], γ: float = 1) -> float

C++ documentation: alpaqa::prox Compute the proximal mapping of self at in with step size γ. This version overwrites the given output arguments.

  1. prox(self: alpaqa._alpaqa.float64.functions.NuclearNorm, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], γ: float = 1) -> Tuple[float, numpy.ndarray[numpy.float64[m, n]]]

C++ documentation: alpaqa::prox Compute the proximal mapping of self at in with step size γ. This version returns the outputs as a tuple.

  1. prox(self: alpaqa._alpaqa.float64.functions.L1Norm, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], output: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], γ: float = 1) -> float

C++ documentation: alpaqa::prox Compute the proximal mapping of self at in with step size γ. This version overwrites the given output arguments.

  1. prox(self: alpaqa._alpaqa.float64.functions.L1Norm, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], γ: float = 1) -> Tuple[float, numpy.ndarray[numpy.float64[m, n]]]

C++ documentation: alpaqa::prox Compute the proximal mapping of self at in with step size γ. This version returns the outputs as a tuple.

  1. prox(self: alpaqa._alpaqa.float64.functions.L1NormElementwise, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], output: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], γ: float = 1) -> float

C++ documentation: alpaqa::prox Compute the proximal mapping of self at in with step size γ. This version overwrites the given output arguments.

  1. prox(self: alpaqa._alpaqa.float64.functions.L1NormElementwise, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], γ: float = 1) -> Tuple[float, numpy.ndarray[numpy.float64[m, n]]]

C++ documentation: alpaqa::prox Compute the proximal mapping of self at in with step size γ. This version returns the outputs as a tuple.

  1. prox(self: alpaqa._alpaqa.float64.Box, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], output: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], γ: float = 1) -> float

C++ documentation: alpaqa::prox Compute the proximal mapping of self at in with step size γ. This version overwrites the given output arguments.

  1. prox(self: alpaqa._alpaqa.float64.Box, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], γ: float = 1) -> Tuple[float, numpy.ndarray[numpy.float64[m, n]]]

C++ documentation: alpaqa::prox Compute the proximal mapping of self at in with step size γ. This version returns the outputs as a tuple.

alpaqa.prox_step(*args, **kwargs)#

Overloaded function.

  1. prox_step(self: alpaqa._alpaqa.float64.functions.NuclearNorm, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], input_step: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], output: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], output_step: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], γ: float = 1, γ_step: float = -1) -> float

C++ documentation: alpaqa::prox_step Compute a generalized forward-backward step. This version overwrites the given output arguments.

See also

alpaqa.prox()

  1. prox_step(self: alpaqa._alpaqa.float64.functions.NuclearNorm, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], input_step: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], γ: float = 1, γ_step: float = -1) -> Tuple[float, numpy.ndarray[numpy.float64[m, n]], numpy.ndarray[numpy.float64[m, n]]]

C++ documentation: alpaqa::prox_step Compute a generalized forward-backward step. This version returns the outputs as a tuple.

See also

alpaqa.prox()

  1. prox_step(self: alpaqa._alpaqa.float64.functions.L1Norm, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], input_step: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], output: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], output_step: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], γ: float = 1, γ_step: float = -1) -> float

C++ documentation: alpaqa::prox_step Compute a generalized forward-backward step. This version overwrites the given output arguments.

See also

alpaqa.prox()

  1. prox_step(self: alpaqa._alpaqa.float64.functions.L1Norm, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], input_step: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], γ: float = 1, γ_step: float = -1) -> Tuple[float, numpy.ndarray[numpy.float64[m, n]], numpy.ndarray[numpy.float64[m, n]]]

C++ documentation: alpaqa::prox_step Compute a generalized forward-backward step. This version returns the outputs as a tuple.

See also

alpaqa.prox()

  1. prox_step(self: alpaqa._alpaqa.float64.functions.L1NormElementwise, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], input_step: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], output: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], output_step: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], γ: float = 1, γ_step: float = -1) -> float

C++ documentation: alpaqa::prox_step Compute a generalized forward-backward step. This version overwrites the given output arguments.

See also

alpaqa.prox()

  1. prox_step(self: alpaqa._alpaqa.float64.functions.L1NormElementwise, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], input_step: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], γ: float = 1, γ_step: float = -1) -> Tuple[float, numpy.ndarray[numpy.float64[m, n]], numpy.ndarray[numpy.float64[m, n]]]

C++ documentation: alpaqa::prox_step Compute a generalized forward-backward step. This version returns the outputs as a tuple.

See also

alpaqa.prox()

  1. prox_step(self: alpaqa._alpaqa.float64.Box, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], input_step: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], output: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], output_step: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], γ: float = 1, γ_step: float = -1) -> float

C++ documentation: alpaqa::prox_step Compute a generalized forward-backward step. This version overwrites the given output arguments.

See also

alpaqa.prox()

  1. prox_step(self: alpaqa._alpaqa.float64.Box, input: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], input_step: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], γ: float = 1, γ_step: float = -1) -> Tuple[float, numpy.ndarray[numpy.float64[m, n]], numpy.ndarray[numpy.float64[m, n]]]

C++ documentation: alpaqa::prox_step Compute a generalized forward-backward step. This version returns the outputs as a tuple.

See also

alpaqa.prox()

alpaqa.casadi_generator.generate_casadi_problem(f: ~casadi.casadi.Function, g: ~casadi.casadi.Function | None, second_order: ~typing.Literal['no', 'full', 'prod', 'L', 'L_prod', 'psi', 'psi_prod'] = 'no', name: str = 'alpaqa_problem', sym: ~typing.Callable = <function GenSX.sym>) CodeGenerator[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).

  • sym – Symbolic variable constructor, usually either casadi.SX.sym (default) or casadi.MX.sym.

Returns:

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

alpaqa.casadi_generator.generate_casadi_control_problem(f: Function, l: Function, l_N: Function, h: Function = None, h_N: Function = None, c: Function = None, c_N: Function = None, name: str = 'alpaqa_control_problem') CodeGenerator[source]#

Convert the dynamics and cost functions into a CasADi code generator.

Parameters:
  • f – Dynamics.

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

Returns:

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

alpaqa.casadi_generator.write_casadi_problem_data(sofile, C, D, param, l1_reg, penalty_alm_split)[source]#
alpaqa.casadi_generator.write_casadi_control_problem_data(sofile, U, D, D_N, x_init, param, penalty_alm_split=0, penalty_alm_split_N=None)[source]#
alpaqa.casadi_loader.generate_and_compile_casadi_problem(f: Function, g: Function, *, C=None, D=None, param=None, l1_reg=None, penalty_alm_split=None, second_order: Literal['no', 'full', 'prod', 'L', 'L_prod', 'psi', 'psi_prod'] = 'no', name: str = 'alpaqa_problem', **kwargs) CasADiProblem[source]#

Compile the objective and constraint functions into a alpaqa Problem.

Parameters:
  • f – Objective function f(x).

  • g – Constraint function g(x).

  • C – Bound constraints on x.

  • D – Bound constraints on g(x).

  • param – Problem parameter values.

  • l1_reg – L1-regularization on x.

  • penalty_alm_split – This many components at the beginning of g(x) are handled using a quadratic penalty method rather than an augmented Lagrangian method.

  • second_order – Whether to generate functions for evaluating Hessians.

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

  • kwargs – Parameters passed to casadi_generator.generate_casadi_problem().

Returns:

Problem specification that can be passed to the solvers.