pal.algorithmics
Interface ObjectState

All Known Implementing Classes:
GeneralObjectState

public interface ObjectState

Title: Object State

Description: A stateful, single thread object, that can act upon itself

Version:
1.0
Author:
Matthew Goode

Method Summary
 double doAction(double currentScore, double desparationValue)
          Perform an action
 java.lang.Object getStateReference()
           
 boolean isMaximiseScore()
          If true, than a bigger score is better, otherwise a smaller score is better
 void restoreState(java.lang.Object stateReference)
          Used to restore the state of the this object to that of a previous time point
 boolean undoAction()
          Undo the last action (if it was successful) Users of an ObjectState should accept that sometimes undoing an action isn't possible.
 

Method Detail

doAction

double doAction(double currentScore,
                double desparationValue)
Perform an action

Parameters:
currentScore - The current score before doing the action
desparationValue - An indication by the processing machines of willingness to do more extreme actions. A value of 0 means not desparate at all, a value of 1 means very desparate
Returns:
the current score after doing the action (or the input score if not successful)

undoAction

boolean undoAction()
Undo the last action (if it was successful) Users of an ObjectState should accept that sometimes undoing an action isn't possible. If an undo was not possible the object state should be in the same state as it was previous to the call to undoAction()

Returns:
true if undo was successful

getStateReference

java.lang.Object getStateReference()
Returns:
An object that can be used to reconstruct the current state of this object

restoreState

void restoreState(java.lang.Object stateReference)
Used to restore the state of the this object to that of a previous time point

Parameters:
stateReference - An object returned by getStateReference()

isMaximiseScore

boolean isMaximiseScore()
If true, than a bigger score is better, otherwise a smaller score is better

Returns:
True if the aim is to maximise