Class AbstractAStarThreadNoModelMoves<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>
- java.lang.Object
-
- org.processmining.lpm.adjustedalignments.AbstractAStarThreadNoModelMoves<H,T>
-
- All Implemented Interfaces:
AStarThread<H,T>,ObservableAStarThread<H,T>
- Direct Known Subclasses:
AllSamplingOptAlignmentsGraphThread,AStarThread.CPUEfficient,AStarThread.MemoryEfficient
public abstract class AbstractAStarThreadNoModelMoves<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail> extends java.lang.Object implements ObservableAStarThread<H,T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractAStarThreadNoModelMoves.QueueingModelstatic interfaceAbstractAStarThreadNoModelMoves.StorageHandler<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>The storageHandler handles the storing and retrieving of elements from the statespace searched by the AStar algorithm-
Nested classes/interfaces inherited from interface org.processmining.lpm.adjustedalignments.AStarThread
AStarThread.ASynchronousMoveSorting, AStarThread.Canceller, AStarThread.CPUEfficient<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>, AStarThread.MemoryEfficient<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>, AStarThread.Type
-
-
Field Summary
Fields Modifier and Type Field Description protected intcomputedEstimateCountprotected gnu.trove.set.TLongSetconsideredprotected nl.tue.astar.Delegate<H,T>delegateprotected doubleepsilonprotected doubleexpectedLengthprotected static intiprotected intmaxStatesprotected java.util.List<nl.tue.astar.AStarObserver>observersprotected AbstractPDelegate<T>pDelegateprotected intpollprotected nl.tue.astar.util.FastLookupPriorityQueuequeueprotected intqueuedStateCountprotected booleanreliableprotected AStarThread.ASynchronousMoveSortingsortingprotected AbstractAStarThreadNoModelMoves.StorageHandler<H,T>storageHandlerprotected nl.tue.astar.Tracetraceprotected inttraversedArcCountprotected AStarThread.Typetype-
Fields inherited from interface org.processmining.lpm.adjustedalignments.AStarThread
NOMOVE
-
Fields inherited from interface org.processmining.lpm.adjustedalignments.ObservableAStarThread
ESTIMATEIRRELEVANT
-
-
Constructor Summary
Constructors Constructor Description AbstractAStarThreadNoModelMoves(nl.tue.astar.Delegate<H,T> delegate, nl.tue.astar.Trace trace, int maxStates, AbstractAStarThreadNoModelMoves.StorageHandler<H,T> storageHandler)any implementation should, after calling this constructor, call initializeQueue(initialHead);
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObserver(nl.tue.astar.AStarObserver observer)protected TcomputeNewTail(nl.tue.astar.Record newRec, T tail, H newHead, int modelMove, int movedEvent, int activity)protected HcomputeNextHead(nl.tue.astar.Record rec, H head, int modelMove, int movedEvent, int activity)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, double timeLimit)nl.tue.astar.RecordgetOptimalRecord(AStarThread.Canceller c, int stopAt)Returns a Record for an optimal alignment.nl.tue.astar.RecordgetOptimalRecord(AStarThread.Canceller c, int stopAt, double timeLimit)gets the optimal record.booleangetPreferBreadth()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.protected voidinitializeQueue(H head)protected booleanisValidMoveOnLog(nl.tue.astar.Record rec, int nextEvent, int activity, gnu.trove.list.TIntList modelMoves, gnu.trove.list.TIntList syncMoves)protected booleanisValidMoveOnModel(nl.tue.astar.Record rec, gnu.trove.TIntCollection nextEvents, int activity, gnu.trove.list.TIntList modelMoves)protected nl.tue.astar.Recordpoll()protected voidprocessMove(H head, T tail, nl.tue.astar.Record rec, int modelMove, int movedEvent, int activity)protected voidprocessMovesForRecord(nl.tue.astar.Record rec, H head, T tail, int stopAt, double timeLimit, long endTime)protected voidprocessMovesForRecordWithUpToDateTail(nl.tue.astar.Record rec, H head, T tail, int stopAt, double timeLimit, long endTime)voidremoveObserver(nl.tue.astar.AStarObserver observer)voidsetASynchronousMoveSorting(AStarThread.ASynchronousMoveSorting sorting)When aligning a trace with a model, any moves between two synchronous moves can be sorted.protected voidsetConsidered(nl.tue.astar.Record record)voidsetEpsilon(double epsilon)Set epsilon for the weighted variants of A StarvoidsetQueue(nl.tue.astar.util.FastLookupPriorityQueue newQueue)voidsetQueueingModel(AbstractAStarThreadNoModelMoves.QueueingModel model)voidsetType(AStarThread.Type type)Sets the type of the AStar algorithm.java.lang.StringtoString()booleanwasReliable()After a call to run(), this method returns true if the returned Record yields the optimal result.
-
-
-
Field Detail
-
queue
protected nl.tue.astar.util.FastLookupPriorityQueue queue
-
trace
protected final nl.tue.astar.Trace trace
-
maxStates
protected final int maxStates
-
queuedStateCount
protected int queuedStateCount
-
traversedArcCount
protected int traversedArcCount
-
computedEstimateCount
protected int computedEstimateCount
-
delegate
protected final nl.tue.astar.Delegate<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail> delegate
-
pDelegate
protected final AbstractPDelegate<T extends nl.tue.astar.Tail> pDelegate
-
poll
protected int poll
-
i
protected static int i
-
sorting
protected AStarThread.ASynchronousMoveSorting sorting
-
reliable
protected boolean reliable
-
considered
protected final gnu.trove.set.TLongSet considered
-
observers
protected java.util.List<nl.tue.astar.AStarObserver> observers
-
storageHandler
protected final AbstractAStarThreadNoModelMoves.StorageHandler<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail> storageHandler
-
type
protected AStarThread.Type type
-
epsilon
protected double epsilon
-
expectedLength
protected double expectedLength
-
-
Constructor Detail
-
AbstractAStarThreadNoModelMoves
public AbstractAStarThreadNoModelMoves(nl.tue.astar.Delegate<H,T> delegate, nl.tue.astar.Trace trace, int maxStates, AbstractAStarThreadNoModelMoves.StorageHandler<H,T> storageHandler)
any implementation should, after calling this constructor, call initializeQueue(initialHead);- Parameters:
delegate-trace-maxStates-storageHandler-
-
-
Method Detail
-
getTrace
public nl.tue.astar.Trace getTrace()
Description copied from interface:AStarThreadReturns the trace for which this AStarThread was instantiated.- Specified by:
getTracein interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Returns:
-
getDelegate
public nl.tue.astar.Delegate<H,T> getDelegate()
Description copied from interface:AStarThreadreturns the delegate used for determining the possible moves during replay.- Specified by:
getDelegatein interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Returns:
-
setQueueingModel
public void setQueueingModel(AbstractAStarThreadNoModelMoves.QueueingModel model)
-
setQueue
public void setQueue(nl.tue.astar.util.FastLookupPriorityQueue newQueue)
-
addObserver
public void addObserver(nl.tue.astar.AStarObserver observer)
- Specified by:
addObserverin interfaceObservableAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>
-
removeObserver
public void removeObserver(nl.tue.astar.AStarObserver observer)
- Specified by:
removeObserverin interfaceObservableAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>
-
getPreferBreadth
public boolean getPreferBreadth()
-
setASynchronousMoveSorting
public void setASynchronousMoveSorting(AStarThread.ASynchronousMoveSorting sorting)
Description copied from interface:AStarThreadWhen 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;- Specified by:
setASynchronousMoveSortingin interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>
-
getSorting
public AStarThread.ASynchronousMoveSorting getSorting()
- Specified by:
getSortingin interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>
-
getOptimalRecord
public nl.tue.astar.Record getOptimalRecord(AStarThread.Canceller c) throws nl.tue.astar.AStarException
Description copied from interface:AStarThreadReturns 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.- Specified by:
getOptimalRecordin interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Returns:
- Throws:
nl.tue.astar.AStarException
-
getOptimalRecord
public nl.tue.astar.Record getOptimalRecord(AStarThread.Canceller c, int stopAt) throws nl.tue.astar.AStarException
Description copied from interface:AStarThreadReturns 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.- Specified by:
getOptimalRecordin interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Returns:
- Throws:
nl.tue.astar.AStarException
-
getOptimalRecord
public nl.tue.astar.Record getOptimalRecord(AStarThread.Canceller c, double timeLimit) throws nl.tue.astar.AStarException
- Throws:
nl.tue.astar.AStarException
-
poll
protected nl.tue.astar.Record poll()
-
getOptimalRecord
public nl.tue.astar.Record getOptimalRecord(AStarThread.Canceller c, int stopAt, double timeLimit) throws nl.tue.astar.AStarException
gets the optimal record. The search stops and returns the best prefix so far if either the stopAt value is reached in terms of cost, or if the timeLimit in seconds is reached. If the timelimit is negative, then time is unlimited.- Parameters:
c-stopAt-timeLimit-- Returns:
- Throws:
nl.tue.astar.AStarException
-
processMovesForRecord
protected void processMovesForRecord(nl.tue.astar.Record rec, H head, T tail, int stopAt, double timeLimit, long endTime) throws nl.tue.astar.AStarException- Throws:
nl.tue.astar.AStarException
-
processMovesForRecordWithUpToDateTail
protected void processMovesForRecordWithUpToDateTail(nl.tue.astar.Record rec, H head, T tail, int stopAt, double timeLimit, long endTime) throws nl.tue.astar.AStarException- Throws:
nl.tue.astar.AStarException
-
setConsidered
protected void setConsidered(nl.tue.astar.Record record)
-
isValidMoveOnModel
protected boolean isValidMoveOnModel(nl.tue.astar.Record rec, gnu.trove.TIntCollection nextEvents, int activity, gnu.trove.list.TIntList modelMoves)
-
isValidMoveOnLog
protected boolean isValidMoveOnLog(nl.tue.astar.Record rec, int nextEvent, int activity, gnu.trove.list.TIntList modelMoves, gnu.trove.list.TIntList syncMoves)
-
wasReliable
public boolean wasReliable()
Description copied from interface:AStarThreadAfter 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.- Specified by:
wasReliablein interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Returns:
-
processMove
protected void processMove(H head, T tail, nl.tue.astar.Record rec, int modelMove, int movedEvent, int activity) throws nl.tue.astar.AStarException
- Throws:
nl.tue.astar.AStarException
-
computeNextHead
protected H computeNextHead(nl.tue.astar.Record rec, H head, int modelMove, int movedEvent, int activity)
-
computeNewTail
protected T computeNewTail(nl.tue.astar.Record newRec, T tail, H newHead, int modelMove, int movedEvent, int activity)
-
initializeQueue
protected void initializeQueue(H head) throws nl.tue.astar.AStarException
- Throws:
nl.tue.astar.AStarException
-
getVisitedStateCount
public int getVisitedStateCount()
Description copied from interface:AStarThreadReturns the number of visited states.- Specified by:
getVisitedStateCountin interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Returns:
-
getQueuedStateCount
public int getQueuedStateCount()
Description copied from interface:AStarThreadReturns the number of nodes queueud. This is at least the number of nodes visisted, but can be higher due to updates.- Specified by:
getQueuedStateCountin interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setType
public void setType(AStarThread.Type type)
Description copied from interface:AStarThreadSets 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.- Specified by:
setTypein interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>
-
getType
public AStarThread.Type getType()
Returns the type of AStar used- Specified by:
getTypein interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Returns:
-
setEpsilon
public void setEpsilon(double epsilon)
Set epsilon for the weighted variants of A Star- Specified by:
setEpsilonin interfaceAStarThread<H extends nl.tue.astar.Head,T extends nl.tue.astar.Tail>- Parameters:
epsilon-
-
-