Class PRecord

  • All Implemented Interfaces:
    nl.tue.astar.Record

    public class PRecord
    extends java.lang.Object
    implements nl.tue.astar.Record
    • Constructor Summary

      Constructors 
      Constructor Description
      PRecord​(int cost, PRecord predecessor, int markingsize, int traceLength)  
      PRecord​(long state, int cost, PRecord predecessor, int logMove, int modelMove, int markingsize, int backtrace, nl.tue.storage.compressor.BitMask executed)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      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
      static <P extends PRecord>
      java.util.List<P>
      getHistory​(P r)  
      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​(nl.tue.astar.Delegate<? extends nl.tue.astar.Head,​? extends nl.tue.astar.Tail> delegate, nl.tue.astar.Trace trace)
      return the events in the trace that are currently enabled.
      PRecord getNextRecord​(nl.tue.astar.Delegate<? extends nl.tue.astar.Head,​? extends nl.tue.astar.Tail> d, nl.tue.astar.Trace trace, nl.tue.astar.Head nextHead, long state, int modelMove, int movedEvent, int activity)
      In case of a LogMove only, then logMove>=0, modelMove == AStarThread.NOMOVE, In case of a ModelMove only, then logMove == AStarThread.NOMOVE, modelMove >=0, in case of both log and model move, then logMove>=0, modelMove>=0,
      PRecord getPredecessor()
      returns the predecessor record.
      long getState()
      Returns the index of the state for which this record is kept.
      <H extends nl.tue.astar.Head,​T extends nl.tue.astar.Tail>
      nl.tue.astar.impl.State<H,​T>
      getState​(nl.tue.storage.CompressedStore<nl.tue.astar.impl.State<H,​T>> storage)
      retrieves the state stored at index getState() from the storage.
      double getTotalCost()
      Method should return sum of costSoFar and estimatedCost;
      int hashCode()  
      boolean isExactEstimate()
      true if the last set estimate is exact.
      static void printRecord​(AbstractPDelegate<?> delegate, int trace, PRecord r)  
      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.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • state

        protected long state
      • estimate

        protected double estimate
      • cost

        protected final int cost
      • predecessor

        protected final PRecord predecessor
      • logMove

        protected final int logMove
      • modelMove

        protected final int modelMove
      • backtrace

        protected final int backtrace
      • executed

        protected final nl.tue.storage.compressor.BitMask executed
      • exact

        protected boolean exact
    • Constructor Detail

      • PRecord

        public PRecord​(long state,
                       int cost,
                       PRecord predecessor,
                       int logMove,
                       int modelMove,
                       int markingsize,
                       int backtrace,
                       nl.tue.storage.compressor.BitMask executed)
      • PRecord

        public PRecord​(int cost,
                       PRecord predecessor,
                       int markingsize,
                       int traceLength)
    • Method Detail

      • getState

        public <H extends nl.tue.astar.Head,​T extends nl.tue.astar.Tail> nl.tue.astar.impl.State<H,​T> getState​(nl.tue.storage.CompressedStore<nl.tue.astar.impl.State<H,​T>> storage)
                                                                                                                    throws nl.tue.storage.StorageException
        Description copied from interface: nl.tue.astar.Record
        retrieves the state stored at index getState() from the storage.
        Specified by:
        getState in interface nl.tue.astar.Record
        Returns:
        Throws:
        nl.tue.storage.StorageException
      • getState

        public long getState()
        Description copied from interface: nl.tue.astar.Record
        Returns the index of the state for which this record is kept.
        Specified by:
        getState in interface nl.tue.astar.Record
        Returns:
      • getCostSoFar

        public int getCostSoFar()
        Description copied from interface: nl.tue.astar.Record
        returns the cost so far for reaching the corresponding state
        Specified by:
        getCostSoFar in interface nl.tue.astar.Record
        Returns:
      • getPredecessor

        public PRecord getPredecessor()
        Description copied from interface: nl.tue.astar.Record
        returns the predecessor record.
        Specified by:
        getPredecessor in interface nl.tue.astar.Record
        Returns:
      • getTotalCost

        public double getTotalCost()
        Description copied from interface: nl.tue.astar.Record
        Method should return sum of costSoFar and estimatedCost;
        Specified by:
        getTotalCost in interface nl.tue.astar.Record
      • setState

        public void setState​(long index)
        Description copied from interface: nl.tue.astar.Record
        puts the index of the state corresponding to this record in the record.
        Specified by:
        setState in interface nl.tue.astar.Record
      • getNextRecord

        public PRecord getNextRecord​(nl.tue.astar.Delegate<? extends nl.tue.astar.Head,​? extends nl.tue.astar.Tail> d,
                                     nl.tue.astar.Trace trace,
                                     nl.tue.astar.Head nextHead,
                                     long state,
                                     int modelMove,
                                     int movedEvent,
                                     int activity)
        In case of a LogMove only, then logMove>=0, modelMove == AStarThread.NOMOVE, In case of a ModelMove only, then logMove == AStarThread.NOMOVE, modelMove >=0, in case of both log and model move, then logMove>=0, modelMove>=0,
        Specified by:
        getNextRecord in interface nl.tue.astar.Record
        Parameters:
        d - the delegate
        trace - TODO
        modelMove - the index of the transition that needs to be fired (or Move.BOTTOM if none)
        activity - TODO
        Returns:
      • getEstimatedRemainingCost

        public double getEstimatedRemainingCost()
        Description copied from interface: nl.tue.astar.Record
        returns an underestimate for the remaining cost
        Specified by:
        getEstimatedRemainingCost in interface nl.tue.astar.Record
        Returns:
      • setEstimatedRemainingCost

        public void setEstimatedRemainingCost​(double cost,
                                              boolean isExactEstimate)
        Description copied from interface: nl.tue.astar.Record
        sets the estimate of the remaining cost. The method should not be called by classes other than implementations of the AStarThread
        Specified by:
        setEstimatedRemainingCost in interface nl.tue.astar.Record
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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

        public int getModelMove()
        Description copied from interface: nl.tue.astar.Record
        return the id of the modelmove used to reach this record from previous.If none, then Move.BOTTOM is returned
        Specified by:
        getModelMove in interface nl.tue.astar.Record
        Returns:
      • getHistory

        public static <P extends PRecord> java.util.List<P> getHistory​(P r)
      • getMovedEvent

        public int getMovedEvent()
        Description copied from interface: nl.tue.astar.Record
        return the index in the trace representing the event that was moved to get to this step. If none, then Move.BOTTOM is returned
        Specified by:
        getMovedEvent in interface nl.tue.astar.Record
        Returns:
      • getNextEvents

        public gnu.trove.TIntCollection getNextEvents​(nl.tue.astar.Delegate<? extends nl.tue.astar.Head,​? extends nl.tue.astar.Tail> delegate,
                                                      nl.tue.astar.Trace trace)
        Description copied from interface: nl.tue.astar.Record
        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.
        Specified by:
        getNextEvents in interface nl.tue.astar.Record
        trace - TODO
        Returns:
      • getBacktraceSize

        public int getBacktraceSize()
        Description copied from interface: nl.tue.astar.Record
        returns the length of the path from this record to the root of the search
        Specified by:
        getBacktraceSize in interface nl.tue.astar.Record
        Returns:
      • isExactEstimate

        public boolean isExactEstimate()
        Description copied from interface: nl.tue.astar.Record
        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
        Specified by:
        isExactEstimate in interface nl.tue.astar.Record
        Returns: