RLPark 1.0.0
Reinforcement Learning Framework in Java

LearnerAgent.java

Go to the documentation of this file.
00001 package rlpark.plugin.rltoys.agents.rl;
00002 
00003 import rlpark.plugin.rltoys.algorithms.control.ControlLearner;
00004 import rlpark.plugin.rltoys.envio.actions.Action;
00005 import rlpark.plugin.rltoys.envio.rl.RLAgent;
00006 import rlpark.plugin.rltoys.envio.rl.TRStep;
00007 import rlpark.plugin.rltoys.math.vector.RealVector;
00008 import rlpark.plugin.rltoys.math.vector.implementations.PVector;
00009 import zephyr.plugin.core.api.monitoring.annotations.Monitor;
00010 
00011 public class LearnerAgent implements RLAgent {
00012   private static final long serialVersionUID = -8694734303900854141L;
00013   @Monitor
00014   protected final ControlLearner control;
00015   protected RealVector x_t;
00016 
00017   public LearnerAgent(ControlLearner control) {
00018     this.control = control;
00019   }
00020 
00021   @Override
00022   public Action getAtp1(TRStep step) {
00023     if (step.isEpisodeStarting())
00024       x_t = null;
00025     RealVector x_tp1 = step.o_tp1 != null ? new PVector(step.o_tp1) : null;
00026     Action a_tp1 = control.step(x_t, step.a_t, x_tp1, step.r_tp1);
00027     x_t = x_tp1;
00028     return a_tp1;
00029   }
00030 
00031   public ControlLearner control() {
00032     return control;
00033   }
00034 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark