Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes
PrioritizedSweeping Class Reference

#include <PrioritizedSweeping.hh>

Inheritance diagram for PrioritizedSweeping:
Inheritance graph
[legend]

List of all members.

Classes

struct  saqPair
struct  state_info

Public Types

typedef const std::vector
< float > * 
state_t

Public Member Functions

virtual int getBestAction (const std::vector< float > &s)
virtual void planOnNewModel ()
 PrioritizedSweeping (int numactions, float gamma, float MAX_TIME, bool onlyAddLastSA, int modelType, const std::vector< float > &featmax, const std::vector< float > &featmin, Random rng=Random())
 PrioritizedSweeping (const PrioritizedSweeping &)
virtual void setModel (MDPModel *model)
virtual bool updateModelWithExperience (const std::vector< float > &last, int act, const std::vector< float > &curr, float reward, bool term)
virtual ~PrioritizedSweeping ()

Public Attributes

bool ACTDEBUG
bool LISTDEBUG
MDPModelmodel
bool MODELDEBUG
bool PLANNERDEBUG
bool POLICYDEBUG

Protected Member Functions

void addSAToList (const std::vector< float > &s, int act, float q)
state_t canonicalize (const std::vector< float > &s)
void createPolicy ()
void deleteInfo (state_info *info)
double getSeconds ()
void initNewState (state_t s)
void initStateInfo (state_info *info)
void printStates ()
bool saqPairMatch (saqPair a, saqPair b)
void updatePriorityList (state_info *info, const std::vector< float > &next)
float updateQValues (const std::vector< float > &state, int act)
void updateStateActionFromModel (const std::vector< float > &state, int a)
void updateStatesFromModel ()

Private Attributes

std::vector< float > featmax
std::vector< float > featmin
const float gamma
int lastModelUpdate
int MAX_STEPS
const float MAX_TIME
const int modelType
int nactions
int nstates
const int numactions
const bool onlyAddLastSA
double planTime
int prevact
std::vector< float > prevstate
std::list< saqPairpriorityList
std::map< state_t, state_infostatedata
std::set< std::vector< float > > statespace
bool timingType

Detailed Description

Definition at line 12 of file PrioritizedSweeping.hh.


Member Typedef Documentation

typedef const std::vector<float>* PrioritizedSweeping::state_t

The implementation maps all sensations to a set of canonical pointers, which serve as the internal representation of environment state.

Definition at line 18 of file PrioritizedSweeping.hh.


Constructor & Destructor Documentation

PrioritizedSweeping::PrioritizedSweeping ( int  numactions,
float  gamma,
float  MAX_TIME,
bool  onlyAddLastSA,
int  modelType,
const std::vector< float > &  featmax,
const std::vector< float > &  featmin,
Random  rng = Random() 
)

Standard constructor

Parameters:
numactions,numactionsin the domain
gammadiscount factor
rngrandom

Definition at line 8 of file PrioritizedSweeping.cc.

Unimplemented copy constructor: internal state cannot be simply copied.

Definition at line 41 of file PrioritizedSweeping.cc.


Member Function Documentation

void PrioritizedSweeping::addSAToList ( const std::vector< float > &  s,
int  act,
float  q 
) [protected]

Definition at line 692 of file PrioritizedSweeping.cc.

PrioritizedSweeping::state_t PrioritizedSweeping::canonicalize ( const std::vector< float > &  s) [protected]

Produces a canonical representation of the given sensation.

Parameters:
sThe current sensation from the environment.
Returns:
A pointer to an equivalent state in statespace.

Definition at line 235 of file PrioritizedSweeping.cc.

void PrioritizedSweeping::createPolicy ( ) [protected]

Create policy through prioritized sweeping.

Definition at line 359 of file PrioritizedSweeping.cc.

void PrioritizedSweeping::deleteInfo ( state_info info) [protected]

Definition at line 343 of file PrioritizedSweeping.cc.

int PrioritizedSweeping::getBestAction ( const std::vector< float > &  state) [virtual]

Choose the next action

Implements Planner.

Definition at line 157 of file PrioritizedSweeping.cc.

double PrioritizedSweeping::getSeconds ( ) [protected]

