Package nl.tue.astar

Interface Record

  • Type Parameters:
    S -

    public interface Record
    Stores 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
      int getBacktraceSize()
      returns the length of the path from this record to the root of the search
      int getCostSoFar()
      returns the cost so far for reaching the corresponding state
      double getEstimatedRemainingCost()
      returns an underestimate for the remaining cost
      int getModelMove()
      return the id of the modelmove used to reach this record from previous.If none, then Move.BOTTOM is returned
      int getMovedEvent()
      return the index in the trace representing the event that was moved to get to this step.
      gnu.trove.TIntCollection getNextEvents​(Delegate<? extends Head,​? extends Tail> delegate, Trace trace)
      return the events in the trace that are currently enabled.
      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.
      Record getPredecessor()
      returns the predecessor record.
      long getState()
      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.
      double getTotalCost()
      Method should return sum of costSoFar and estimatedCost;
      boolean isExactEstimate()
      true if the last set estimate is exact.
      void setEstimatedRemainingCost​(double cost, boolean isExactEstimate)
      sets the estimate of the remaining cost.
      void setState​(long index)
      puts the index of the state corresponding to this record in the record.
    • Method Detail

      • 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 delegate
        trace - TODO
        trace - the index of the trace in the log
        modelMove - the index of the transition that needs to be fired (or Move.BOTTOM if none)
        activity - TODO
        event - 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: