jmdp.basic
Class ValueFunction<S extends State>

java.lang.Object
  extended by jmdp.basic.ValueFunction<S>

public class ValueFunction<S extends State>
extends java.lang.Object

This structure matches each state with a double number representing its value function, or in some cases the steady state probabilities.

Author:
Andres Sarmiento and German Riano - Universidad de Los Andes

Constructor Summary
ValueFunction()
          Creates a new empty value function.
ValueFunction(ValueFunction<S> vf)
          Creates a value function from another given value function
 
Method Summary
 double get(S s)
           
 java.util.Iterator<java.util.Map.Entry<S,java.lang.Double>> iterator()
           
 void print(java.io.PrintWriter pw)
          Prints the Value Function.
 void print(java.io.PrintWriter pw, java.lang.String statesFormat, java.lang.String valuesFormat)
          Prints the Value function with the given state format , and values format according to the Format String Syntax.
 void set(S s, double val)
          Associates a state and a double value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueFunction

public ValueFunction()
Creates a new empty value function.


ValueFunction

public ValueFunction(ValueFunction<S> vf)
Creates a value function from another given value function

Parameters:
vf - value function
Method Detail

set

public void set(S s,
                double val)
Associates a state and a double value

Parameters:
s - state
val - value

iterator

public java.util.Iterator<java.util.Map.Entry<S,java.lang.Double>> iterator()
Returns:
iterator over the entries of the map

get

public double get(S s)
Parameters:
s - given state
Returns:
the double value corresponding to the state

print

public void print(java.io.PrintWriter pw,
                  java.lang.String statesFormat,
                  java.lang.String valuesFormat)
Prints the Value function with the given state format , and values format according to the Format String Syntax.

Parameters:
pw -
statesFormat - format for the states , for example "%-10S" to have 10 width left aligned states.
valuesFormat - format to use for values. For example us "%6.2" to have 6 width and 2 decimals.
See Also:
Formatter

print

public void print(java.io.PrintWriter pw)
Prints the Value Function. It uses default states and values format.

Parameters:
pw -