#include <CartPole.hh>
Public Member Functions | |
virtual float | apply (int action) |
CartPole (Random &rand) | |
CartPole (Random &rand, bool stochastic) | |
experience | getExp (float s0, float s1, float s2, float s3, int a) |
virtual void | getMinMaxFeatures (std::vector< float > *minFeat, std::vector< float > *maxFeat) |
virtual void | getMinMaxReward (float *minR, float *maxR) |
virtual int | getNumActions () |
virtual std::vector< experience > | getSeedings () |
virtual void | reset () |
virtual const std::vector < float > & | sensation () const |
void | setSensation (std::vector< float > newS) |
virtual bool | terminal () const |
float | transition (float force) |
virtual | ~CartPole () |
Protected Types | |
enum | car_action_t { LEFT, RIGHT } |
Private Member Functions | |
float | reward () |
Private Attributes | |
float & | cartPos |
float & | cartVel |
float | DEG_T_RAD |
float | FORCE_MAG |
float | FOURTHIRDS |
float | GRAVITY |
float | LENGTH |
float | MASSCART |
float | MASSPOLE |
const bool | noisy |
float & | poleAngle |
float | POLEMASS_LENGTH |
float & | poleVel |
float | RAD_T_DEG |
Random & | rng |
std::vector< float > | s |
float | TAU |
float | TOTAL_MASS |
This class defines the Cart-Pole balancing domain.
Definition at line 14 of file CartPole.hh.
enum CartPole::car_action_t [protected] |
Definition at line 53 of file CartPole.hh.
CartPole::CartPole | ( | Random & | rand | ) |
Creates a deterministic CartPole domain.
rand | Random number generator used solely for random initial states. |
Definition at line 9 of file CartPole.cc.
CartPole::CartPole | ( | Random & | rand, |
bool | stochastic | ||
) |
Creates a Cart-Pole domain, possibly with noise.
rand | Random number generator |
stochastic | noisy transitions? |
Definition at line 23 of file CartPole.cc.
CartPole::~CartPole | ( | ) | [virtual] |
Definition at line 36 of file CartPole.cc.
float CartPole::apply | ( | int | action | ) | [virtual] |
Implements Environment.
Definition at line 105 of file CartPole.cc.
experience CartPole::getExp | ( | float | s0, |
float | s1, | ||
float | s2, | ||
float | s3, | ||
int | a | ||
) |
Get an experience for the given state-action
Definition at line 201 of file CartPole.cc.
void CartPole::getMinMaxFeatures | ( | std::vector< float > * | minFeat, |
std::vector< float > * | maxFeat | ||
) | [virtual] |
Implements Environment.
Definition at line 223 of file CartPole.cc.
void CartPole::getMinMaxReward | ( | float * | minR, |
float * | maxR | ||
) | [virtual] |
Implements Environment.
Definition at line 243 of file CartPole.cc.
int CartPole::getNumActions | ( | ) | [virtual] |
Implements Environment.
Definition at line 169 of file CartPole.cc.
std::vector< experience > CartPole::getSeedings | ( | ) | [virtual] |
Reimplemented from Environment.
Definition at line 184 of file CartPole.cc.
void CartPole::reset | ( | void | ) | [virtual] |
Implements Environment.
Definition at line 137 of file CartPole.cc.
float CartPole::reward | ( | ) | [private] |
Definition at line 119 of file CartPole.cc.
const std::vector< float > & CartPole::sensation | ( | ) | const [virtual] |
Implements Environment.
Definition at line 38 of file CartPole.cc.
void CartPole::setSensation | ( | std::vector< float > | newS | ) | [virtual] |
Set the state vector (for debug purposes)
Reimplemented from Environment.
Definition at line 174 of file CartPole.cc.
bool CartPole::terminal | ( | ) | const [virtual] |
Implements Environment.
Definition at line 130 of file CartPole.cc.
float CartPole::transition | ( | float | force | ) |
Calculate the new state and reward for the given force
Definition at line 45 of file CartPole.cc.
float& CartPole::cartPos [private] |
Definition at line 76 of file CartPole.hh.
float& CartPole::cartVel [private] |
Definition at line 77 of file CartPole.hh.
float CartPole::DEG_T_RAD [private] |
Definition at line 68 of file CartPole.hh.
float CartPole::FORCE_MAG [private] |
Definition at line 64 of file CartPole.hh.
float CartPole::FOURTHIRDS [private] |
Definition at line 67 of file CartPole.hh.
float CartPole::GRAVITY [private] |
Definition at line 57 of file CartPole.hh.
float CartPole::LENGTH [private] |
Definition at line 61 of file CartPole.hh.
float CartPole::MASSCART [private] |
Definition at line 58 of file CartPole.hh.
float CartPole::MASSPOLE [private] |
Definition at line 59 of file CartPole.hh.
const bool CartPole::noisy [private] |
Definition at line 71 of file CartPole.hh.
float& CartPole::poleAngle [private] |
Definition at line 78 of file CartPole.hh.
float CartPole::POLEMASS_LENGTH [private] |
Definition at line 63 of file CartPole.hh.
float& CartPole::poleVel [private] |
Definition at line 79 of file CartPole.hh.
float CartPole::RAD_T_DEG [private] |
Definition at line 69 of file CartPole.hh.
Random& CartPole::rng [private] |
Definition at line 72 of file CartPole.hh.
std::vector<float> CartPole::s [private] |
Definition at line 74 of file CartPole.hh.
float CartPole::TAU [private] |
Definition at line 65 of file CartPole.hh.
float CartPole::TOTAL_MASS [private] |
Definition at line 60 of file CartPole.hh.