- 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 double
LOADFACTOR
The load factor to updateIStorage
.static int
NBUPATES
The maximum numbers of updates that aIStorage
can handle.static int
NBWORLDS
The maximum numbers of worlds that aIStorage
can 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 IStoredBoolTrail
getBoolTrail()
IStoredDoubleTrail
getDoubleTrail()
StoredDoubleVectorTrail
getDoubleVectorTrail()
IStoredIntTrail
getIntTrail()
StoredIntVectorTrail
getIntVectorTrail()
IStoredLongTrail
getLongTrail()
IOperationTrail
getOperationTrail()
IStateBool
makeBool(boolean initialValue)
Factory pattern: new IStateBool objects are created by the environmentIStateDoubleVector
makeDoubleVector(int size, double initialValue)
Factory pattern: new IStateDoubleVector objects are created by the environmentIStateDouble
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 environmentIStateInt
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 environmentIStateIntVector
makeIntVector(int size, int initialValue)
Factory pattern: new IStateIntVector objects are created by the environmentIStateLong
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 oldValue)
Save this operation onto the stack of operations to undo on backtrack.void
setBoolTrail(IStoredBoolTrail btrail)
void
setDoubleTrail(IStoredDoubleTrail dtrail)
void
setIntTrail(IStoredIntTrail itrail)
void
setLongTrail(IStoredLongTrail ltrail)
void
setOperationTrail(IOperationTrail otrail)
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
worldPush()
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 aIStorage
can handle.- See Also:
- Constant Field Values
-
NBUPATES
public static final int NBUPATES
The maximum numbers of updates that aIStorage
can 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:IEnvironment
Save this operation onto the stack of operations to undo on backtrack.- Parameters:
oldValue
- operation to undo
-
-