Definition at line 350 of file PrioritizedSweeping.cc.

void PrioritizedSweeping::initNewState ( state_t  s) [protected]

Definition at line 55 of file PrioritizedSweeping.cc.

void PrioritizedSweeping::initStateInfo ( state_info info) [protected]

Definition at line 258 of file PrioritizedSweeping.cc.

Implements Planner.

Definition at line 195 of file PrioritizedSweeping.cc.

void PrioritizedSweeping::printStates ( ) [protected]

Print state info for debugging.

Definition at line 284 of file PrioritizedSweeping.cc.

Definition at line 532 of file PrioritizedSweeping.cc.

void PrioritizedSweeping::setModel ( MDPModel model) [virtual]

Implements Planner.

Definition at line 43 of file PrioritizedSweeping.cc.

bool PrioritizedSweeping::updateModelWithExperience ( const std::vector< float > &  laststate,
int  lastact,
const std::vector< float > &  currstate,
float  reward,
bool  term 
) [virtual]

Use the latest experience to update state info and the model.

Implements Planner.

Definition at line 83 of file PrioritizedSweeping.cc.

void PrioritizedSweeping::updatePriorityList ( state_info info,
const std::vector< float > &  next 
) [protected]

Definition at line 435 of file PrioritizedSweeping.cc.

float PrioritizedSweeping::updateQValues ( const std::vector< float > &  state,
int  act 
) [protected]

Definition at line 546 of file PrioritizedSweeping.cc.

void PrioritizedSweeping::updateStateActionFromModel ( const std::vector< float > &  state,
int  a 
) [protected]

Update a single state-action from the model

Definition at line 715 of file PrioritizedSweeping.cc.

Update our state info's from the model by calling the model function

Definition at line 138 of file PrioritizedSweeping.cc.


Member Data Documentation

Definition at line 49 of file PrioritizedSweeping.hh.

std::vector<float> PrioritizedSweeping::featmax [private]

Definition at line 135 of file PrioritizedSweeping.hh.

std::vector<float> PrioritizedSweeping::featmin [private]

Definition at line 136 of file PrioritizedSweeping.hh.

const float PrioritizedSweeping::gamma [private]

Definition at line 150 of file PrioritizedSweeping.hh.

Definition at line 144 of file PrioritizedSweeping.hh.

Definition at line 50 of file PrioritizedSweeping.hh.

Definition at line 146 of file PrioritizedSweeping.hh.

const float PrioritizedSweeping::MAX_TIME [private]

Definition at line 151 of file PrioritizedSweeping.hh.

Model that we're using

Definition at line 53 of file PrioritizedSweeping.hh.

Definition at line 48 of file PrioritizedSweeping.hh.

const int PrioritizedSweeping::modelType [private]

Definition at line 153 of file PrioritizedSweeping.hh.

Definition at line 143 of file PrioritizedSweeping.hh.

Definition at line 142 of file PrioritizedSweeping.hh.

const int PrioritizedSweeping::numactions [private]

Definition at line 149 of file PrioritizedSweeping.hh.

Definition at line 152 of file PrioritizedSweeping.hh.

Definition at line 46 of file PrioritizedSweeping.hh.

Definition at line 141 of file PrioritizedSweeping.hh.

Definition at line 47 of file PrioritizedSweeping.hh.

Definition at line 139 of file PrioritizedSweeping.hh.

std::vector<float> PrioritizedSweeping::prevstate [private]

Definition at line 138 of file PrioritizedSweeping.hh.

priority list for prioritized sweeping

Definition at line 133 of file PrioritizedSweeping.hh.

Hashmap mapping state vectors to their state_info structs.

Definition at line 130 of file PrioritizedSweeping.hh.

std::set<std::vector<float> > PrioritizedSweeping::statespace [private]

Set of all distinct sensations seen. Pointers to elements of this set serve as the internal representation of the environment state.

Definition at line 127 of file PrioritizedSweeping.hh.

Definition at line 147 of file PrioritizedSweeping.hh.


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


rl_agent
Author(s): Todd Hester
autogenerated on Thu Jun 6 2019 22:00:14