@Test public void when_addingFirstExperience_expect_notAddedToStoreBeforeNextObservationIsAdded() { when(expReplayMock.getDesignatedBatchSize()).thenReturn(10); ReplayMemoryExperienceHandler sut = new ReplayMemoryExperienceHandler(expReplayMock); sut.addExperience(new Observation(Nd4j.create(new double[] { 1.0 })), 1, 1.0, false); boolean isStoreCalledAfterFirstAdd = mockingDetails(expReplayMock).getInvocations().stream().anyMatch(x -> x.getMethod().getName() == "store"); sut.addExperience(new Observation(Nd4j.create(new double[] { 2.0 })), 2, 2.0, false); boolean isStoreCalledAfterSecondAdd = mockingDetails(expReplayMock).getInvocations().stream().anyMatch(x -> x.getMethod().getName() == "store"); assertFalse(isStoreCalledAfterFirstAdd); assertTrue(isStoreCalledAfterSecondAdd); }
public void addExperience(Observation observation, A action, double reward, boolean isTerminal) { setNextObservationOnPending(observation); pendingTransition = new Transition<>(observation, action, reward, isTerminal); }
ReplayMemoryExperienceHandler implements ExperienceHandler<A, Transition<A>> { public void addExperience(Observation observation, A action, double reward, boolean isTerminal) { setNextObservationOnPending(observation); pendingTransition = new Transition<>(observation, action, reward, isTerminal); } }
ReplayMemoryExperienceHandler implements ExperienceHandler<A, Transition<A>> { public void addExperience(Observation observation, A action, double reward, boolean isTerminal) { setNextObservationOnPending(observation); pendingTransition = new Transition<>(observation, action, reward, isTerminal); } ReplayMemoryExperienceHandler(IExpReplay<A> expReplay);  ReplayMemoryExperienceHandler(Configuration configuration, Random random); }
ReplayMemoryExperienceHandler implements ExperienceHandler<A, Transition<A>> { public void addExperience(Observation observation, A action, double reward, boolean isTerminal) { setNextObservationOnPending(observation); pendingTransition = new Transition<>(observation, action, reward, isTerminal); } ReplayMemoryExperienceHandler(IExpReplay<A> expReplay);  ReplayMemoryExperienceHandler(Configuration configuration, Random random); void addExperience(Observation observation, A action, double reward, boolean isTerminal); void setFinalObservation(Observation observation); @Override int getTrainingBatchSize(); @Override boolean isTrainingBatchReady(); @Override List<Transition<A>> generateTrainingBatch(); @Override void reset(); }
ReplayMemoryExperienceHandler implements ExperienceHandler<A, Transition<A>> { public void addExperience(Observation observation, A action, double reward, boolean isTerminal) { setNextObservationOnPending(observation); pendingTransition = new Transition<>(observation, action, reward, isTerminal); } ReplayMemoryExperienceHandler(IExpReplay<A> expReplay);  ReplayMemoryExperienceHandler(Configuration configuration, Random random); void addExperience(Observation observation, A action, double reward, boolean isTerminal); void setFinalObservation(Observation observation); @Override int getTrainingBatchSize(); @Override boolean isTrainingBatchReady(); @Override List<Transition<A>> generateTrainingBatch(); @Override void reset();  }