#include <tworooms.hh>
Public Member Functions | |
virtual float | apply (int action) |
experience | getExp (float s0, float s1, 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 |
virtual bool | terminal () const |
TwoRooms (Random &rand, bool stochastic, bool rewardType, int actDelay, bool multiGoal) | |
virtual | ~TwoRooms () |
Protected Types | |
typedef std::pair< float, float > | coord_t |
enum | room_action_t { NORTH, SOUTH, EAST, WEST } |
Private Member Functions | |
room_action_t | add_noise (room_action_t action) |
const Gridworld * | create_default_map () |
void | randomize_goal () |
float | reward () |
Private Attributes | |
const int | actDelay |
std::deque< int > | actHistory |
coord_t | doorway |
float & | ew |
coord_t | goal |
coord_t | goal2 |
const Gridworld *const | grid |
const bool | multiGoal |
const bool | negReward |
const bool | noisy |
float & | ns |
Random & | rng |
std::vector< float > | s |
bool | useGoal2 |
This class defines a two room gridworld domain. It can optionally be stochastic, have action delays, or multiple goals (with partial observability).
Definition at line 20 of file tworooms.hh.
typedef std::pair<float,float> TwoRooms::coord_t [protected] |
Definition at line 50 of file tworooms.hh.
enum TwoRooms::room_action_t [protected] |
Definition at line 51 of file tworooms.hh.
TwoRooms::TwoRooms | ( | Random & | rand, |
bool | stochastic, | ||
bool | rewardType, | ||
int | actDelay, | ||
bool | multiGoal | ||
) |
Standard Constructor
rand | Random Number generator |
stochastic | Make the domain stochastic |
rewardType | Create -1 per step and 0 on termination (vs 0 and 1) |
actDelay | # of steps to delay actions |
multiGoal | create mulitple goals that are randomly selected from each episode |
Definition at line 10 of file tworooms.cc.
TwoRooms::~TwoRooms | ( | ) | [virtual] |
Definition at line 29 of file tworooms.cc.
TwoRooms::room_action_t TwoRooms::add_noise | ( | room_action_t | action | ) | [private] |
Corrupts a movement action.
action | The intended action |
Definition at line 186 of file tworooms.cc.
float TwoRooms::apply | ( | int | action | ) | [virtual] |
Implements Environment.
Definition at line 37 of file tworooms.cc.
const Gridworld * TwoRooms::create_default_map | ( | ) | [private] |
Create default two room gridworld
Definition at line 162 of file tworooms.cc.
experience TwoRooms::getExp | ( | float | s0, |
float | s1, | ||
int | a | ||
) |
Create an experience tuple for the given state-action.
Definition at line 263 of file tworooms.cc.
void TwoRooms::getMinMaxFeatures | ( | std::vector< float > * | minFeat, |
std::vector< float > * | maxFeat | ||
) | [virtual] |
Implements Environment.
Definition at line 207 of file tworooms.cc.
void TwoRooms::getMinMaxReward | ( | float * | minR, |
float * | maxR | ||
) | [virtual] |
Implements Environment.
Definition at line 217 of file tworooms.cc.
int TwoRooms::getNumActions | ( | ) | [virtual] |
Implements Environment.
Definition at line 157 of file tworooms.cc.
std::vector< experience > TwoRooms::getSeedings | ( | ) | [virtual] |
Reimplemented from Environment.
Definition at line 229 of file tworooms.cc.
void TwoRooms::randomize_goal | ( | ) | [private] |
Randomly assigns the goal to any random position in the world.
Definition at line 200 of file tworooms.cc.
void TwoRooms::reset | ( | void | ) | [virtual] |
Implements Environment.
Definition at line 134 of file tworooms.cc.
float TwoRooms::reward | ( | ) | [private] |
Return the correct reward based on the current state.
Definition at line 97 of file tworooms.cc.
const std::vector< float > & TwoRooms::sensation | ( | ) | const [virtual] |
Implements Environment.
Definition at line 31 of file tworooms.cc.
bool TwoRooms::terminal | ( | ) | const [virtual] |
Implements Environment.
Definition at line 125 of file tworooms.cc.
const int TwoRooms::actDelay [private] |
Definition at line 62 of file tworooms.hh.
std::deque<int> TwoRooms::actHistory [private] |
Definition at line 57 of file tworooms.hh.
coord_t TwoRooms::doorway [private] |
Definition at line 67 of file tworooms.hh.
float& TwoRooms::ew [private] |
Definition at line 72 of file tworooms.hh.
coord_t TwoRooms::goal [private] |
Definition at line 55 of file tworooms.hh.
coord_t TwoRooms::goal2 [private] |
Definition at line 56 of file tworooms.hh.
const Gridworld* const TwoRooms::grid [private] |
Definition at line 54 of file tworooms.hh.
const bool TwoRooms::multiGoal [private] |
Definition at line 63 of file tworooms.hh.
const bool TwoRooms::negReward [private] |
Definition at line 60 of file tworooms.hh.
const bool TwoRooms::noisy [private] |
Definition at line 61 of file tworooms.hh.
float& TwoRooms::ns [private] |
Definition at line 71 of file tworooms.hh.
Random& TwoRooms::rng [private] |
Definition at line 65 of file tworooms.hh.
std::vector<float> TwoRooms::s [private] |
Definition at line 69 of file tworooms.hh.
bool TwoRooms::useGoal2 [private] |
Definition at line 58 of file tworooms.hh.