GCOP  1.0
Classes | Public Member Functions | Public Attributes
gcop::ASPSA< T, n, c, _np > Class Template Reference

#include <aspsa.h>

Collaboration diagram for gcop::ASPSA< T, n, c, _np >:
Collaboration graph
[legend]

List of all members.

Classes

struct  Stepcoeffs

Public Member Functions

 ASPSA (System< T, n, c, _np > &sys, Cost< T, n, c, _np > &cost, vector< double > &ts, vector< T > &xs, vector< Vectorcd > &us, Vectormd *p=0, bool update=true)
virtual ~ASPSA ()
void Iterate ()
double Update (std::vector< T > &xs, const std::vector< Vectorcd > &us, bool evalCost=true)

Public Attributes

System< T, n, c, _np > & sys
 dynamical system
Cost< T, n, c, _np > & cost
 given cost function
std::vector< double > & ts
 times (N+1) vector
std::vector< T > & xs
 states (N+1) vector
std::vector< Vectorcd > & us
 controls (N) vector
std::vector< Vectorcd > dus1
 control variation (N) vector
std::vector< Vectorcd > ustemp
 control variation (N) vector
std::vector< Vectorcd > dus2
 control variation (N) vector
std::vector< T > xss
 states (N+1) vector
std::vector< Vectorcd > uss1
 controls (N) vector perturb1
std::vector< Vectorcd > uss2
 controls (N) vector perturb2
std::vector< Vectorcd > ghat
 Estimated gradient.
std::vector< Vectorcd > ghatavg
 Estimated avg gradient.
std::vector< Vectorcd > hessian_currest
 Current iterate hessian estimate.
std::vector< Vectorcd > hessian_currestavg
 Current iterate hessian estimate after averaging.
std::vector< Vectorcd > hessian_est
 Estimating Hessian.
std::vector< Vectorcd > hessian_estreg
 Adding Regularizing term.
std::vector< Vectorcd > deltaG
 Difference in Gradient.
std::default_random_engine randgenerator
std::bernoulli_distribution bernoulli_dist
 Default random engine.
int N
 number of discrete trajectory segments
int Nit
 Number of steps of ASPSA to complete in one Iterate function.
float toleranceJ
 Tolerance for how high J can go from the current value to reject some.
float toleranceHessianmag
 Tolerance for how high J can go from the current value to reject some.
struct gcop::ASPSA::Stepcoeffs stepc
double J
 optimal cost
bool debug
 whether to display debugging info
int prevcount
 for now use this to propagate the count forward for every iteration

template<typename T, int n = Dynamic, int c = Dynamic, int _np = Dynamic>
class gcop::ASPSA< T, n, c, _np >


Constructor & Destructor Documentation

template<typename T , int n, int c, int _np>
gcop::ASPSA< T, n, c, _np >::ASPSA ( System< T, n, c, _np > &  sys,
Cost< T, n, c, _np > &  cost,
vector< double > &  ts,
vector< T > &  xs,
vector< Vectorcd > &  us,
Vectormd *  p = 0,
bool  update = true 
)

Implementing Adaptive Simultaneous Perturbation and Stochastic Approximation algorithm in GCOP library. The gains needed for the algorithms should be chosen wisely using Section 7.5.2 of Introduction to Stochastic Search and Optimization (ISSO) book.

This method minimizes the cost of a trajectory using the input parameters as us 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.

