@Test public void when_episodeIsStarted_expect_learningBehaviorHandleEpisodeStartCalled() { AgentLearner.Configuration configuration = AgentLearner.Configuration.builder() .maxEpisodeSteps(3) .build(); AgentLearner<Integer> sut = new AgentLearner(environmentMock, transformProcessMock, policyMock, configuration, null, learningBehaviorMock); Schema schema = new Schema(new IntegerActionSchema(0, -1)); when(environmentMock.reset()).thenReturn(new HashMap<>()); when(environmentMock.getSchema()).thenReturn(schema); StepResult stepResult = new StepResult(new HashMap<>(), 234.0, false); when(environmentMock.step(any(Integer.class))).thenReturn(stepResult); when(transformProcessMock.transform(any(Map.class), anyInt(), anyBoolean())).thenReturn(new Observation(Nd4j.create(new double[] { 123.0 }))); when(policyMock.nextAction(any(Observation.class))).thenReturn(123); sut.run(); verify(learningBehaviorMock, times(1)).handleEpisodeStart(); }
@Override protected void reset() { super.reset(); rewardAtLastExperience = 0; }
AgentLearner extends Agent<ACTION> implements IAgentLearner<ACTION> { @Override protected void reset() { super.reset(); rewardAtLastExperience = 0; } }
AgentLearner extends Agent<ACTION> implements IAgentLearner<ACTION> { @Override protected void reset() { super.reset(); rewardAtLastExperience = 0; } AgentLearner(Environment<ACTION> environment,
                        TransformProcess transformProcess,
                        IPolicy<ACTION> policy,
                        Configuration configuration,
                        String id,
                        @NonNull ILearningBehavior<ACTION> learningBehavior); }
AgentLearner extends Agent<ACTION> implements IAgentLearner<ACTION> { @Override protected void reset() { super.reset(); rewardAtLastExperience = 0; } AgentLearner(Environment<ACTION> environment,
                        TransformProcess transformProcess,
                        IPolicy<ACTION> policy,
                        Configuration configuration,
                        String id,
                        @NonNull ILearningBehavior<ACTION> learningBehavior);  }
AgentLearner extends Agent<ACTION> implements IAgentLearner<ACTION> { @Override protected void reset() { super.reset(); rewardAtLastExperience = 0; } AgentLearner(Environment<ACTION> environment,
                        TransformProcess transformProcess,
                        IPolicy<ACTION> policy,
                        Configuration configuration,
                        String id,
                        @NonNull ILearningBehavior<ACTION> learningBehavior);   }