Package org.chocosolver.memory.trailing
Class EnvironmentTrailing
- java.lang.Object
-
- org.chocosolver.memory.AbstractEnvironment
-
- org.chocosolver.memory.trailing.EnvironmentTrailing
-
- All Implemented Interfaces:
IEnvironment
public class EnvironmentTrailing extends AbstractEnvironment
The root class for managing memory and sessions. A environment is associated to each problem. It is responsible for managing backtrackable data.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleLOADFACTORThe load factor to updateIStorage.static intNBUPATESThe maximum numbers of updates that aIStoragecan handle.static intNBWORLDSThe maximum numbers of worlds that aIStoragecan handle.-
Fields inherited from class org.chocosolver.memory.AbstractEnvironment
currentWorld, timestamp
-
-
Constructor Summary
Constructors Constructor Description EnvironmentTrailing()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IStoredBoolTrailgetBoolTrail()IStoredDoubleTrailgetDoubleTrail()StoredDoubleVectorTrailgetDoubleVectorTrail()IStoredIntTrailgetIntTrail()StoredIntVectorTrailgetIntVectorTrail()IStoredLongTrailgetLongTrail()IOperationTrailgetOperationTrail()IStateBoolmakeBool(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 oldValue)Save this operation onto the stack of operations to undo on backtrack.voidsetBoolTrail(IStoredBoolTrail btrail)voidsetDoubleTrail(IStoredDoubleTrail dtrail)voidsetIntTrail(IStoredIntTrail itrail)voidsetLongTrail(IStoredLongTrail ltrail)voidsetOperationTrail(IOperationTrail otrail)voidworldCommit()Comitting the current world: merging it with the previous one.voidworldPop()Backtracks to the previous choice point in the search tree.voidworldPush()Starts a new branch in the search tree.-
Methods inherited from class org.chocosolver.memory.AbstractEnvironment
buildFakeHistoryOn, fakeHistoryNeeded, getSharedBipartiteSetForBooleanVars, getTimeStamp, getWorldIndex, makeBitSet, worldPopUntil
-
-
-
-
Field Detail
-
NBWORLDS
public static final int NBWORLDS
The maximum numbers of worlds that aIStoragecan handle.- See Also:
- Constant Field Values
-
NBUPATES
public static final int NBUPATES
The maximum numbers of updates that aIStoragecan handle.- See Also:
- Constant Field Values
-
LOADFACTOR
public static final double LOADFACTOR
The load factor to updateIStorage.- See Also:
- Constant Field Values
-
-
Method Detail
-
worldPush
public void worldPush()
Starts a new branch in the search tree.
-
worldPop
public void worldPop()
Backtracks to the previous choice point in the search tree.
-
worldCommit
public void worldCommit()
Comitting the current world: merging it with the previous one.Not used yet.
-
makeInt
public 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
public 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
-
makeBool
public 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
-
makeIntVector
public 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
public 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
-
makeFloat
public 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
public 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
public IStateLong makeLong()
Factory pattern: new backtrackable long attached to this environment.- Returns:
- a backtrackable long
-
makeLong
public IStateLong makeLong(long init)
Factory pattern: new backtrackable long attached to this environment.- Parameters:
init- its initial value- Returns:
- a backtrackable long
-
setIntTrail
public void setIntTrail(IStoredIntTrail itrail)
-
getIntTrail
public IStoredIntTrail getIntTrail()
-
setLongTrail
public void setLongTrail(IStoredLongTrail ltrail)
-
getLongTrail
public IStoredLongTrail getLongTrail()
-
setBoolTrail
public void setBoolTrail(IStoredBoolTrail btrail)
-
getBoolTrail
public IStoredBoolTrail getBoolTrail()
-
setDoubleTrail
public void setDoubleTrail(IStoredDoubleTrail dtrail)
-
getDoubleTrail
public IStoredDoubleTrail getDoubleTrail()
-
setOperationTrail
public void setOperationTrail(IOperationTrail otrail)
-
getOperationTrail
public IOperationTrail getOperationTrail()
-
getIntVectorTrail
public StoredIntVectorTrail getIntVectorTrail()
-
getDoubleVectorTrail
public StoredDoubleVectorTrail getDoubleVectorTrail()
-
save
public void save(IOperation oldValue)
Description copied from interface:IEnvironmentSave this operation onto the stack of operations to undo on backtrack.- Parameters:
oldValue- operation to undo
-
-