Interface IEnvironment

  • All Known Implementing Classes:
    AbstractEnvironment, EnvironmentTrailing

    public interface IEnvironment
    An interface to ease declaration of backtrackable objects (mostly primitives).
    Author:
    Charles Prud'homme, Hadrien Cambazard, Guillaume Rochart
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void buildFakeHistoryOn​(ICondition condition)
      Force to build fake history when a stored object on a particular condition.
      boolean fakeHistoryNeeded()  
      BasicIndexedBipartiteSet getSharedBipartiteSetForBooleanVars()
      Factory pattern : shared IndexedBipartiteSet object is return by the environment
      int getTimeStamp()
      Return the current time stamp.
      int getWorldIndex()
      Returns the world number.
      IStateBitSet makeBitSet​(int size)
      Factory pattern: new IStateBitSet objects are created by the environment
      IStateBool makeBool​(boolean initialValue)
      Factory pattern: new IStateBool objects are created by the environment
      IStateDoubleVector makeDoubleVector​(int size, double initialValue)
      Factory pattern: new IStateDoubleVector objects are created by the environment
      IStateDouble makeFloat()
      Factory pattern: new StoredFloat objects are created by the environment (no initial value is assigned to the backtrackable search)
      IStateDouble makeFloat​(double initialValue)
      Factory pattern: new StoredFloat objects are created by the environment
      IStateInt makeInt()
      Factory pattern: new IStateInt objects are created by the environment (no initial value is assigned to the backtrackable search)
      IStateInt makeInt​(int initialValue)
      Factory pattern: new IStateInt objects are created by the environment
      IStateIntVector makeIntVector​(int size, int initialValue)
      Factory pattern: new IStateIntVector objects are created by the environment
      IStateLong makeLong()
      Factory pattern: new backtrackable long attached to this environment.
      IStateLong makeLong​(long init)
      Factory pattern: new backtrackable long attached to this environment.
      void save​(IOperation operation)
      Save this operation onto the stack of operations to undo on backtrack.
      void worldCommit()
      Comitting the current world: merging it with the previous one.
      void worldPop()
      Backtracks to the previous choice point in the search tree.
      void worldPopUntil​(int w)
      Backtracks to the w previous choice point in the tree search
      void worldPush()
      Starts a new branch in the search tree.
    • Method Detail

      • getWorldIndex

        int getWorldIndex()
        Returns the world number.
        Returns:
        current world index
      • worldPush

        void worldPush()
        Starts a new branch in the search tree.
      • worldPop

        void worldPop()
        Backtracks to the previous choice point in the search tree.
      • worldPopUntil

        void worldPopUntil​(int w)
        Backtracks to the w previous choice point in the tree search
        Parameters:
        w - world index to pop to
      • worldCommit

        void worldCommit()
        Comitting the current world: merging it with the previous one.

        Not used yet.

      • buildFakeHistoryOn

        void buildFakeHistoryOn​(ICondition condition)
        Force to build fake history when a stored object on a particular condition. The default condition is ICondition.FALSE.
        Parameters:
        condition - to satisfy to build fake history
      • fakeHistoryNeeded

        boolean fakeHistoryNeeded()
        Returns:
        true if building fake history is needed (the condition is satisfied).
      • makeBool

        IStateBool makeBool​(boolean initialValue)
        Factory pattern: new IStateBool objects are created by the environment
        Parameters:
        initialValue - the initial value of the backtrackable boolean
        Returns:
        Boolean object created by the environment
      • makeInt

        IStateInt makeInt()
        Factory pattern: new IStateInt objects are created by the environment (no initial value is assigned to the backtrackable search)
        Returns:
        new IStateInt computed by the environment
      • makeInt

        IStateInt makeInt​(int initialValue)
        Factory pattern: new IStateInt objects are created by the environment
        Parameters:
        initialValue - the initial value of the backtrackable integer
        Returns:
        new IStateInt computed by the environment
      • makeFloat

        IStateDouble makeFloat()
        Factory pattern: new StoredFloat objects are created by the environment (no initial value is assigned to the backtrackable search)
        Returns:
        new IStateDouble computed by the environment
      • makeFloat

        IStateDouble makeFloat​(double initialValue)
        Factory pattern: new StoredFloat objects are created by the environment
        Parameters:
        initialValue - the initial value of the backtrackable search
        Returns:
        new IStateDouble computed by the environment
      • makeLong

        IStateLong makeLong()
        Factory pattern: new backtrackable long attached to this environment.
        Returns:
        a backtrackable long
      • makeLong

        IStateLong makeLong​(long init)
        Factory pattern: new backtrackable long attached to this environment.
        Parameters:
        init - its initial value
        Returns:
        a backtrackable long
      • makeBitSet

        IStateBitSet makeBitSet​(int size)
        Factory pattern: new IStateBitSet objects are created by the environment
        Parameters:
        size - initial size of the IStateBitSet
        Returns:
        IStateBitSet
      • makeIntVector

        IStateIntVector makeIntVector​(int size,
                                      int initialValue)
        Factory pattern: new IStateIntVector objects are created by the environment
        Parameters:
        size - the number of entries in the vector
        initialValue - the common initial value for all entries (backtrackable integers)
        Returns:
        a backtrackable vector
      • makeDoubleVector

        IStateDoubleVector makeDoubleVector​(int size,
                                            double initialValue)
        Factory pattern: new IStateDoubleVector objects are created by the environment
        Parameters:
        size - the number of entries in the vector
        initialValue - the common initial value for all entries (backtrackable integers)
        Returns:
        IStateDoubleVector
      • getSharedBipartiteSetForBooleanVars

        BasicIndexedBipartiteSet getSharedBipartiteSetForBooleanVars()
        Factory pattern : shared IndexedBipartiteSet object is return by the environment
        Returns:
        IndexedBipartiteSet
      • save

        void save​(IOperation operation)
        Save this operation onto the stack of operations to undo on backtrack.
        Parameters:
        operation - operation to undo
      • getTimeStamp

        int getTimeStamp()
        Return the current time stamp. It differs from world index since it never decrements.
        Returns:
        the timestamp