Package ai.djl.modality.rl.env
Interface RlEnv
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface RlEnv extends java.lang.AutoCloseable
An environment to use for reinforcement learning.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
RlEnv.Step
A record of taking a step in the environment.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
close()
ActionSpace
getActionSpace()
Returns the current actions that can be taken in the environment.RlEnv.Step[]
getBatch()
Returns a batch of steps from the environmentReplayBuffer
.NDList
getObservation()
Returns the observation detailing the current state of the environment.void
reset()
Resets the environment to it's default state.default float
runEnvironment(RlAgent agent, boolean training)
Runs the environment from reset until done.RlEnv.Step
step(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.Step
with 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:
close
in interfacejava.lang.AutoCloseable
-
-