RLPark 1.0.0
Reinforcement Learning Framework in Java

LearnerAgentFA.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.algorithms.functions.states.Projector;
00005 import rlpark.plugin.rltoys.envio.actions.Action;
00006 import rlpark.plugin.rltoys.envio.rl.RLAgent;
00007 import rlpark.plugin.rltoys.envio.rl.TRStep;
00008 import rlpark.plugin.rltoys.math.vector.RealVector;
00009 import rlpark.plugin.rltoys.math.vector.implementations.Vectors;
00010 import zephyr.plugin.core.api.monitoring.annotations.IgnoreMonitor;
00011 import zephyr.plugin.core.api.monitoring.annotations.Monitor;
00012 
00013 @Monitor
00014 public class LearnerAgentFA implements RLAgent {
00015   private static final long serialVersionUID = -8694734303900854141L;
00016   protected final ControlLearner control;
00017   protected final Projector projector;
00018   protected double reward;
00019   @IgnoreMonitor
00020   protected RealVector x_t;
00021 
00022   public LearnerAgentFA(ControlLearner control, Projector projector) {
00023     this.control = control;
00024     this.projector = projector;
00025   }
00026 
00027   @Override
00028   public Action getAtp1(TRStep step) {
00029     RealVector x_tp1 = projector.project(step.o_tp1);
00030     reward = step.r_tp1;
00031     Action a_tp1 = control.step(step.o_t != null ? x_t : null, step.a_t, x_tp1, reward);
00032     x_t = Vectors.bufferedCopy(x_tp1, x_t);
00033     return a_tp1;
00034   }
00035 
00036   public ControlLearner control() {
00037     return control;
00038   }
00039 
00040   public Projector projector() {
00041     return projector;
00042   }
00043 
00044   public RealVector lastState() {
00045     return x_t;
00046   }
00047 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark