@Test public void when_training_expect_stoppingConditionWillStopTraining() { Predicate<SyncTrainer> stoppingCondition = t -> t.getEpisodeCount() >= 5; setup(stoppingCondition); sut.train(); assertEquals(5, sut.getEpisodeCount()); }
public void train() { episodeCount = 0; stepCount = 0; while (!stoppingCondition.test(this)) { agentLearner.run(); ++episodeCount; stepCount += agentLearner.getEpisodeStepCount(); } }
SyncTrainer implements ITrainer { public void train() { episodeCount = 0; stepCount = 0; while (!stoppingCondition.test(this)) { agentLearner.run(); ++episodeCount; stepCount += agentLearner.getEpisodeStepCount(); } } }
SyncTrainer implements ITrainer { public void train() { episodeCount = 0; stepCount = 0; while (!stoppingCondition.test(this)) { agentLearner.run(); ++episodeCount; stepCount += agentLearner.getEpisodeStepCount(); } } @lombok.Builder  SyncTrainer(@NonNull Builder<IAgentLearner<ACTION>> agentLearnerBuilder,
                       @NonNull Predicate<SyncTrainer<ACTION>> stoppingCondition); }
SyncTrainer implements ITrainer { public void train() { episodeCount = 0; stepCount = 0; while (!stoppingCondition.test(this)) { agentLearner.run(); ++episodeCount; stepCount += agentLearner.getEpisodeStepCount(); } } @lombok.Builder  SyncTrainer(@NonNull Builder<IAgentLearner<ACTION>> agentLearnerBuilder,
                       @NonNull Predicate<SyncTrainer<ACTION>> stoppingCondition); void train(); }
SyncTrainer implements ITrainer { public void train() { episodeCount = 0; stepCount = 0; while (!stoppingCondition.test(this)) { agentLearner.run(); ++episodeCount; stepCount += agentLearner.getEpisodeStepCount(); } } @lombok.Builder  SyncTrainer(@NonNull Builder<IAgentLearner<ACTION>> agentLearnerBuilder,
                       @NonNull Predicate<SyncTrainer<ACTION>> stoppingCondition); void train();  }