RLPark 1.0.0
Reinforcement Learning Framework in Java

IdentityProjector.java

Go to the documentation of this file.
00001 package rlpark.plugin.rltoys.agents.representations;
00002 
00003 import rlpark.plugin.rltoys.algorithms.functions.states.Projector;
00004 import rlpark.plugin.rltoys.math.ranges.Range;
00005 import rlpark.plugin.rltoys.math.vector.RealVector;
00006 import rlpark.plugin.rltoys.math.vector.implementations.PVector;
00007 
00008 public class IdentityProjector implements Projector {
00009   private static final long serialVersionUID = 4540220410020682331L;
00010   private final int vectorSize;
00011   private final double vectorNorm;
00012 
00013   public IdentityProjector(Range[] observationRanges) {
00014     vectorSize = observationRanges.length;
00015     double norm = 0;
00016     for (Range range : observationRanges) {
00017       double maxValue = Math.max(Math.abs(range.min()), Math.abs(range.max()));
00018       norm += maxValue * maxValue;
00019     }
00020     vectorNorm = Math.sqrt(norm);
00021   }
00022 
00023   @Override
00024   public RealVector project(double[] obs) {
00025     return new PVector(obs);
00026   }
00027 
00028   @Override
00029   public int vectorSize() {
00030     return vectorSize;
00031   }
00032 
00033   @Override
00034   public double vectorNorm() {
00035     return vectorNorm;
00036   }
00037 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark