Orbital library

orbital.algorithm.template
Class TransitionPath

java.lang.Object
  extended by orbital.algorithm.template.TransitionPath
All Implemented Interfaces:
java.io.Serializable, java.util.Iterator, ProbabilisticAlgorithm

public class TransitionPath
extends java.lang.Object
implements java.util.Iterator, ProbabilisticAlgorithm, java.io.Serializable

A (randomized) path through state space S by transition τ of a TransitionModel.

This iterator will randomly follow a path from the given initial state under the given actions according to the probabilities of the transition τ.

Author:
André Platzer
See Also:
Serialized Form

Constructor Summary
TransitionPath(TransitionModel transition, java.util.Iterator actions, java.lang.Object initialState)
          Create a new (randomized) path through a transition model.
 
Method Summary
 java.util.Random getRandom()
          Get the random-generator used as probabilistic random source.
 boolean hasNext()
           
 boolean isCorrect()
          Whether this algorithm is correct.
 java.lang.Object next()
          Advance to the next state of the path.
 void remove()
           
 void setRandom(java.util.Random randomGenerator)
          Set the random-generator to use as probabilistic random source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransitionPath

public TransitionPath(TransitionModel transition,
                      java.util.Iterator actions,
                      java.lang.Object initialState)
Create a new (randomized) path through a transition model.

Parameters:
transition - the transition model τ through which to create a path.
actions - the iterator of the actions to perform.
initialState - the initial state s0∈S from which to start the path.
Method Detail

isCorrect

public boolean isCorrect()
Description copied from interface: ProbabilisticAlgorithm
Whether this algorithm is correct.

Specified by:
isCorrect in interface ProbabilisticAlgorithm
Returns:
whether all solutions found by this algorithms are correct despite the approximative nature of this algorithm. Monte Carlo algorithms are not correct, while Las Vegas algorithms usually are.

getRandom

public java.util.Random getRandom()
Description copied from interface: ProbabilisticAlgorithm
Get the random-generator used as probabilistic random source.

Specified by:
getRandom in interface ProbabilisticAlgorithm
Returns:
the random generator used for producing probabilistic effects.

setRandom

public void setRandom(java.util.Random randomGenerator)
Description copied from interface: ProbabilisticAlgorithm
Set the random-generator to use as probabilistic random source.

Especially called to change the random source to a previous, more secure, or more realistic generator.

Specified by:
setRandom in interface ProbabilisticAlgorithm

next

public java.lang.Object next()
Advance to the next state of the path.

If a∈A(s) is the next action of the actions iterator and s∈S is the current state, this method will perform the state transition s→asʹ with probability τ(a)(s,sʹ).

Specified by:
next in interface java.util.Iterator
Returns:
the next state of the path.

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator
Postconditions:
RES == actions.hasNext()

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.