GCOP
1.0
|
#include <sddp.h>
Public Member Functions | |
SDdp (System< T, nx, nu, np > &sys, Cost< T, nx, nu, np > &cost, vector< double > &ts, vector< T > &xs, vector< Vectorcd > &us, Vectorpd *p=0, bool update=true) | |
virtual | ~SDdp () |
void | Iterate () |
void | Forward () |
void | Backward () |
void | Linearize () |
bool | pd (const Matrixnd &P) |
bool | pdX (const MatrixXd &P) |
void | Reset () |
Public Attributes | |
int | N |
number of discrete trajectory segments | |
double | mu |
current regularization factor mu | |
double | mu0 |
minimum regularization factor mu | |
double | dmu0 |
regularization factor modification step-size | |
double | mumax |
maximum regularization factor mu | |
double | a |
step-size | |
double | current_a |
current step-size | |
std::vector< Vectorcd > | dus |
computed control change | |
std::vector< T > | xss |
Sample states (N+1) vector. | |
std::vector< T > | xsprev |
Mean of Sample states (N+1) vector. | |
std::vector< Vectorcd > | kus |
std::vector< Vectorcd > | du_sigma |
Stores the stdeviation at each segment. | |
std::vector< Matrixcnd > | Kuxs |
std::vector< Vectorcd > | Qud |
Inverse Variance for sampling du. | |
std::default_random_engine | randgenerator |
Default random engine. | |
std::normal_distribution< double > | normal_dist |
Creates a normal distribution. | |
Vectornd | Lx |
Matrixnd | Lxx |
Vectorcd | Lu |
Matrixcd | Luu |
Matrixnd | P |
Vectornd | v |
Vectorcd | duscale |
Scales sampled du according to this vector. | |
Vectornd | dxscale |
Scales sampled dx0 according to this vector. | |
RenderFunc * | external_render |
RenderFunction for rendering samples. | |
double | V |
Vector2d | dV |
double | s1 |
Armijo/Bertsekas step-size control factor s1. | |
double | s2 |
Armijo/Bertsekas step-size control factor s2. | |
double | b1 |
Armijo/Bertsekas step-size control factor b1. | |
double | b2 |
Armijo/Bertsekas step-size control factor b2. | |
char | type |
type of algorithm (choices are PURE, DDP, LQS), LQS is default. In the current implementation second-order expansion of the dynamics is ignored, so DDP and LQS are identical. Both LQS and DDP are implemented using the true nonlinear dynamics integration in the Forward step, while PURE uses the linearized version in order to match exactly the true Newton step. | |
int | Ns |
Number of samples for linearizing. | |
Static Public Attributes | |
static const char | PURE = 0 |
PURE version of algorithm (i.e. stage-wise Newton) | |
static const char | DDP = 1 |
DDP version of algorithm. | |
static const char | LQS = 2 |
Linear-Quadratic Subproblem version of algorithm due to Dreyfus / Dunn&Bertsekas / Pantoja. |
gcop::SDdp< T, nx, nu, np >::SDdp | ( | System< T, nx, nu, np > & | sys, |
Cost< T, nx, nu, np > & | cost, | ||
vector< double > & | ts, | ||
vector< T > & | xs, | ||
vector< Vectorcd > & | us, | ||
Vectorpd * | p = 0 , |
||
bool | update = true |
||
) |
Create an optimal control problem using a system, a cost, and a trajectory given by a sequence of times, states, and controls. The times ts must be given, the initial state xs[0] must be set, and the controls us will be used as an initial guess for the optimization.
After initialization, every call to Iterate() will optimize the controls us and states xs and modify them accordingly. Problems involving time-optimization will also modify the sequence of times ts.
sys | system |
cost | cost |
ts | (N+1) sequence of discrete times |
xs | (N+1) sequence of discrete states |
us | (N) sequence of control inputs |
update | whether to update trajectory xs using initial state xs[0] and inputs us. This is necessary only if xs was not already generated from us. |
References gcop::SDdp< T, nx, nu, np >::du_sigma, gcop::SDdp< T, nx, nu, np >::dus, gcop::SDdp< T, nx, nu, np >::duscale, gcop::SDdp< T, nx, nu, np >::dxscale, gcop::SDdp< T, nx, nu, np >::kus, gcop::SDdp< T, nx, nu, np >::Kuxs, gcop::SDdp< T, nx, nu, np >::Lu, gcop::SDdp< T, nx, nu, np >::Luu, gcop::SDdp< T, nx, nu, np >::Lx, gcop::SDdp< T, nx, nu, np >::Lxx, gcop::SDdp< T, nx, nu, np >::N, gcop::Manifold< T, _n >::n, gcop::Docp< T, nx, nu, np >::nofevaluations, gcop::SDdp< T, nx, nu, np >::P, gcop::SDdp< T, nx, nu, np >::Qud, gcop::System< T, _nx, _nu, _np >::U, gcop::Docp< T, nx, nu, np >::Update(), gcop::Docp< T, nx, nu, np >::us, gcop::SDdp< T, nx, nu, np >::v, gcop::System< T, _nx, _nu, _np >::X, gcop::Docp< T, nx, nu, np >::xs, gcop::SDdp< T, nx, nu, np >::xsprev, and gcop::SDdp< T, nx, nu, np >::xss.
gcop::SDdp< T, nx, nu, np >::~SDdp | ( | ) | [virtual] |
void gcop::SDdp< T, nx, nu, np >::Backward | ( | ) |
Backward pass
void gcop::SDdp< T, nx, nu, np >::Forward | ( | ) |
void gcop::SDdp< T, nx, nu, np >::Iterate | ( | ) | [virtual] |
Perform one DDP iteration. Internally calls:
Backward -> Forward -> Update. The controls us and trajectory xs are updated.
Reimplemented from gcop::Docp< T, nx, nu, np >.
void gcop::SDdp< T, nx, nu, np >::Linearize | ( | ) |
Linearize around existing us and xs by collecting samples
References gcop::Manifold< Matrix< double, _n, 1 >, _n >::bnd, gcop::Manifold< Matrix< double, _n, 1 >, _n >::lb, gcop::normal_dist(), and gcop::Manifold< Matrix< double, _n, 1 >, _n >::ub.
bool gcop::SDdp< T, nx, nu, np >::pd | ( | const Matrixnd & | P | ) | [inline] |
bool gcop::SDdp< T, nx, nu, np >::pdX | ( | const MatrixXd & | P | ) | [inline] |
void gcop::SDdp< T, nx, nu, np >::Reset | ( | ) | [inline] |
double gcop::SDdp< T, nx, nu, np >::a |
step-size
double gcop::SDdp< T, nx, nu, np >::b1 |
Armijo/Bertsekas step-size control factor b1.
double gcop::SDdp< T, nx, nu, np >::b2 |
Armijo/Bertsekas step-size control factor b2.
double gcop::SDdp< T, nx, nu, np >::current_a |
current step-size
const char gcop::SDdp< T, nx, nu, np >::DDP = 1 [static] |
DDP version of algorithm.
double gcop::SDdp< T, nx, nu, np >::dmu0 |
regularization factor modification step-size
std::vector<Vectorcd> gcop::SDdp< T, nx, nu, np >::du_sigma |
Stores the stdeviation at each segment.
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
std::vector<Vectorcd> gcop::SDdp< T, nx, nu, np >::dus |
computed control change
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
Vectorcd gcop::SDdp< T, nx, nu, np >::duscale |
Scales sampled du according to this vector.
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
Vector2d gcop::SDdp< T, nx, nu, np >::dV |
Vectornd gcop::SDdp< T, nx, nu, np >::dxscale |
Scales sampled dx0 according to this vector.
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
RenderFunc* gcop::SDdp< T, nx, nu, np >::external_render |
RenderFunction for rendering samples.
std::vector<Vectorcd> gcop::SDdp< T, nx, nu, np >::kus |
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
std::vector<Matrixcnd> gcop::SDdp< T, nx, nu, np >::Kuxs |
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
const char gcop::SDdp< T, nx, nu, np >::LQS = 2 [static] |
Linear-Quadratic Subproblem version of algorithm due to Dreyfus / Dunn&Bertsekas / Pantoja.
Vectorcd gcop::SDdp< T, nx, nu, np >::Lu |
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
Matrixcd gcop::SDdp< T, nx, nu, np >::Luu |
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
Vectornd gcop::SDdp< T, nx, nu, np >::Lx |
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
Matrixnd gcop::SDdp< T, nx, nu, np >::Lxx |
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
double gcop::SDdp< T, nx, nu, np >::mu |
current regularization factor mu
double gcop::SDdp< T, nx, nu, np >::mu0 |
minimum regularization factor mu
double gcop::SDdp< T, nx, nu, np >::mumax |
maximum regularization factor mu
int gcop::SDdp< T, nx, nu, np >::N |
number of discrete trajectory segments
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
std::normal_distribution<double> gcop::SDdp< T, nx, nu, np >::normal_dist |
Creates a normal distribution.
int gcop::SDdp< T, nx, nu, np >::Ns |
Number of samples for linearizing.
Matrixnd gcop::SDdp< T, nx, nu, np >::P |
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
const char gcop::SDdp< T, nx, nu, np >::PURE = 0 [static] |
PURE version of algorithm (i.e. stage-wise Newton)
std::vector<Vectorcd> gcop::SDdp< T, nx, nu, np >::Qud |
Inverse Variance for sampling du.
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
std::default_random_engine gcop::SDdp< T, nx, nu, np >::randgenerator |
Default random engine.
double gcop::SDdp< T, nx, nu, np >::s1 |
Armijo/Bertsekas step-size control factor s1.
double gcop::SDdp< T, nx, nu, np >::s2 |
Armijo/Bertsekas step-size control factor s2.
char gcop::SDdp< T, nx, nu, np >::type |
type of algorithm (choices are PURE, DDP, LQS), LQS is default. In the current implementation second-order expansion of the dynamics is ignored, so DDP and LQS are identical. Both LQS and DDP are implemented using the true nonlinear dynamics integration in the Forward step, while PURE uses the linearized version in order to match exactly the true Newton step.
Vectornd gcop::SDdp< T, nx, nu, np >::v |
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
double gcop::SDdp< T, nx, nu, np >::V |
std::vector<T> gcop::SDdp< T, nx, nu, np >::xsprev |
Mean of Sample states (N+1) vector.
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().
std::vector<T> gcop::SDdp< T, nx, nu, np >::xss |
Sample states (N+1) vector.
Referenced by gcop::SDdp< T, nx, nu, np >::SDdp().