Parameters:
syssystem
costcost
ts(N+1) sequence of discrete times
xs(N+1) sequence of discrete states
us(N) sequence of control inputs
updatewhether 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::ASPSA< T, n, c, _np >::Stepcoeffs::a, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::A, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::a1, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::A1, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::alpha, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::alpha1, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::c1, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::c11, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::c2, gcop::ASPSA< T, n, c, _np >::deltaG, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::gamma, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::gamma1, gcop::ASPSA< T, n, c, _np >::ghat, gcop::ASPSA< T, n, c, _np >::ghatavg, gcop::ASPSA< T, n, c, _np >::hessian_currest, gcop::ASPSA< T, n, c, _np >::hessian_currestavg, gcop::ASPSA< T, n, c, _np >::hessian_est, gcop::ASPSA< T, n, c, _np >::hessian_estreg, gcop::ASPSA< T, n, c, _np >::J, gcop::ASPSA< T, n, c, _np >::N, gcop::ASPSA< T, n, c, _np >::Stepcoeffs::Navg, gcop::ASPSA< T, n, c, _np >::Nit, gcop::ASPSA< T, n, c, _np >::stepc, gcop::ASPSA< T, n, c, _np >::Update(), and gcop::ASPSA< T, n, c, _np >::us.

template<typename T , int n, int c, int _np>
gcop::ASPSA< T, n, c, _np >::~ASPSA ( ) [virtual]

Member Function Documentation

template<typename T , int n, int c, int _np>
void gcop::ASPSA< T, n, c, _np >::Iterate ( )

Perform one SYSTEMCE iteration.

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
double gcop::ASPSA< T, n, c, _np >::Update ( std::vector< T > &  xs,
const std::vector< Vectorcd > &  us,
bool  evalCost = true 
)

Generate a full trajectory (xs and us) from a parameter z and (optionally) return its cost

Parameters:
xstrajectory
uscontrols
evalCostwhether to compute and return the trajectory cost

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().


Member Data Documentation

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::bernoulli_distribution gcop::ASPSA< T, n, c, _np >::bernoulli_dist

Default random engine.

Bernoulli generator for getting perturbations

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
Cost<T, n, c, _np>& gcop::ASPSA< T, n, c, _np >::cost

given cost function

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
bool gcop::ASPSA< T, n, c, _np >::debug

whether to display debugging info

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::deltaG

Difference in Gradient.

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::dus1

control variation (N) vector

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::dus2

control variation (N) vector

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::ghat

Estimated gradient.

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::ghatavg

Estimated avg gradient.

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::hessian_currest

Current iterate hessian estimate.

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::hessian_currestavg

Current iterate hessian estimate after averaging.

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::hessian_est

Estimating Hessian.

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::hessian_estreg

Adding Regularizing term.

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
double gcop::ASPSA< T, n, c, _np >::J

optimal cost

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
int gcop::ASPSA< T, n, c, _np >::N

number of discrete trajectory segments

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
int gcop::ASPSA< T, n, c, _np >::Nit

Number of steps of ASPSA to complete in one Iterate function.

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
int gcop::ASPSA< T, n, c, _np >::prevcount

for now use this to propagate the count forward for every iteration

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::default_random_engine gcop::ASPSA< T, n, c, _np >::randgenerator
template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
struct gcop::ASPSA::Stepcoeffs gcop::ASPSA< T, n, c, _np >::stepc
template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
System<T, n, c, _np>& gcop::ASPSA< T, n, c, _np >::sys

dynamical system

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
float gcop::ASPSA< T, n, c, _np >::toleranceHessianmag

Tolerance for how high J can go from the current value to reject some.

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
float gcop::ASPSA< T, n, c, _np >::toleranceJ

Tolerance for how high J can go from the current value to reject some.

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<double>& gcop::ASPSA< T, n, c, _np >::ts

times (N+1) vector

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd>& gcop::ASPSA< T, n, c, _np >::us

controls (N) vector

Referenced by gcop::ASPSA< T, n, c, _np >::ASPSA().

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::uss1

controls (N) vector perturb1

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::uss2

controls (N) vector perturb2

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<Vectorcd> gcop::ASPSA< T, n, c, _np >::ustemp

control variation (N) vector

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<T>& gcop::ASPSA< T, n, c, _np >::xs

states (N+1) vector

template<typename T , int n = Dynamic, int c = Dynamic, int _np = Dynamic>
std::vector<T> gcop::ASPSA< T, n, c, _np >::xss

states (N+1) vector


The documentation for this class was generated from the following file: