CAgentLogger Class Reference
Class
for logging a whole training trial. More...
#include <cagentlogger.h>
Inheritance diagram for CAgentLogger:
List of all members.
|
Public Member Functions
|
|
|
CAgentLogger (CStateProperties *model,
CActionSet
*actions, char
*autoSavefile, int holdMemory)
|
| |
Creates an agent logger and sets the
autosave file.
|
|
|
CAgentLogger (CStateProperties *model,
CActionSet
*actions)
|
| |
Creates an agent logger with no autosave
file and all episodes held in memory.
|
|
|
CAgentLogger (char *loadFile,
CStateProperties *model,
CActionSet
*actions,
std::list< CStateModifier * >
*modifiers)
|
| |
Loads an training trial from a binary file.
The modifiers must be the same as the modifiers used when the trial
was saved.
|
|
virtual
|
~CAgentLogger ()
|
|
virtual void
|
nextStep (CStateCollection *oldState,
CAction *action,
CStateCollection
*nextState)
|
| |
Stores the step in the current episode.
|
|
virtual void
|
newEpisode ()
|
| |
Stores the current Episode in the episode
list and creates a new current Episode object.
|
|
void
|
setAutoSaveFile (char
*filename)
|
| |
sets auto save file, if set to NULL no auto
save file is used
|
|
virtual void
|
saveBIN (FILE
*stream)
|
| |
saves the whole trial to a binary file
|
|
virtual void
|
saveData (FILE
*stream)
|
| |
saves the whole trial to a text file
|
|
void
|
loadBIN (FILE *stream,
std::list< CStateModifier * >
*modifiers, int
episodes=-1)
|
| |
loads a training trial from a binary file
|
|
virtual void
|
loadData (FILE *stream, int
episodes=-1)
|
| |
loads a training trial from a text file
|
|
virtual void
|
loadData (FILE
*stream)
|
|
virtual int
|
getNumEpisodes ()
|
| |
returns number of Episodes in the episode
list (so exclusive the current Episode)
|
|
virtual void
|
addStateModifier
(CStateModifier
*modifier)
|
| |
adds a state modifier to the current episode
object.
|
|
virtual void
|
removeStateModifier
(CStateModifier
*modifier)
|
| |
removes a state modifier to the current
episode object.
|
|
virtual CEpisode
*
|
getCurrentEpisode
()
|
| |
returns a pointer to the current episode.
|
|
virtual CEpisode
*
|
getEpisode (int
index)
|
| |
returns the index th episode.
|
|
void
|
clearAutoSaveFile
()
|
| |
clears the autosave file
|
|
void
|
setLoadDataFile (char
*loadData, std::list< CStateModifier * >
*modifiers=NULL)
|
|
virtual void
|
resetData ()
|
| |
Removes all Episodes from memory.
|
Protected Member Functions
|
|
void
|
init ()
|
Protected Attributes
|
|
char
|
filename [512]
|
| |
autosave file name
|
|
FILE *
|
file |
| |
autosave file
|
|
char
|
loadFileName [512]
|
|
std::list< CStateModifier * >
*
|
loadModifiers |
|
int
|
holdMemory |
| |
number of episodes to hold in memory, if set
to -1 all episodes are held in memory
|
|
std::list< CEpisode
* > *
|
episodes |
| |
list of the episodes
|
|
CEpisode *
|
currentEpisode |
| |
pointer to the currentepisode
|
Detailed Description
Class for logging a whole training trial.
The agent logger (CAgentLogger) objects can store whole training
trials. CAgentLogger is a subclass of CSemiMDPListener in order to
get the data from the agent. The agent logger uses a list of
episode objects, so you can retrieve whole episodes from the
logger. The curent episode isn't in that list and can only be
referenced by the method getCurrentEpisode. From the episodes you
can again retrieve the single states. You can set an auto-save file
where every Episode gets saved automatically when it is finished.
You can also set the number of episodes the logger should hold in
memory (both parameters are set in the contructor). If the episodes
exceeds that number, the oldest episodes get discarded. holdMemory
of -1 means that all episodes are hold in the memory.
The Agentlogger stores only those states which's state modifier
objects (i.e. the properties) are in the state modifier list of the
logger.
- See also:
- CEpisode
Constructor & Destructor Documentation
| |
Creates an agent logger and sets the autosave
file.
|
| |
Creates an agent logger with no autosave file and all episodes
held in memory.
|
| |
Loads an training trial from a binary file. The modifiers must
be the same as the modifiers used when the trial was
saved.
|
| virtual
CAgentLogger::~CAgentLogger
|
( |
|
) |
[virtual] |
|
Member Function Documentation
| virtual void
CAgentLogger::addStateModifier
|
( |
CStateModifier *
|
modifier |
) |
[virtual] |
|
| void
CAgentLogger::clearAutoSaveFile
|
( |
|
) |
|
|
| virtual CEpisode*
CAgentLogger::getCurrentEpisode
|
( |
|
) |
[virtual] |
|
| |
returns a pointer to the current episode.
|
| virtual CEpisode*
CAgentLogger::getEpisode
|
( |
int |
index |
) |
[virtual] |
|
| virtual int
CAgentLogger::getNumEpisodes
|
( |
|
) |
[virtual] |
|
| |
returns number of Episodes in the episode list (so exclusive the
current Episode)
Implements CEpisodeHistory.
|
| void
CAgentLogger::init
|
( |
|
) |
[protected] |
|
| void
CAgentLogger::loadBIN
|
( |
FILE * |
stream,
|
|
|
std::list< CStateModifier * >
*
|
modifiers,
|
|
|
int |
episodes =
-1 |
|
) |
|
|
| |
loads a training trial from a binary file
if episodes is set to a value greater 0, only the first
"episode" episodes are loaded
|
| virtual void
CAgentLogger::loadData
|
( |
FILE * |
stream |
) |
[virtual] |
|
| virtual void
CAgentLogger::loadData
|
( |
FILE * |
stream,
|
|
|
int |
episodes =
-1 |
|
) |
[virtual] |
|
| |
loads a training trial from a text file
if episodes is set to a value greater 0, only the first
"episode" episodes are loaded
|
| virtual void
CAgentLogger::newEpisode
|
( |
|
) |
[virtual] |
|
| |
Stores the current Episode in the episode list and creates a new
current Episode object.
Reimplemented from CSemiMDPListener.
|
| virtual void
CAgentLogger::removeStateModifier
|
( |
CStateModifier *
|
modifier |
) |
[virtual] |
|
| virtual void
CAgentLogger::resetData
|
( |
|
) |
[virtual] |
|
| virtual void
CAgentLogger::saveBIN
|
( |
FILE * |
stream |
) |
[virtual] |
|
| |
saves the whole trial to a binary file
|
| virtual void
CAgentLogger::saveData
|
( |
FILE * |
stream |
) |
[virtual] |
|
| void
CAgentLogger::setAutoSaveFile
|
( |
char * |
filename |
) |
|
|
| |
sets auto save file, if set to NULL no auto save file is
used
|
| void
CAgentLogger::setLoadDataFile
|
( |
char * |
loadData,
|
|
|
std::list< CStateModifier * >
*
|
modifiers =
NULL |
|
) |
|
|
Member Data Documentation
| |
pointer to the currentepisode
|
| |
number of episodes to hold in memory, if set to -1 all episodes
are held in memory
|
The documentation for this class was generated from the following
file:
|