17#include <proxsuite-nlp/bcl-params.hpp>
19#include <unordered_map>
28 void operator()(ConstraintProximalScalerTpl<Scalar> &scaler) {
29 for (std::size_t j = 0; j < scaler.size(); j++)
30 scaler.setWeight(
scale, j);
32 static constexpr Scalar
scale = 10.;
51 using Problem = TrajOptProblemTpl<Scalar>;
61 using CallbackMap = std::unordered_map<std::string, CallbackPtr>;
63 using CstrSet = ConstraintSetBase<Scalar>;
110 LinesearchStrategy
ls_strat = LinesearchStrategy::ARMIJO;
146 std::size_t num_threads_ = 1;
160 VerboseLevel verbose = VerboseLevel::QUIET,
167 "Linear solver already set: setNumThreads() should be called before "
168 "you call setup() if you want to use the parallel linear solver.\n");
170 num_threads_ = num_threads;
209 bool run(
const Problem &problem,
const std::vector<VectorXs> &xs_init = {},
210 const std::vector<VectorXs> &us_init = {},
211 const std::vector<VectorXs> &lams_init = {});
249 cb.second->call(workspace, results);
258 const std::vector<VectorXs> &lams,
259 const std::vector<VectorXs> &vs);
314#include "solver-proxddp.hxx"
316#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
317#include "solver-proxddp.txx"
#define ALIGATOR_WARNING(loc, msg)
void set_default_options(std::size_t, bool=true)
StepAcceptanceStrategy
Whether to use linesearch or filter during step acceptance phase.
@ NONLINEAR
Nonlinear rollout, using the full dynamics.
@ GAUSS_NEWTON
Use the Gauss-Newton approximation.
LinesearchMode
Whether to use merit functions in primal or primal-dual mode.
Define workspace for the ProxDDP solver.
TODO: NEW G.A.R. BACKEND CAN'T HANDLE DIFFERENT WEIGHTS, PLS FIX.
static constexpr Scalar scale
void operator()(ConstraintProximalScalerTpl< Scalar > &scaler)
A table logging utility to log the trace of the numerical solvers.
A proximal, augmented Lagrangian-type solver for trajectory optimization.
ConstraintSetBase< Scalar > CstrSet
MultiplierUpdateMode multiplier_update_mode
Type of Lagrange multiplier update.
void updateGains()
Update primal-dual feedback gains (control, costate, path multiplier)
StageConstraintTpl< Scalar > ConstraintType
void computeCriterion()
Compute stationarity criterion (dual infeasibility).
bool run(const Problem &problem, const std::vector< VectorXs > &xs_init={}, const std::vector< VectorXs > &us_init={}, const std::vector< VectorXs > &lams_init={})
Run the numerical solver.
void removeCallback(const std::string &name)
std::unordered_map< std::string, CallbackPtr > CallbackMap
Scalar prim_tol_
Desired primal feasibility.
proxsuite::nlp::ArmijoLinesearch< Scalar > LinesearchType
std::size_t getNumThreads() const
ALIGATOR_INLINE Scalar mu() const
Scalar dual_weight
Weight of the dual variables in the primal-dual linesearch.
shared_ptr< CallbackBaseTpl< Scalar > > CallbackPtr
void invokeCallbacks(Workspace &workspace, Results &results)
Invoke callbacks.
LinesearchStrategy ls_strat
Type of linesearch strategy. Default is Armijo.
ALIGATOR_INLINE Scalar rho() const
Primal proximal parameter .
void clearCallbacks() noexcept
Remove all callbacks from the instance.
unique_ptr< gar::RiccatiSolverBase< Scalar > > linearSolver_
LQR subproblem solver.
ALIGATOR_INLINE void setRho(Scalar new_rho) noexcept
bool force_initial_condition_
CallbackMap callbacks_
Callbacks.
LQSolverChoice linear_solver_choice
Choice of linear solver.
Scalar forwardPass(const Problem &problem, const Scalar alpha)
ALIGATOR_DEPRECATED const Workspace & getWorkspace()
RolloutType rollout_type_
Type of rollout for the forward pass.
void computeMultipliers(const Problem &problem, const std::vector< VectorXs > &lams, const std::vector< VectorXs > &vs)
ConstraintProximalScalerTpl< Scalar > CstrProximalScaler
auto getCallback(const std::string &name) -> CallbackPtr
LinesearchOptions ls_params
Linesearch options, as in proxsuite-nlp.
ConstraintStackTpl< Scalar > ConstraintStack
Scalar target_tol_
Solver tolerance .
void setup(const Problem &problem)
Allocate new workspace and results instances according to the specifications of problem.
Scalar inner_tol_
Subproblem tolerance.
HessianApprox hess_approx_
Type of Hessian approximation. Default is Gauss-Newton.
ALIGATOR_DEPRECATED const Results & getResults()
const CallbackMap & getCallbacks() const
void setNumThreads(const std::size_t num_threads)
std::size_t maxRefinementSteps_
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
void initializeRegularization() noexcept
void updateTolsOnSuccess() noexcept
static Scalar tryLinearStep(const Problem &problem, Workspace &workspace, const Results &results, const Scalar alpha)
Try a step of size .
LinesearchMode ls_mode
Linesearch mode.
ALIGATOR_INLINE Scalar mu_inv() const
ALIGATOR_INLINE void setAlmPenalty(Scalar new_mu) noexcept
Set dual proximal/ALM penalty parameter.
SolverProxDDPTpl(const Scalar tol=1e-6, const Scalar mu_init=0.01, const Scalar rho_init=0., const std::size_t max_iters=1000, VerboseLevel verbose=VerboseLevel::QUIET, HessianApprox hess_approx=HessianApprox::GAUSS_NEWTON)
TrajOptProblemTpl< Scalar > Problem
bool innerLoop(const Problem &problem)
Perform the inner loop of the algorithm (augmented Lagrangian minimization).
FilterTpl< Scalar > Filter
void increaseRegularization() noexcept
VerboseLevel verbose_
Solver verbosity level.
void registerCallback(const std::string &name, CallbackPtr cb)
Add a callback to the solver instance.
Scalar tryNonlinearRollout(const Problem &problem, const Scalar alpha)
Policy rollout using the full nonlinear dynamics. The feedback gains need to be computed first....
void updateTolsOnFailure() noexcept
DynamicsDataTpl< Scalar > DynamicsData
void computeInfeasibilities(const Problem &problem)
Compute the primal infeasibility measures.
WorkspaceTpl< Scalar > Workspace
Scalar refinementThreshold_
typename Linesearch< Scalar >::Options LinesearchOptions
void updateLQSubproblem()
StepAcceptanceStrategy sa_strategy
Step acceptance mode.
BCLParamsTpl< Scalar > bcl_params
Parameters for the BCL outer loop of the augmented Lagrangian algorithm.