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
      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 saveAt​(IOperation operation, int worldIndex)
      Save this operation onto the stack of operations to undo on backtrack, at level `worldIndex`.
      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.

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

        void saveAt​(IOperation operation,
                    int worldIndex)
        Save this operation onto the stack of operations to undo on backtrack, at level `worldIndex`.
        Parameters:
        operation - operation to undo
        worldIndex - when to apply this
      • getTimeStamp

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