DEPRECATED ("Do not use this threshold. It is not needed by our solvers", Scalar get_th_gaptol() const { return th_gaptol_;}) FeasibilityNorm get_feasnorm() const
Return the threshold for accepting a gap as non-zero.
DEPRECATED ("Do not use this threshold. It is not needed by our solvers", void set_th_gaptol(const Scalar th_gaptol);) void set_feasnorm(const FeasibilityNorm feas_norm)
Modify the threshold for accepting a gap as non-zero.
DEPRECATED ("Use get_preg for primal-variable regularization", Scalar get_xreg() const { return preg_;}) DEPRECATED("Use get_preg for primal-variable regularization"
DEPRECATED ("Use set_preg for primal-variable regularization", void set_xreg(const Scalar xreg) { if(xreg< Scalar(0.)) { throw_pretty("Invalid argument: "<< "xreg value has to be positive.");} xreg_=xreg;preg_=xreg;}) DEPRECATED("Use set_preg for primal-variable regularization"
const std::vector< Scalar > &
get_alphas () const
Return the set of step lengths using by the line-search procedure.
Scalar
get_cost () const
Return the cost for the current guess.
Scalar
get_dfeas () const
Return the reduction in the feasibility.
Scalar
get_dPhi () const
Return the reduction in the merit function .
Scalar
get_dPhiexp () const
Return the expected reduction in the merit function .
Scalar
get_dreg () const
Return the dual-variable regularization.
const std::vector< VectorXs > &
get_dus () const
Return the feedforward gains .
const Vector3s &
get_DV () const
Return the constant, linear, and quadratic terms of the expected improvement.
Scalar
get_dV () const
Return the reduction in the cost function .
Scalar
get_dVexp () const
Return the expected reduction in the cost function .
const std::vector< VectorXs > &
get_dxs () const
Return the linear update in .
Scalar
get_feas () const
Return the total feasibility for the current guess.
Scalar
get_ffeas () const
Return the dynamic feasibility for the current guess.
Scalar
get_ffeas_try () const
Return the dynamic feasibility for the current step length.
const std::vector< VectorXs > &
get_fs () const
Return the dynamic infeasibility .
const std::vector< VectorXs > &
get_fs_try () const
Return the trail dynamic infeasibility .
Scalar
get_gfeas () const
Return the inequality feasibility for the current guess.
Scalar
get_gfeas_try () const
Return the inequality feasibility for the current step length.
Scalar
get_hfeas () const
Return the equality feasibility for the current guess.
Scalar
get_hfeas_try () const
Return the equality feasibility for the current step length.
bool
get_is_feasible () const
Return the feasibility status of the trajectory.
std::size_t
get_iter () const
Return the number of iterations performed by the solver.
Compute the optimal trajectory as lists of and terms.
From an initial guess init_xs, init_us (feasible or not), iterate over computeDirection() and tryStep() until stoppingCriteria() is below threshold. It also describes the globalization strategy used during the numerical optimization.
Parameters
[in]
init_xs
initial guess for state trajectory with elements (default [])
[in]
init_us
initial guess for control trajectory with elements (default [])
[in]
maxiter
maximum allowed number of iterations (default 100)
[in]
is_feasible
true if the init_xs are obtained from integrating the init_us (rollout) (default false)
[in]
init_reg
initial guess for the regularization value. Very low values are typical used with very good guess points (default 1e-9).
Returns
A boolean that describes if convergence was reached.
Compute the search direction for the current guess .
You must call setCandidate() first in order to define the current guess. A current guess defines a state and control trajectory of and elements, respectively. When recalc is true (the default in the provided algorithms), the method refreshes the linearization by calling calcDir() before running the backward pass. Setting recalc to false reuses the most recent derivatives, which is useful when calcDir() has already been triggered explicitly. The resulting state and control variations, together with the dynamics multipliers, are stored in the solver data structures (e.g., dxs_, dus_, and lambdas_).
Parameters
[in]
recalc
true to refresh the derivatives before computing the search direction
Try a predefined step length and compute its cost improvement and merit improvement .
It uses the search direction found by computeDirection() to try a determined step length . Therefore, it assumes that we have run computeDirection() first. Additionally, it returns the cost improvement along the predefined step length . Internally, it updates the cost improvement and merit improvement .
Return a positive value that quantifies the algorithm termination.
These values typically represents the gradient norm which tell us that it's been reached the local minima. The stopping criteria strictly speaking depends on the search direction (calculated by computeDirection()) but it could also depend on the chosen step length, tested by tryStep().
Return the expected improvement from a given current search direction .
For computing the expected improvement, you need to compute the search direction first via computeDirection(). The quadratic improvement model is described as dV = DV_0 + DV_1 + 0.5 * DV_2, where DV_0, DV_1, and DV_2 are the constant, linear, and quadratic terms, respectively.
The solver candidates are defined as a state and control trajectories of and elements, respectively. Additionally, we need to define the dynamic feasibility of the pair. Note that the trajectories are feasible if is the resulting trajectory from the system rollout with inputs. Updating the candidate invalidates any previously computed linearization; the next call to computeDirection() will therefore refresh the derivatives on demand.
Parameters
[in]
xs
state trajectory of elements (default [])
[in]
us
control trajectory of elements (default [])
[in]
isFeasible
true if the xs are obtained from integrating the us (rollout)