org.eyelanguage.rl.reading
Class ParallelToSerialVFAdapter

java.lang.Object
  extended by org.eyelanguage.rl.reading.ParallelToSerialVFAdapter
All Implemented Interfaces:
java.io.Serializable, ValueFunction

public class ParallelToSerialVFAdapter
extends java.lang.Object
implements ValueFunction

Wraps a normal value function but converts parallel states into serial states before relaying state value requests to the value function. This is an instance of the "decorator" pattern.

See Also:
Serialized Form

Field Summary
 double SERIAL_ATTEND_INTERVAL
           
 
Constructor Summary
ParallelToSerialVFAdapter(ValueFunction vf)
           
 
Method Summary
 ReadingStateRelative convertParallelToSerial(ReadingStateParallelRelative s)
          Exploits the copyFrom() method of ReadingStates such that a newly created serial state (ReadingStateRelative) will automagically extract the information it needs from a parallel state -- the only other thing is that time spent attending has to be rounded to the granularity of which the agent was trained (e.g.
 java.lang.String getName()
          It is important for value functions to have names for the patchwork approach, so that states can identify to which value function patch they belong by the PolicyExtractor.
 double getValue(State state)
          Retrieve the value associated with a state (which may be different for non-stored states depending on the actual class implementing this value function).
 void setName(java.lang.String name)
           
 void setValue(State state, double newValue)
           
 void setValueOfOutOfBoundsStates(double newValueOfOutOfBoundsStates)
           
 void setValueOfTerminalStates(double newValueOfTerminalStates)
          Many problems define a value of 0 for their terminal states, where the agent can remain.
 void setWorld(World w)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIAL_ATTEND_INTERVAL

public final double SERIAL_ATTEND_INTERVAL
See Also:
Constant Field Values
Constructor Detail

ParallelToSerialVFAdapter

public ParallelToSerialVFAdapter(ValueFunction vf)
Method Detail

setWorld

public void setWorld(World w)
Specified by:
setWorld in interface ValueFunction

getValue

public double getValue(State state)
Description copied from interface: ValueFunction
Retrieve the value associated with a state (which may be different for non-stored states depending on the actual class implementing this value function).

Specified by:
getValue in interface ValueFunction

convertParallelToSerial

public ReadingStateRelative convertParallelToSerial(ReadingStateParallelRelative s)
Exploits the copyFrom() method of ReadingStates such that a newly created serial state (ReadingStateRelative) will automagically extract the information it needs from a parallel state -- the only other thing is that time spent attending has to be rounded to the granularity of which the agent was trained (e.g. 5).


getName

public java.lang.String getName()
Description copied from interface: ValueFunction
It is important for value functions to have names for the patchwork approach, so that states can identify to which value function patch they belong by the PolicyExtractor.

Specified by:
getName in interface ValueFunction

setName

public void setName(java.lang.String name)
Specified by:
setName in interface ValueFunction

setValue

public void setValue(State state,
                     double newValue)
Specified by:
setValue in interface ValueFunction

setValueOfTerminalStates

public void setValueOfTerminalStates(double newValueOfTerminalStates)
Description copied from interface: ValueFunction
Many problems define a value of 0 for their terminal states, where the agent can remain.

Specified by:
setValueOfTerminalStates in interface ValueFunction

setValueOfOutOfBoundsStates

public void setValueOfOutOfBoundsStates(double newValueOfOutOfBoundsStates)