RLPark 1.0.0
Reinforcement Learning Framework in Java

RewardMonitorAverage.java

Go to the documentation of this file.
00001 package rlpark.plugin.rltoys.experiments.parametersweep.onpolicy.internal;
00002 
00003 import rlpark.plugin.rltoys.experiments.helpers.Runner;
00004 import rlpark.plugin.rltoys.experiments.helpers.Runner.RunnerEvent;
00005 import rlpark.plugin.rltoys.experiments.parametersweep.internal.AbstractPerformanceMonitor;
00006 import zephyr.plugin.core.api.signals.Listener;
00007 
00008 public class RewardMonitorAverage extends AbstractPerformanceMonitor implements OnPolicyRewardMonitor {
00009   public RewardMonitorAverage(String prefix, int nbBins, int nbTimeSteps) {
00010     super(prefix, "Reward", createStartingPoints(nbBins, nbTimeSteps));
00011   }
00012 
00013   @Override
00014   public void connect(Runner runner) {
00015     runner.onTimeStep.connect(new Listener<Runner.RunnerEvent>() {
00016       @SuppressWarnings("synthetic-access")
00017       @Override
00018       public void listen(RunnerEvent runnerEvent) {
00019         if (runnerEvent.step.time == 0)
00020           return;
00021         registerMeasurement(runnerEvent.step.time - 1, runnerEvent.step.r_tp1);
00022       }
00023     });
00024   }
00025 
00026   @Override
00027   protected double worstValue() {
00028     return -Float.MAX_VALUE;
00029   }
00030 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark