9 #ifndef CROCODDYL_CORE_SOLVER_BASE_HPP_ 10 #define CROCODDYL_CORE_SOLVER_BASE_HPP_ 14 #include "crocoddyl/core/optctrl/shooting.hpp" 18 class CallbackAbstract;
19 static std::vector<Eigen::VectorXd> DEFAULT_VECTOR;
23 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
25 explicit SolverAbstract(boost::shared_ptr<ShootingProblem> problem);
26 virtual ~SolverAbstract();
28 virtual bool solve(
const std::vector<Eigen::VectorXd>& init_xs = DEFAULT_VECTOR,
29 const std::vector<Eigen::VectorXd>& init_us = DEFAULT_VECTOR,
const std::size_t& maxiter = 100,
30 const bool& is_feasible =
false,
const double& reg_init = 1e-9) = 0;
32 virtual void computeDirection(
const bool& recalc) = 0;
33 virtual double tryStep(
const double& step_length = 1) = 0;
34 virtual double stoppingCriteria() = 0;
35 virtual const Eigen::Vector2d& expectedImprovement() = 0;
36 void setCandidate(
const std::vector<Eigen::VectorXd>& xs_warm = DEFAULT_VECTOR,
37 const std::vector<Eigen::VectorXd>& us_warm = DEFAULT_VECTOR,
const bool& is_feasible =
false);
39 void setCallbacks(
const std::vector<boost::shared_ptr<CallbackAbstract> >& callbacks);
40 const std::vector<boost::shared_ptr<CallbackAbstract> >& getCallbacks()
const;
42 const boost::shared_ptr<ShootingProblem>& get_problem()
const;
43 const std::vector<Eigen::VectorXd>& get_xs()
const;
44 const std::vector<Eigen::VectorXd>& get_us()
const;
45 const bool& get_is_feasible()
const;
46 const double& get_cost()
const;
47 const double& get_stop()
const;
48 const Eigen::Vector2d& get_d()
const;
49 const double& get_xreg()
const;
50 const double& get_ureg()
const;
51 const double& get_steplength()
const;
52 const double& get_dV()
const;
53 const double& get_dVexp()
const;
54 const double& get_th_acceptstep()
const;
55 const double& get_th_stop()
const;
56 const std::size_t& get_iter()
const;
58 void set_xs(
const std::vector<Eigen::VectorXd>& xs);
59 void set_us(
const std::vector<Eigen::VectorXd>& us);
60 void set_xreg(
const double& xreg);
61 void set_ureg(
const double& ureg);
62 void set_th_acceptstep(
const double& th_acceptstep);
63 void set_th_stop(
const double& th_stop);
67 std::vector<Eigen::VectorXd>
xs_;
68 std::vector<Eigen::VectorXd>
us_;
69 std::vector<boost::shared_ptr<CallbackAbstract> >
callbacks_;
92 bool raiseIfNaN(
const double& value);
96 #endif // CROCODDYL_CORE_SOLVER_BASE_HPP_ bool is_feasible_
Label that indicates is the iteration is feasible.
double ureg_
Current control regularization values.
double steplength_
Current applied step-length.
double xreg_
Current state regularization value.
std::vector< boost::shared_ptr< CallbackAbstract > > callbacks_
Callback functions.
double th_acceptstep_
Threshold used for accepting step.
std::vector< Eigen::VectorXd > us_
Control trajectory.
double dV_
Cost reduction obtained by tryStep.
Eigen::Vector2d d_
LQ approximation of the expected improvement.
boost::shared_ptr< ShootingProblem > problem_
optimal control problem
double dVexp_
Expected cost reduction.
std::vector< Eigen::VectorXd > xs_
State trajectory.
double th_stop_
Tolerance for stopping the algorithm.
std::size_t iter_
Number of iteration performed by the solver.
double stop_
Value computed by stoppingCriteria.