CEnvironmentModel Class Reference
The environment in which
the agent can act. More...
#include <cenvironmentmodel.h>
Inheritance diagram for CEnvironmentModel:
List of all
members.
Detailed Description
The environment in which the agent can act.
The class CEnvironmentModel represents the Environment of the
agent. The environment manages the internal state of the agent. The
agent tells the environment which primitive action to execute
(nextState(...)), and the environment changes its internal states
depending on the action. How the internal state is represented in
the environment can be choosen freely by the programmer. The agent
can always fetch the current internal State of the environment,
normally this is done every time after an action has been executed.
We will call the state comming from the model "model state". This
state should contain any information you have about your current
internal state, no matter how much information that is. The model
state is anyway usually not used for learning, so you don't have to
look after the dimensionality of your model state. The most
relevant functions for the user are doNextState, getState and
doResetModel.
- The doNextState(CPrimitiveAction
*): Here you have to add the internal state transitions of the
model. To get further access to the specified action you have to
cast the primitve action object to your own action class.
Attention: Always use dynamic_cast for this cast!! For more details
see the description of CPrimitiveAction. To indicate
that the model has to be reseted after this step you have to set
the reset flag, to indicate that the episode failed, you set the
failed flag. If failed is set, reset gets automatically set by the
nextState method.
- The getState(CState *state)
function allows the agent to fetch the current state. The internal
state variables has to be written in the "state" object.
- doResetModel(): This
function is called every time the agent wants to start a new
episode. Here the user should reset the internal model variables
(for example to a fixed start place or to random values). The state
properties of the environment object is created at the beginning
with the parameters comming from the constuctor and is refered as
the model state. Always use the properties of the model if you need
the model state from a state collection. When the agent wants to
execute an action, it calles nextState. This methods calles again
the user-interface doNextState. If after the call failed is set,
reset gets set too. If reset is set before the call of doNextState
the model gets reseted (by calling resetModel()) and the
reset and failed flag are resetted, so you don't have to care about
the handling of the flags except if an episode has failed or has to
be resetted.
Constructor & Destructor Documentation
|
CEnvironmentModel::CEnvironmentModel
|
( |
CStateProperties *
|
properties |
) |
[protected] |
|
| |
protected constructor, only for subclasses
|
|
CEnvironmentModel::CEnvironmentModel
|
( |
int |
continuousStates,
|
|
|
int |
discreteStates |
|
) |
|
|
| |
Creates an Environment Model with a new properties object. The
properties object is created with the parameters given to the
constructor.
- Parameters:
-
|
continuousStates
|
Number of continuous states of the model state |
|
discreteStates
|
Number of discrete states of the model
state
|
|
| virtual
CEnvironmentModel::~CEnvironmentModel
|
( |
|
) |
[virtual] |
|
Member Function Documentation
| virtual void
CEnvironmentModel::doNextState
|
( |
CPrimitiveAction *
|
action |
) |
[protected, pure
virtual] |
|
| |
The doNextState(CPrimitiveActionFunction) function is invoked by
the nextState function which is again called by the agent. Here you
have to add the internal state transitions of the model. To
indicate that the model has to be reseted after this step you have
to set the reset flag, to indicate that the episode failed, you set
the failed flag. If failed is set, reset gets automatically set by
the nextState method.
Implemented in CStoredEpisodeModel,
CMultiPoleModel, and
CTransitionFunctionEnvironment.
|
| virtual void
CEnvironmentModel::doResetModel
|
( |
|
) |
[inline, protected,
virtual] |
|
| |
The getState(CStateCollection *stateCol) function enables the
environment to add more than one state to the agents state
collection. Per default this function only calls the getState(CState *)
function with the model-state object from the state-collection as
variable, so the model-state of the collection is always up to
date. It also tells the statecollection that there is a new
modelstate, so the collection marks all modified states as
obsolete, so that they have to be calculated again, once
needed.
Reimplemented in CStoredEpisodeModel.
|
| virtual void
CEnvironmentModel::getState
|
( |
CState *
|
state |
) |
[virtual] |
|
| bool
CEnvironmentModel::isFailed
|
( |
|
) |
[inline] |
|
| bool
CEnvironmentModel::isReset
|
( |
|
) |
[inline] |
|
| virtual void
CEnvironmentModel::nextState
|
( |
CPrimitiveAction *
|
action |
) |
[virtual] |
|
| |
called by agent to execute the next action
It just calles the method doNextState. If after the call failed
is set, reset gets set too. If reset is set before the call of
doNextState the model gets reseted (by calling resetModel())
|
| virtual void
CEnvironmentModel::resetModel
|
( |
|
) |
[virtual] |
|
| |
called by agent to reset the model
The function only calls the model-specific function
doResetModel() and resets
the flags reset and failed to false.
|
Member Data Documentation
The documentation for this class was generated from the following
file:
|