18#include <boost/unordered_map.hpp>
42 using CallbackMap = boost::unordered_map<std::string, CallbackPtr>;
91 VerboseLevel verbose = VerboseLevel::QUIET,
109 Workspace &workspace,
const Scalar alpha);
133 inline Scalar computeInfeasibility(
const Problem &problem);
143 assert(workspace.
kktRhs.size() == results.
gains_.size());
148 inline void increaseRegularization() {
153 inline void decreaseRegularization() {
159 inline Scalar computeCriterion(
Workspace &workspace);
162 void registerCallback(
const std::string &name,
CallbackPtr cb) {
167 void removeCallback(
const std::string &name) {
callbacks_.erase(name); }
168 auto getCallbackNames()
const {
169 std::vector<std::string> keys;
171 keys.push_back(item.first);
175 CallbackPtr getCallback(
const std::string &name)
const {
186 void invokeCallbacks(
Workspace &workspace, Results &results) {
188 cb.second->call(workspace, results);
192 bool run(
const Problem &problem,
const std::vector<VectorXs> &xs_init = {},
193 const std::vector<VectorXs> &us_init = {});
195 static const ExplicitDynamicsData &
196 stage_get_dynamics_data(
const StageDataTpl<Scalar> &data);
201#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
202#include "./solver-fddp.txx"
#define ALIGATOR_NOMALLOC_SCOPED
void set_default_options(std::size_t, bool=true)
Data struct for CostAbstractTpl.
Specific data struct for explicit dynamics ExplicitDynamicsModelTpl.
Explicit forward dynamics model .
A table logging utility to log the trace of the numerical solvers.
Q-function model parameters.
std::vector< MatrixXs > gains_
Riccati gains.
The feasible DDP (FDDP) algorithm, from Mastalli et al. (2020).
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
void updateExpectedImprovement(Workspace &workspace, Results &results) const
Pre-compute parts of the directional derivatives – this is done before linesearch.
WorkspaceFDDPTpl< Scalar > Workspace
void setup(const Problem &problem)
Allocate workspace and results structs.
TrajOptProblemTpl< Scalar > Problem
Scalar reg_inc_factor_
Regularization increase factor.
static Scalar forwardPass(const Problem &problem, const Results &results, Workspace &workspace, const Scalar alpha)
Perform a nonlinear rollout, keeping an infeasibility gap.
void expectedImprovement(Workspace &workspace, Scalar &d1, Scalar &d2) const
Finish computing the directional derivatives – this is done within linesearch.
Linesearch< Scalar >::Options ls_params
bool force_initial_condition_
Scalar reg_dec_factor_
Regularization decrease factor.
boost::unordered_map< std::string, CallbackPtr > CallbackMap
void setNumThreads(const std::size_t num_threads)
std::size_t max_iters
Maximum number of iterations for the solver.
shared_ptr< CallbackBaseTpl< Scalar > > CallbackPtr
std::size_t getNumThreads() const
ManifoldAbstractTpl< Scalar > Manifold
std::size_t num_threads_
Number of threads to use when evaluating the problem or its derivatives.
CallbackMap callbacks_
Callbacks.
SolverFDDPTpl(const Scalar tol=1e-6, VerboseLevel verbose=VerboseLevel::QUIET, const Scalar reg_init=1e-9, const std::size_t max_iters=200)
Data struct for stage models StageModelTpl.
A stage in the control problem.
Trajectory optimization problem.
Storage for the value function model parameters.
Workspace for solver SolverFDDP.
std::vector< MatrixXs > kktRhs
Buffer for KKT system right-hand sides.