Class AbstractAStarThreadNoModelMoves<H extends nl.tue.astar.Head,​T extends nl.tue.astar.Tail>

    • 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
      • poll

        protected int poll
      • i

        protected static int i
      • reliable

        protected boolean reliable
      • considered

        protected final gnu.trove.set.TLongSet considered
      • observers

        protected java.util.List<nl.tue.astar.AStarObserver> observers
      • 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: AStarThread
        Returns the trace for which this AStarThread was instantiated.
        Specified by:
        getTrace in interface AStarThread<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: AStarThread
        returns the delegate used for determining the possible moves during replay.
        Specified by:
        getDelegate in interface AStarThread<H extends nl.tue.astar.Head,​T extends nl.tue.astar.Tail>
        Returns:
      • setQueue

        public void setQueue​(nl.tue.astar.util.FastLookupPriorityQueue newQueue)
      • addObserver

        public void addObserver​(nl.tue.astar.AStarObserver observer)
        Specified by:
        addObserver in interface ObservableAStarThread<H extends nl.tue.astar.Head,​T extends nl.tue.astar.Tail>
      • removeObserver

        public void removeObserver​(nl.tue.astar.AStarObserver observer)
        Specified by:
        removeObserver in interface ObservableAStarThread<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: AStarThread
        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;
        Specified by:
        setASynchronousMoveSorting in interface AStarThread<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: AStarThread
        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.
        Specified by:
        getOptimalRecord in interface AStarThread<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: AStarThread
        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.
        Specified by:
        getOptimalRecord in interface AStarThread<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: AStarThread
        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.
        Specified by:
        wasReliable in interface AStarThread<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: AStarThread
        Returns the number of visited states.
        Specified by:
        getVisitedStateCount in interface AStarThread<H extends nl.tue.astar.Head,​T extends nl.tue.astar.Tail>
        Returns:
      • getQueuedStateCount

        public int getQueuedStateCount()
        Description copied from interface: AStarThread
        Returns the number of nodes queueud. This is at least the number of nodes visisted, but can be higher due to updates.
        Specified by:
        getQueuedStateCount in interface AStarThread<H extends nl.tue.astar.Head,​T extends nl.tue.astar.Tail>
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setType

        public void setType​(AStarThread.Type type)
        Description copied from interface: AStarThread
        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.
        Specified by:
        setType in interface AStarThread<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:
        getType in interface AStarThread<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:
        setEpsilon in interface AStarThread<H extends nl.tue.astar.Head,​T extends nl.tue.astar.Tail>
        Parameters:
        epsilon -