Interface AStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>
-
- Type Parameters:
H-T-
- All Known Subinterfaces:
ObservableAStarThread<H,T>
- All Known Implementing Classes:
AbstractAStarThreadNoModelMoves,AllSamplingOptAlignmentsGraphThread,AllSamplingOptAlignmentsGraphThread.CPUEfficient,AllSamplingOptAlignmentsGraphThread.MemoryEfficient,AStarThread.CPUEfficient,AStarThread.MemoryEfficient
public interface AStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>Interface for computing one (or more) alignments between a trace and a model. After instantiation, the sorting and priority queue ordering should be set before any call to getOptimalRecord. On the first call to getOptimalRecord, the AStar algorithm is used to compute an optimal alignment between a model and a trace. The possible moves in every state are computed using the delegate. When finished, a record is always returned. If wasReliable() returns true, then the record is indeed an optimal one, otherwise it is a best-guess. As long as wasReliable() returns true, more alignments can be computed by repeated calls to getOptimalRecord(C, i), where i is the cost of the previous optimal record. This way, the algorithm quarantees that all states which are on a shortest path from the source to the target node will be visisted (note that this does not imply that all paths will be found).- Author:
- bfvdonge
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAStarThread.ASynchronousMoveSortingEnumeration to set the sorting of moves.static interfaceAStarThread.Cancellerstatic classAStarThread.CPUEfficient<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>static classAStarThread.MemoryEfficient<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>static classAStarThread.Type
-
Field Summary
Fields Modifier and Type Field Description static intNOMOVE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description nl.tue.astar.Delegate<H,T>getDelegate()returns the delegate used for determining the possible moves during replay.nl.tue.astar.RecordgetOptimalRecord(AStarThread.Canceller c)Returns a Record for an optimal alignment.nl.tue.astar.RecordgetOptimalRecord(AStarThread.Canceller c, int stopAt)Returns a Record for an optimal alignment.intgetQueuedStateCount()Returns the number of nodes queueud.AStarThread.ASynchronousMoveSortinggetSorting()nl.tue.astar.TracegetTrace()Returns the trace for which this AStarThread was instantiated.AStarThread.TypegetType()Returns the type of AStar usedintgetVisitedStateCount()Returns the number of visited states.voidsetASynchronousMoveSorting(AStarThread.ASynchronousMoveSorting sorting)When aligning a trace with a model, any moves between two synchronous moves can be sorted.voidsetEpsilon(double epsilon)Set epsilon for the weighted variants of A StarvoidsetType(AStarThread.Type type)Sets the type of the AStar algorithm.booleanwasReliable()After a call to run(), this method returns true if the returned Record yields the optimal result.
-
-
-
Field Detail
-
NOMOVE
static final int NOMOVE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTrace
nl.tue.astar.Trace getTrace()
Returns the trace for which this AStarThread was instantiated.- Returns:
-
getDelegate
nl.tue.astar.Delegate<H,T> getDelegate()
returns the delegate used for determining the possible moves during replay.- Returns:
-
getOptimalRecord
nl.tue.astar.Record getOptimalRecord(AStarThread.Canceller c) throws nl.tue.astar.AStarException
Returns a Record for an optimal alignment. If no optimal alignment exists, or if none is found in time, a "best guess" is returned. To check whether the returned alignment is optimal, the method isReliable() can be used. To make sure you investigated the entire graph from which the (a) final node is reachable, keep calling the method getOptimalRecord(c, stopAt) with the stopAt cost equal to the total cost of the first record. When doing so until the first unreliable result, the entire search space is covered.- Parameters:
c-- Returns:
- Throws:
java.lang.Exceptionnl.tue.astar.AStarException
-
getOptimalRecord
nl.tue.astar.Record getOptimalRecord(AStarThread.Canceller c, int stopAt) throws nl.tue.astar.AStarException
Returns a Record for an optimal alignment. If no optimal alignment exists, if none is found in time or if the cost of an optimal alignment is higher than stopAt a "best guess" is returned. To check whether the returned alignment is optimal, the method isReliable() can be used. To make sure you investigated the entire graph from which the (a) final node is reachable, keep calling the method getOptimalRecord(c, stopAt) with the stopAt cost equal to the total cost of the first record. When doing so until the first unreliable result, the entire search space is covered.- Parameters:
c-- Returns:
- Throws:
java.lang.Exceptionnl.tue.astar.AStarException
-
getQueuedStateCount
int getQueuedStateCount()
Returns the number of nodes queueud. This is at least the number of nodes visisted, but can be higher due to updates.- Returns:
-
getVisitedStateCount
int getVisitedStateCount()
Returns the number of visited states.- Returns:
-
setASynchronousMoveSorting
void setASynchronousMoveSorting(AStarThread.ASynchronousMoveSorting sorting)
When aligning a trace with a model, any moves between two synchronous moves can be sorted. When sorting is set to LOGMOVEFIRST, then no logMove can ever follow a modelMove. If sorting is set to ModelMoveFirst, then no modelMove can ever follow a logMove. The default is LOGMOVEFIRST;- Parameters:
sorting-
-
getSorting
AStarThread.ASynchronousMoveSorting getSorting()
-
wasReliable
boolean wasReliable()
After a call to run(), this method returns true if the returned Record yields the optimal result. If this method returns false, then the returned Record was subOptimal, for example because the maximum state count was reached, of because no solution was found. The Record returned by the previous call to run should be considered as a best guess.- Returns:
-
setType
void setType(AStarThread.Type type)
Sets the type of the AStar algorithm. Can be changed during execution, however if type is set to any weighted variant, the epsilon and expected length should be set.- Parameters:
type-
-
getType
AStarThread.Type getType()
Returns the type of AStar used- Returns:
-
setEpsilon
void setEpsilon(double epsilon)
Set epsilon for the weighted variants of A Star- Parameters:
epsilon-
-
-