Package org.chocosolver.memory
Interface IEnvironment
-
- All Known Implementing Classes:
AbstractEnvironment,EnvironmentTrailing
public interface IEnvironmentAn 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 voidbuildFakeHistoryOn(ICondition condition)Force to build fake history when a stored object on a particular condition.booleanfakeHistoryNeeded()BasicIndexedBipartiteSetgetSharedBipartiteSetForBooleanVars()Factory pattern : shared IndexedBipartiteSet object is return by the environmentintgetTimeStamp()Return the current time stamp.intgetWorldIndex()Returns the world number.IStateBitSetmakeBitSet(int size)Factory pattern: new IStateBitSet objects are created by the environmentIStateBoolmakeBool(boolean initialValue)Factory pattern: new IStateBool objects are created by the environmentIStateDoubleVectormakeDoubleVector(int size, double initialValue)Factory pattern: new IStateDoubleVector objects are created by the environmentIStateDoublemakeFloat()Factory pattern: new StoredFloat objects are created by the environment (no initial value is assigned to the backtrackable search)IStateDoublemakeFloat(double initialValue)Factory pattern: new StoredFloat objects are created by the environmentIStateIntmakeInt()Factory pattern: new IStateInt objects are created by the environment (no initial value is assigned to the backtrackable search)IStateIntmakeInt(int initialValue)Factory pattern: new IStateInt objects are created by the environmentIStateIntVectormakeIntVector(int size, int initialValue)Factory pattern: new IStateIntVector objects are created by the environmentIStateLongmakeLong()Factory pattern: new backtrackable long attached to this environment.IStateLongmakeLong(long init)Factory pattern: new backtrackable long attached to this environment.voidsave(IOperation operation)Save this operation onto the stack of operations to undo on backtrack.voidworldCommit()Comitting the current world: merging it with the previous one.voidworldPop()Backtracks to the previous choice point in the search tree.voidworldPopUntil(int w)Backtracks to thewprevious choice point in the tree searchvoidworldPush()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 thewprevious 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 isICondition.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 vectorinitialValue- 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 vectorinitialValue- 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
-
-