public class DecisionPath extends DecisionMaker implements Serializable
Decisions are added to this set of decisions with a call to pushDecision(Decision)
,
Decisions are then applied in a call to buildNext()
and apply()
,
and removed in a call to synchronize()
.
Only one decision can be added at the same level.
The last declared will erased the previous ones.
Only one decision is applied/removed at a time.
First decision is always RootDecision.ROOT
, so, size()
returns at least 1.
Project: choco-solver.
Constructor and Description |
---|
DecisionPath(IEnvironment environment)
Create a decision path
|
Modifier and Type | Method and Description |
---|---|
void |
apply()
Apply decision pushed since the last call to this method.
|
void |
buildNext()
Prepare the last decision pushed since the last call to this method to be applied.
|
Decision |
getDecision(int i)
Return the decision in position i in this decision path, or null if no decision exists at that position.
|
Decision |
getLastDecision()
Retrieves, but not removes, the last decision of the decision path.
|
String |
lastDecisionToString() |
void |
pushDecision(Decision decision)
Add a decision at the decision path.
|
int |
size()
Return the number of decision in this decision path.
|
void |
synchronize()
Synchronizes the decision path after a backtrack.
|
void |
synchronize(boolean free)
Synchronizes the decision path after a backtrack.
|
String |
toString() |
void |
transferInto(Collection<Decision> aList,
boolean includeRootDecision)
Add all decisions of this decision path into a list of decision
|
makeIntDecision, makeRealDecision, makeSetDecision
public DecisionPath(IEnvironment environment)
environment
- backtracking environmentpublic void buildNext()
public void apply() throws ContradictionException
buildNext()
.ContradictionException
- if one decision application failspublic void pushDecision(Decision decision)
decision
- the decision to addpublic void synchronize()
RootDecision.ROOT
, can not be removed from this.public void synchronize(boolean free)
RootDecision.ROOT
, can not be removed from this.free
- set to true to synchronize and free out-dated decisionspublic Decision getLastDecision()
RootDecision.ROOT
.public int size()
RootDecision.ROOT
.public Decision getDecision(int i)
i
- index of the decision to returnIndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size())public void transferInto(Collection<Decision> aList, boolean includeRootDecision)
aList
- list to populateincludeRootDecision
- set to true to include the very first fake decision, ROOT, in the list.public String lastDecisionToString()
Copyright © 2018. All rights reserved.