Package nl.tue.astar
Interface Record
-
- Type Parameters:
S-
public interface RecordStores the little bit of information needed per volatile state in the AStarAlgorithm. The memory footprint of this object should be kept to a minimum. equality should be based purely on the long value of the state and should not include costs. The priorityQueue used in the AStar algorithm will not insert a new Record if it equals an old record and has equal or higher cost (including the estimate)- Author:
- bfvdonge
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetBacktraceSize()returns the length of the path from this record to the root of the searchintgetCostSoFar()returns the cost so far for reaching the corresponding statedoublegetEstimatedRemainingCost()returns an underestimate for the remaining costintgetModelMove()return the id of the modelmove used to reach this record from previous.If none, then Move.BOTTOM is returnedintgetMovedEvent()return the index in the trace representing the event that was moved to get to this step.gnu.trove.TIntCollectiongetNextEvents(Delegate<? extends Head,? extends Tail> delegate, Trace trace)return the events in the trace that are currently enabled.RecordgetNextRecord(Delegate<? extends Head,? extends Tail> d, Trace trace, Head newHead, long state, int modelMove, int movedEvent, int activity)creates a new record, based on the operations m and l applied to the old head.RecordgetPredecessor()returns the predecessor record.longgetState()Returns the index of the state for which this record is kept.<H extends Head,T extends Tail>
State<H,T>getState(CompressedStore<State<H,T>> storage)retrieves the state stored at index getState() from the storage.doublegetTotalCost()Method should return sum of costSoFar and estimatedCost;booleanisExactEstimate()true if the last set estimate is exact.voidsetEstimatedRemainingCost(double cost, boolean isExactEstimate)sets the estimate of the remaining cost.voidsetState(long index)puts the index of the state corresponding to this record in the record.
-
-
-
Method Detail
-
getState
<H extends Head,T extends Tail> State<H,T> getState(CompressedStore<State<H,T>> storage) throws StorageException
retrieves the state stored at index getState() from the storage.- Parameters:
storage-- Returns:
- Throws:
StorageException
-
getState
long getState()
Returns the index of the state for which this record is kept.- Returns:
-
getCostSoFar
int getCostSoFar()
returns the cost so far for reaching the corresponding state- Returns:
-
getEstimatedRemainingCost
double getEstimatedRemainingCost()
returns an underestimate for the remaining cost- Returns:
-
getTotalCost
double getTotalCost()
Method should return sum of costSoFar and estimatedCost;
-
setEstimatedRemainingCost
void setEstimatedRemainingCost(double cost, boolean isExactEstimate)sets the estimate of the remaining cost. The method should not be called by classes other than implementations of the AStarThread
-
isExactEstimate
boolean isExactEstimate()
true if the last set estimate is exact. If this method returns False, the Tail implementation of the A Star algorithm has to implement FastLowerBoundTail- Returns:
-
getPredecessor
Record getPredecessor()
returns the predecessor record.- Returns:
-
setState
void setState(long index)
puts the index of the state corresponding to this record in the record.- Parameters:
index-
-
getNextRecord
Record getNextRecord(Delegate<? extends Head,? extends Tail> d, Trace trace, Head newHead, long state, int modelMove, int movedEvent, int activity)
creates a new record, based on the operations m and l applied to the old head.- Parameters:
d- the delegatetrace- TODOtrace- the index of the trace in the logmodelMove- the index of the transition that needs to be fired (or Move.BOTTOM if none)activity- TODOevent- the index of the event in the trace- Returns:
-
getModelMove
int getModelMove()
return the id of the modelmove used to reach this record from previous.If none, then Move.BOTTOM is returned- Returns:
-
getMovedEvent
int getMovedEvent()
return the index in the trace representing the event that was moved to get to this step. If none, then Move.BOTTOM is returned- Returns:
-
getNextEvents
gnu.trove.TIntCollection getNextEvents(Delegate<? extends Head,? extends Tail> delegate, Trace trace)
return the events in the trace that are currently enabled. In case of a linearly ordered trace, at most 1 event is returned each time.- Parameters:
delegate-trace- TODO- Returns:
-
getBacktraceSize
int getBacktraceSize()
returns the length of the path from this record to the root of the search- Returns:
-
-