RLPark 1.0.0
Reinforcement Learning Framework in Java

TargetReachedL1NormTermination.java

Go to the documentation of this file.
00001 package rlpark.plugin.rltoys.problems.puddleworld;
00002 
00003 public class TargetReachedL1NormTermination implements TerminationFunction {
00004   private final double[] target;
00005   private final double tolerance;
00006 
00007   public TargetReachedL1NormTermination(double[] target, double tolerance) {
00008     assert tolerance > 0;
00009     this.target = target;
00010     this.tolerance = tolerance;
00011   }
00012 
00013   @Override
00014   public boolean isTerminated(double[] position) {
00015     double distance = 0.0;
00016     assert position.length == target.length;
00017     for (int i = 0; i < position.length; i++)
00018       distance += Math.abs(target[i] - position[i]);
00019     return distance < tolerance;
00020   }
00021 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark