Python API Reference#
Index#
Python interface to alpaqa’s C++ implementation.
- class alpaqa._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._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._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._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._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#
- exception alpaqa._alpaqa.not_implemented_error#
Double precision
- class alpaqa._alpaqa.float64.ALMParams#
C++ documentation:
alpaqa::ALMParams
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.ALMParams, arg0: dict) -> None
__init__(self: alpaqa._alpaqa.float64.ALMParams, **kwargs) -> None
- property dual_tolerance#
- property initial_penalty#
- property initial_penalty_factor#
- property initial_penalty_lower#
- property initial_tolerance#
- property initial_tolerance_increase#
- property max_iter#
- property max_multiplier#
- property max_num_initial_retries#
- property max_num_retries#
- property max_penalty#
- property max_time#
- property max_total_num_retries#
- property min_penalty#
- property min_penalty_update_factor#
- property penalty_update_factor#
- property penalty_update_factor_lower#
- property print_interval#
- property rel_penalty_increase_threshold#
- property single_penalty_factor#
- to_dict(self: alpaqa._alpaqa.float64.ALMParams) dict #
- property tolerance#
- property tolerance_update_factor#
- property ρ_increase#
- property ρ_max#
- class alpaqa._alpaqa.float64.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) 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
- Returns:
Solution \(x\)
Lagrange multipliers \(y\) at the solution
Statistics
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.ALMSolver, other: alpaqa._alpaqa.float64.ALMSolver) -> None
Create a copy
__init__(self: alpaqa._alpaqa.float64.ALMSolver) -> None
Build an ALM solver using Structured PANOC as inner solver.
__init__(self: alpaqa._alpaqa.float64.ALMSolver, inner_solver: alpaqa._alpaqa.float64.InnerSolver) -> None
Build an ALM solver using the given inner solver.
__init__(self: alpaqa._alpaqa.float64.ALMSolver, inner_solver: alpaqa._alpaqa.float64.InnerOCPSolver) -> None
Build an ALM solver using the given inner solver.
__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.
__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._alpaqa.float64.AndersonAccel#
C++ documentation
alpaqa::AndersonAccel
- class Params#
C++ documentation
alpaqa::AndersonAccelParams
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.AndersonAccel.Params, arg0: dict) -> None
__init__(self: alpaqa._alpaqa.float64.AndersonAccel.Params, **kwargs) -> None
- property memory#
- property min_div_fac#
- to_dict(self: alpaqa._alpaqa.float64.AndersonAccel.Params) dict #
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.AndersonAccel, params: Union[alpaqa._alpaqa.float64.AndersonAccel.Params, dict]) -> None
__init__(self: alpaqa._alpaqa.float64.AndersonAccel, params: Union[alpaqa._alpaqa.float64.AndersonAccel.Params, dict], n: int) -> None
- property params#
- class alpaqa._alpaqa.float64.AndersonDirection#
C++ documentation:
alpaqa::AndersonDirection
- class DirectionParams#
C++ documentation:
alpaqa::AndersonDirection::DirectionParams
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.AndersonDirection.DirectionParams, arg0: dict) -> None
__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._alpaqa.float64.Box#
C++ documentation:
alpaqa::Box
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.Box, other: alpaqa._alpaqa.float64.Box) -> None
Create a copy
__init__(self: alpaqa._alpaqa.float64.Box, n: int) -> None
Create an \(n\)-dimensional box at with bounds at \(\pm\infty\) (no constraints).
__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._alpaqa.float64.BoxConstrProblem#
C++ documentation:
alpaqa::BoxConstrProblem
- property C#
Box constraints on \(x\)
- property D#
Box constraints on \(g(x)\)
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.BoxConstrProblem, other: alpaqa._alpaqa.float64.BoxConstrProblem) -> None
Create a copy
__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.
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
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.
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
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.
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
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._alpaqa.float64.CasADiControlProblem#
C++ documentation:
alpaqa::CasADiControlProblem
See
alpaqa._alpaqa.float64.TEControlProblem
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._alpaqa.float64.CasADiProblem#
C++ documentation:
alpaqa::CasADiProblem
See
alpaqa._alpaqa.float64.Problem
for the full documentation.- __init__(self: alpaqa._alpaqa.float64.CasADiProblem, other: alpaqa._alpaqa.float64.CasADiProblem) None #
Create a copy
- eval_f(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]]) float #
- 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 #
- eval_g(*args, **kwargs)#
Overloaded function.
eval_g(self: alpaqa._alpaqa.float64.CasADiProblem, x: numpy.ndarray[numpy.float64[m, 1]], gx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None
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.
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
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.
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
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.
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
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_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_ψ_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.
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
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_proj_diff_g(*args, **kwargs)#
Overloaded function.
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
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.
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
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.
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
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.
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
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 param#
Parameter vector \(p\) of the problem
- provides_eval_grad_gi(self: alpaqa._alpaqa.float64.CasADiProblem) bool #
- provides_eval_hess_L_prod(self: alpaqa._alpaqa.float64.CasADiProblem) bool #
- provides_eval_hess_ψ_prod(self: alpaqa._alpaqa.float64.CasADiProblem) bool #
- class alpaqa._alpaqa.float64.ControlProblem#
C++ documentation:
alpaqa::TypeErasedControlProblem
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.ControlProblem, other: alpaqa._alpaqa.float64.ControlProblem) -> None
Create a copy
__init__(self: alpaqa._alpaqa.float64.ControlProblem, arg0: alpaqa._alpaqa.float64.CasADiControlProblem) -> None
- class alpaqa._alpaqa.float64.ControlProblemWithCounters#
- __init__(*args, **kwargs)#
- property evaluations#
- property problem#
- class alpaqa._alpaqa.float64.InnerOCPSolver#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.InnerOCPSolver, other: alpaqa._alpaqa.float64.InnerOCPSolver) -> None
Create a copy
__init__(self: alpaqa._alpaqa.float64.InnerOCPSolver, arg0: alpaqa._alpaqa.float64.PANOCOCPSolver) -> None
- property name#
- stop(self: alpaqa._alpaqa.float64.InnerOCPSolver) None #
- class alpaqa._alpaqa.float64.InnerSolveOptions#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.InnerSolveOptions, arg0: dict) -> None
__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._alpaqa.float64.InnerSolver#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.InnerSolver, other: alpaqa._alpaqa.float64.InnerSolver) -> None
Create a copy
__init__(self: alpaqa._alpaqa.float64.InnerSolver, arg0: alpaqa._alpaqa.float64.PANOCSolver) -> None
__init__(self: alpaqa._alpaqa.float64.InnerSolver, arg0: alpaqa._alpaqa.float64.ZeroFPRSolver) -> None
__init__(self: alpaqa._alpaqa.float64.InnerSolver, arg0: alpaqa._alpaqa.float64.PANTRSolver) -> None
- property name#
- stop(self: alpaqa._alpaqa.float64.InnerSolver) None #
- class alpaqa._alpaqa.float64.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.
__init__(self: alpaqa._alpaqa.float64.LBFGS.Params.CBFGS, arg0: dict) -> None
__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.
__init__(self: alpaqa._alpaqa.float64.LBFGS.Params, arg0: dict) -> None
__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.
__init__(self: alpaqa._alpaqa.float64.LBFGS, params: Union[alpaqa._alpaqa.float64.LBFGS.Params, dict]) -> None
__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._alpaqa.float64.LBFGSDirection#
C++ documentation:
alpaqa::LBFGSDirection
- class DirectionParams#
C++ documentation:
alpaqa::LBFGSDirection::DirectionParams
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.LBFGSDirection.DirectionParams, arg0: dict) -> None
__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._alpaqa.float64.LipschitzEstimateParams#
C++ documentation:
alpaqa::LipschitzEstimateParams
- property L_0#
- property Lγ_factor#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.LipschitzEstimateParams, arg0: dict) -> None
__init__(self: alpaqa._alpaqa.float64.LipschitzEstimateParams, **kwargs) -> None
- to_dict(self: alpaqa._alpaqa.float64.LipschitzEstimateParams) dict #
- property δ#
- property ε#
- class alpaqa._alpaqa.float64.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._alpaqa.float64.NewtonTRDirectionParams#
C++ documentation:
alpaqa::NewtonTRDirectionParams
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.NewtonTRDirectionParams, arg0: dict) -> None
__init__(self: alpaqa._alpaqa.float64.NewtonTRDirectionParams, **kwargs) -> None
- property finite_diff#
- property finite_diff_stepsize#
- property hessian_vec_factor#
- property rescale_on_step_size_changes#
- to_dict(self: alpaqa._alpaqa.float64.NewtonTRDirectionParams) dict #
- class alpaqa._alpaqa.float64.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, arg0: 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._alpaqa.float64.PANOCDirection#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.PANOCDirection, arg0: alpaqa._alpaqa.float64.LBFGSDirection) -> None
__init__(self: alpaqa._alpaqa.float64.PANOCDirection, arg0: alpaqa._alpaqa.float64.StructuredLBFGSDirection) -> None
__init__(self: alpaqa._alpaqa.float64.PANOCDirection, arg0: alpaqa._alpaqa.float64.StructuredNewtonDirection) -> None
__init__(self: alpaqa._alpaqa.float64.PANOCDirection, arg0: alpaqa._alpaqa.float64.AndersonDirection) -> None
__init__(self: alpaqa._alpaqa.float64.PANOCDirection, arg0: object) -> None
- property params#
- class alpaqa._alpaqa.float64.PANOCOCPParams#
C++ documentation:
alpaqa::PANOCOCPParams
- property L_max#
- property L_max_inc#
- property L_min#
- property Lipschitz#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.PANOCOCPParams, arg0: dict) -> None
__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._alpaqa.float64.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._alpaqa.float64.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) 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
- Returns:
Solution \(u\)
Updated Lagrange multipliers (only if parameter
y
was notNone
)Constraint violation (only if parameter
y
was notNone
)Statistics
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.PANOCOCPSolver, other: alpaqa._alpaqa.float64.PANOCOCPSolver) -> None
Create a copy
__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._alpaqa.float64.PANOCParams#
C++ documentation:
alpaqa::PANOCParams
- property L_max#
- property L_min#
- property Lipschitz#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.PANOCParams, arg0: dict) -> None
__init__(self: alpaqa._alpaqa.float64.PANOCParams, **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_lbfgs_flush#
- property stop_crit#
- to_dict(self: alpaqa._alpaqa.float64.PANOCParams) dict #
- property update_direction_in_candidate#
- class alpaqa._alpaqa.float64.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 Σ#
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._alpaqa.float64.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) 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
- Returns:
Solution \(u\)
Updated Lagrange multipliers (only if parameter
y
was notNone
)Constraint violation (only if parameter
y
was notNone
)Statistics
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.PANOCSolver, other: alpaqa._alpaqa.float64.PANOCSolver) -> None
Create a copy
__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.
__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._alpaqa.float64.PANTRDirection#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.PANTRDirection, arg0: alpaqa._alpaqa.float64.NewtonTRDirection) -> None
__init__(self: alpaqa._alpaqa.float64.PANTRDirection, arg0: object) -> None
- property params#
- class alpaqa._alpaqa.float64.PANTRParams#
C++ documentation:
alpaqa::PANTRParams
- property L_max#
- property L_min#
- property Lipschitz#
- property TR_tolerance_factor#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.PANTRParams, arg0: dict) -> None
__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._alpaqa.float64.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 Δ#
Previous trust radius \(\Delta\)
- property Σ#
Penalty factor \(\Sigma\)
- property γ#
Step size \(\gamma\)
- property ε#
Tolerance reached \(\varepsilon_k\)
- property ρ#
Previous decrease ratio \(\rho\)
- property φγ#
Forward-backward envelope \(\varphi_\gamma(x)\)
- property ψ#
Objective value \(\psi(x)\)
- property ψ_hat#
Objective at x̂ \(\psi(\hat x)\)
- class alpaqa._alpaqa.float64.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) 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
- Returns:
Solution \(u\)
Updated Lagrange multipliers (only if parameter
y
was notNone
)Constraint violation (only if parameter
y
was notNone
)Statistics
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.PANTRSolver, other: alpaqa._alpaqa.float64.PANTRSolver) -> None
Create a copy
__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.
__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._alpaqa.float64.Problem#
C++ documentation:
alpaqa::TypeErasedProblem
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.Problem, other: alpaqa._alpaqa.float64.Problem) -> None
Create a copy
__init__(self: alpaqa._alpaqa.float64.Problem, arg0: alpaqa._alpaqa.float64.CasADiProblem) -> None
__init__(self: alpaqa._alpaqa.float64.Problem, arg0: object) -> 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(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], grad_fx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) float #
- eval_g(*args, **kwargs)#
Overloaded function.
eval_g(self: alpaqa._alpaqa.float64.Problem, x: numpy.ndarray[numpy.float64[m, 1]], gx: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None
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.
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
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.
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
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.
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
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_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_ψ_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.
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
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_proj_diff_g(*args, **kwargs)#
Overloaded function.
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
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.
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
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.
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
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.
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
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 #
- 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_prod(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_ψ(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 #
- class alpaqa._alpaqa.float64.ProblemWithCounters#
- __init__(*args, **kwargs)#
- property evaluations#
- property problem#
- class alpaqa._alpaqa.float64.SteihaugCGParams#
C++ documentation:
alpaqa::SteihaugCGParams
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.SteihaugCGParams, arg0: dict) -> None
__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._alpaqa.float64.StructuredLBFGSDirection#
C++ documentation:
alpaqa::StructuredLBFGSDirection
- class DirectionParams#
C++ documentation:
alpaqa::StructuredLBFGSDirection::DirectionParams
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.StructuredLBFGSDirection.DirectionParams, arg0: dict) -> None
__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._alpaqa.float64.StructuredNewtonDirection#
C++ documentation:
alpaqa::StructuredNewtonDirection
- class DirectionParams#
C++ documentation:
alpaqa::StructuredNewtonDirection::DirectionParams
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.StructuredNewtonDirection.DirectionParams, arg0: dict) -> None
__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._alpaqa.float64.UnconstrProblem#
C++ documentation:
alpaqa::UnconstrProblem
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.UnconstrProblem, other: alpaqa._alpaqa.float64.UnconstrProblem) -> None
Create a copy
__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.
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
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]], inner_idx: numpy.ndarray[numpy.int64[m, 1], flags.writeable], outer_ptr: numpy.ndarray[numpy.int64[m, 1], flags.writeable], J_values: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) None #
- eval_proj_diff_g(*args, **kwargs)#
Overloaded function.
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
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.
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
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._alpaqa.float64.ZeroFPRParams#
C++ documentation:
alpaqa::ZeroFPRParams
- property L_max#
- property L_min#
- property Lipschitz#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.ZeroFPRParams, arg0: dict) -> None
__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_lbfgs_flush#
- property stop_crit#
- to_dict(self: alpaqa._alpaqa.float64.ZeroFPRParams) dict #
- property update_direction_from_prox_step#
- property update_direction_in_candidate#
- class alpaqa._alpaqa.float64.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 Σ#
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._alpaqa.float64.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) 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
- Returns:
Solution \(u\)
Updated Lagrange multipliers (only if parameter
y
was notNone
)Constraint violation (only if parameter
y
was notNone
)Statistics
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: alpaqa._alpaqa.float64.ZeroFPRSolver, other: alpaqa._alpaqa.float64.ZeroFPRSolver) -> None
Create a copy
__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.
__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._alpaqa.float64.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._alpaqa.float64.load_casadi_control_problem(so_name: str, N: int) alpaqa._alpaqa.float64.CasADiControlProblem #
Load a compiled CasADi optimal control problem.
- alpaqa._alpaqa.float64.load_casadi_problem(so_name: str) alpaqa._alpaqa.float64.CasADiProblem #
Load a compiled CasADi problem.
- alpaqa._alpaqa.float64.problem_with_counters(*args, **kwargs)#
Overloaded function.
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.
problem_with_counters(problem: object) -> alpaqa._alpaqa.float64.ProblemWithCounters
- alpaqa._alpaqa.float64.provided_functions(arg0: alpaqa._alpaqa.float64.Problem) str #
- 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) orcasadi.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 = None, h_N: Function | None = None, c: Function | None = None, c_N: Function | None = 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)[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.
- class alpaqa.pyapi.minimize.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 = 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.
- 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 eithercs.SX.sym
(default) orcs.MX.sym
.
- __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 #
- alpaqa.pyapi.minimize.minimize(f: SX | MX, x: SX | MX) MinimizationProblemDescription [source]#
Formulate a minimization problem with objective function \(f(x)\) and unknown variables \(x\).