Package org.chocosolver.memory
Class AbstractEnvironment
- java.lang.Object
-
- org.chocosolver.memory.AbstractEnvironment
-
- All Implemented Interfaces:
IEnvironment
- Direct Known Subclasses:
EnvironmentTrailing
public abstract class AbstractEnvironment extends Object implements IEnvironment
Super class of all environments !
-
-
Field Summary
Fields Modifier and Type Field Description protected int
currentWorld
protected int
timestamp
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEnvironment()
-
Method Summary
All Methods Instance Methods Concrete 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 StoredBitSetVector objects is return by the environmentint
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 environmentvoid
worldPopUntil(int w)
Backtracks to thew
previous choice point in the tree search-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.chocosolver.memory.IEnvironment
makeBool, makeDoubleVector, makeFloat, makeFloat, makeInt, makeInt, makeIntVector, makeLong, makeLong, save, worldCommit, worldPop, worldPush
-
-
-
-
Method Detail
-
getWorldIndex
public final int getWorldIndex()
Description copied from interface:IEnvironment
Returns the world number.- Specified by:
getWorldIndex
in interfaceIEnvironment
- Returns:
- current world index
-
getTimeStamp
public final int getTimeStamp()
Description copied from interface:IEnvironment
Return the current time stamp. It differs from world index since it never decrements.- Specified by:
getTimeStamp
in interfaceIEnvironment
- Returns:
- the timestamp
-
makeBitSet
public IStateBitSet makeBitSet(int size)
Factory pattern: new IStateBitSet objects are created by the environment- Specified by:
makeBitSet
in interfaceIEnvironment
- Parameters:
size
- initial size of the IStateBitSet- Returns:
- IStateBitSet
-
worldPopUntil
public void worldPopUntil(int w)
Backtracks to thew
previous choice point in the tree search- Specified by:
worldPopUntil
in interfaceIEnvironment
- Parameters:
w
- world index to pop to
-
getSharedBipartiteSetForBooleanVars
public final BasicIndexedBipartiteSet getSharedBipartiteSetForBooleanVars()
Factory pattern : shared StoredBitSetVector objects is return by the environment- Specified by:
getSharedBipartiteSetForBooleanVars
in interfaceIEnvironment
- Returns:
- a shared bipartite set
-
fakeHistoryNeeded
public boolean fakeHistoryNeeded()
- Specified by:
fakeHistoryNeeded
in interfaceIEnvironment
- Returns:
- true if building fake history is needed (the condition is satisfied).
-
buildFakeHistoryOn
public void buildFakeHistoryOn(ICondition condition)
Description copied from interface:IEnvironment
Force to build fake history when a stored object on a particular condition. The default condition isICondition.FALSE
.- Specified by:
buildFakeHistoryOn
in interfaceIEnvironment
- Parameters:
condition
- to satisfy to build fake history
-
-