RLPark 1.0.0
Reinforcement Learning Framework in Java
|
00001 package rlpark.plugin.rltoys.problems.stategraph; 00002 00003 import rlpark.plugin.rltoys.envio.actions.Action; 00004 import rlpark.plugin.rltoys.envio.policy.Policy; 00005 import rlpark.plugin.rltoys.envio.policy.SingleActionPolicy; 00006 00007 @SuppressWarnings("serial") 00008 public class LineProblem extends FiniteStateGraph { 00009 static private final double Gamma = .9; 00010 static public final GraphState A = new GraphState("A", 0.0); 00011 static public final GraphState B = new GraphState("B", 0.0); 00012 static public final GraphState C = new GraphState("C", 0.0); 00013 static public final GraphState D = new GraphState("D", 1.0); 00014 static private final GraphState[] states = { A, B, C, D }; 00015 static public Action Move = new Action() { 00016 }; 00017 static private final Policy acting = new SingleActionPolicy(Move); 00018 00019 static { 00020 A.connect(Move, B); 00021 B.connect(Move, C); 00022 C.connect(Move, D); 00023 } 00024 00025 public LineProblem() { 00026 super(acting, states); 00027 setInitialState(A); 00028 } 00029 00030 @Override 00031 public double[] expectedDiscountedSolution() { 00032 return new double[] { Math.pow(Gamma, 2), Math.pow(Gamma, 1), Math.pow(Gamma, 0) }; 00033 } 00034 00035 @Override 00036 public Action[] actions() { 00037 return new Action[] { Move }; 00038 } 00039 00040 @Override 00041 public double gamma() { 00042 return Gamma; 00043 } 00044 }