Package ai.djl.modality.rl.env
Interface RlEnv
- All Superinterfaces:
AutoCloseable
An environment to use for reinforcement learning.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA record of taking a step in the environment. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the current actions that can be taken in the environment.getBatch()Returns a batch of steps from the environmentReplayBuffer.Returns the observation detailing the current state of the environment.voidreset()Resets the environment to it's default state.default floatrunEnvironment(RlAgent agent, boolean training) Runs the environment from reset until done.Takes a step by performing an action in this environment.
-
Method Details
-
reset
void reset()Resets the environment to it's default state. -
getObservation
NDList getObservation()Returns the observation detailing the current state of the environment.- Returns:
- the observation detailing the current state of the environment
-
getActionSpace
ActionSpace getActionSpace()Returns the current actions that can be taken in the environment.- Returns:
- the current actions that can be taken in the environment
-
step
Takes a step by performing an action in this environment.- Parameters:
action- the action to performtraining- true if the step is during training- Returns:
- the
RlEnv.Stepwith the result of the action
-
runEnvironment
Runs the environment from reset until done.- Parameters:
agent- the agent to choose the actions withtraining- true to run while training. When training, the steps will be recorded- Returns:
- the total reward
-
getBatch
RlEnv.Step[] getBatch()Returns a batch of steps from the environmentReplayBuffer.- Returns:
- a batch of steps from the environment
ReplayBuffer
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-