Package ai.djl.modality.rl.env
Interface RlEnv
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface RlEnv extends java.lang.AutoCloseableAn environment to use for reinforcement learning.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceRlEnv.StepA record of taking a step in the environment.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()ActionSpacegetActionSpace()Returns the current actions that can be taken in the environment.RlEnv.Step[]getBatch()Returns a batch of steps from the environmentReplayBuffer.NDListgetObservation()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.RlEnv.Stepstep(NDList action, boolean training)Takes a step by performing an action in this environment.
-
-
-
Method Detail
-
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
RlEnv.Step step(NDList action, boolean training)
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
default float runEnvironment(RlAgent agent, boolean training)
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 interfacejava.lang.AutoCloseable
-
-