ROOT
- root model agent typeO
- Observation data structure type, see getObservation(Agent, Object)
A
- Action data structure type, see applyAction(Agent, Object)
C
- Configuration data structure type, see applyConfiguration(Agent, Object)
public abstract class ExperimentReinforcementLearning<ROOT extends Agent,O,A,C> extends ExperimentCustom implements ReinforcementLearningModel<ROOT,O,A,C>, LearningAgentModelInterface<ROOT>
applyConfiguration(Agent, Object)
true
, the Learning Platform will be notified about Episode termination condition)getObservation(Agent, Object)
applyAction(Agent, Object)
ExperimentReinforcementLearning.takeAction( this );
,
where this
is an existing agent containing the event.Constructor and Description |
---|
ExperimentReinforcementLearning() |
ExperimentReinforcementLearning(LearningAgentInterface<O,A,C> learningAgentInterface) |
Modifier and Type | Method and Description |
---|---|
abstract void |
applyAction(ROOT root,
A action)
This method must be defined in a subclass to get the data from the given
action object and
apply it to the model (root ). |
abstract void |
applyConfiguration(ROOT root,
C configuration)
This method must be defined in a subclass to get the data from the given
configuration object and
apply it as the initial setup to the model (root ). |
boolean |
checkEpisodeStopCondition(ROOT root)
This method may be defined in a subclass to check the additional stop condition of the Episode.
|
abstract A |
createAction()
This method must be defined in a subclass - just to create new empty Action object
|
abstract C |
createConfiguration()
This method must be defined in a subclass - just to create new empty Configuration object
|
ROOT |
createModel()
Is called to obtain a new pre-initialized top-level agent.
|
abstract O |
createObservation()
This method must be defined in a subclass - just to create new empty Observation object
|
abstract ROOT |
createRoot(Engine engine)
Is called to obtain a new top-level agent.
|
java.util.Date |
date()
Returns the current model date with respect to the start time/date and the
model time unit.
|
abstract void |
getObservation(ROOT root,
O observation)
This method must be defined in a subclass to get the data from
root and write it to the fields of the given observation . |
void |
initDefaultRandomNumberGenerator(Engine engine)
This method should be overridden to initialize random number generator of the given engine
Default implementation set new random generation with random seed - for unique experiments |
void |
run()
|
static void |
takeAction(Agent agent)
This method should be called from the user event associated with the experiment step to be performed.
|
void |
takeActionForModel(ROOT root)
This method is internal and shouldn't be called by user.
|
double |
time()
Returns the current model (logical) time.
|
double |
time(TimeUnits units)
Returns the current model (logical) time.
|
createEngine, getCommandLineArguments, onError, onError, setCommandLineArguments_xjal, setupEngine_xjal
public ExperimentReinforcementLearning()
public ExperimentReinforcementLearning(LearningAgentInterface<O,A,C> learningAgentInterface)
@AnyLogicInternalCodegenAPI public abstract ROOT createRoot(Engine engine)
engine
- the simulation engine that will simulate the model@AnyLogicInternalCodegenAPI public abstract O createObservation()
createObservation
in interface ReinforcementLearningModel<ROOT extends Agent,O,A,C>
@AnyLogicInternalCodegenAPI public abstract A createAction()
createAction
in interface ReinforcementLearningModel<ROOT extends Agent,O,A,C>
@AnyLogicInternalCodegenAPI public abstract C createConfiguration()
createConfiguration
in interface ReinforcementLearningModel<ROOT extends Agent,O,A,C>
@AnyLogicInternalCodegenAPI public abstract void applyConfiguration(ROOT root, C configuration)
configuration
object and
apply it as the initial setup to the model (root
).applyConfiguration
in interface ReinforcementLearningModel<ROOT extends Agent,O,A,C>
root
- the root model agentaction
- data structure, coming from the Reinforcement Learning platform and then applied to the model@AnyLogicInternalCodegenAPI public boolean checkEpisodeStopCondition(ROOT root)
true
to request stopping the Episode (e.g. when the model falls into some
undesired terminal state which doesn't allow further training or testing of Learning Agent).checkEpisodeStopCondition
in interface ReinforcementLearningModel<ROOT extends Agent,O,A,C>
true
to stop the model, false
to continue learning/simulation loop@AnyLogicInternalCodegenAPI public abstract void getObservation(ROOT root, O observation)
root
and write it to the fields of the given observation
.getObservation
in interface ReinforcementLearningModel<ROOT extends Agent,O,A,C>
root
- the root model agentobservation
- data structure, to be filled from the simulation model and then sent to the Learning Agent (AI)@AnyLogicInternalCodegenAPI public abstract void applyAction(ROOT root, A action)
action
object and
apply it to the model (root
).applyAction
in interface ReinforcementLearningModel<ROOT extends Agent,O,A,C>
root
- the root model agentaction
- data structure, coming from the Learning Agent (AI) and then applied to the model@AnyLogicInternalCodegenAPI public void initDefaultRandomNumberGenerator(Engine engine)
engine
- the engine instancepublic ROOT createModel()
ReinforcementLearningModel
createModel
in interface ReinforcementLearningModel<ROOT extends Agent,O,A,C>
public void run()
ExperimentCustom
run
in class ExperimentCustom
@AnyLogicInternalAPI public void takeActionForModel(ROOT root)
LearningAgentModelInterface
takeActionForModel
in interface LearningAgentModelInterface<ROOT extends Agent>
public static void takeAction(Agent agent)
ExperimentReinforcementLearning.takeAction( this );
.agent
' argument with the Main model agent ('root'),
forcing all RL-related data processing (such as retrieving the observation data) to be done in the context of this agent.agent
- any existing agentpublic double time()
public double time(TimeUnits units)
units
- the time unitspublic java.util.Date date()
Copyright © AnyLogic North America, LLC. All Rights Reserved.