Class LruReplayBuffer

  • All Implemented Interfaces:
    ReplayBuffer

    public class LruReplayBuffer
    extends java.lang.Object
    implements ReplayBuffer
    A simple ReplayBuffer that randomly selects across the whole buffer, but always removes the oldest items in the buffer once it is full.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addStep​(RlEnv.Step step)
      Adds a new step to the buffer.
      RlEnv.Step[] getBatch()
      Returns a batch of steps from this buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LruReplayBuffer

        public LruReplayBuffer​(int batchSize,
                               int bufferSize)
        Constructs a LruReplayBuffer.
        Parameters:
        batchSize - the number of steps to train on per batch
        bufferSize - the number of steps to hold in the buffer
    • Method Detail

      • getBatch

        public RlEnv.Step[] getBatch()
        Returns a batch of steps from this buffer.
        Specified by:
        getBatch in interface ReplayBuffer
        Returns:
        a batch of steps from this buffer
      • addStep

        public void addStep​(RlEnv.Step step)
        Adds a new step to the buffer.
        Specified by:
        addStep in interface ReplayBuffer
        Parameters:
        step - the step to add