Package org.jacop.constraints.netflow
Class NetworkFlow
java.lang.Object
org.jacop.constraints.DecomposedConstraint<Constraint>
org.jacop.constraints.Constraint
org.jacop.constraints.netflow.NetworkFlow
- All Implemented Interfaces:
RemoveLevelLate
,Stateful
,UsesQueueVariable
The network flow constraint. Use the NetworkBuilder to create a network and
instantiate the network.
- Version:
- 4.9
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe cost variableboolean
Disables the queue variable function during consistencyprivate static final boolean
(package private) static AtomicInteger
Instance counterfinal Map<IntVar,
VarHandler> The variables and their handlersfinal Pruning
The networkint
The set of queued variablesprivate static final int
private static final boolean
(package private) Statistics
Fields inherited from class org.jacop.constraints.Constraint
atomicExecution, consistencyPruningEvents, constraintScope, earlyTerminationOK, increaseWeight, numberId, scope, trace
Fields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
NetworkFlow
(List<Node> nodes, List<Arc> arcs, List<VarHandler> flowVariables, IntVar costVariable) InitializationNetworkFlow
(NetworkBuilder builder) -
Method Summary
Modifier and TypeMethodDescriptionvoid
consistency
(Store store) It is a (most probably incomplete) consistency function which removes the values from variables domains.int
It retrieves the pruning event which causes reevaluation of the constraint.int
void
It imposes the constraint in a given store.void
queueVariable
(int level, Var variable) Search & Backtrackingvoid
removeLevel
(int level) This function is called in case of the backtrack, so a constraint can clear the queue of changed variables which is no longer valid.void
removeLevelLate
(int level) This function is called in case of the backtrack.toString()
Identifiersprivate void
Methods inherited from class org.jacop.constraints.Constraint
afc, arguments, cleanAfterFailure, decompose, getGuideConstraint, getGuideValue, getGuideVariable, grounded, grounded, id, impose, imposeDecomposition, increaseWeight, intArrayToString, long2int, numberArgs, removeConstraint, requiresMonotonicity, setConsistencyPruningEvent, setConstraintScope, setScope, setScope, setScope, setScope, setScope, setWatchedVariableGrounded, supplyGuideFeedback, updateAFC, watchedVariableGrounded
Methods inherited from class org.jacop.constraints.DecomposedConstraint
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jacop.api.Stateful
isStateful
-
Field Details
-
QUEUE_INDEX
private static final int QUEUE_INDEX- See Also:
-
DO_INSTRUMENTATION
private static final boolean DO_INSTRUMENTATION- See Also:
-
SHOW_LEVEL
private static final boolean SHOW_LEVEL- See Also:
-
statistics
Statistics statistics -
idNumber
Instance counter -
network
The network -
costVariable
The cost variable -
map
The variables and their handlers -
queue
The set of queued variables -
disableQueueVariable
public boolean disableQueueVariableDisables the queue variable function during consistency -
previousLevel
public int previousLevel
-
-
Constructor Details
-
Method Details
-
getConsistencyPruningEvent
Description copied from class:Constraint
It retrieves the pruning event which causes reevaluation of the constraint.- Overrides:
getConsistencyPruningEvent
in classConstraint
- Parameters:
var
- variable for which pruning event is retrieved- Returns:
- it returns the int code of the pruning event (GROUND, BOUND, ANY, NONE)
-
getDefaultConsistencyPruningEvent
public int getDefaultConsistencyPruningEvent()- Specified by:
getDefaultConsistencyPruningEvent
in classConstraint
-
impose
Description copied from class:Constraint
It imposes the constraint in a given store.- Overrides:
impose
in classConstraint
- Parameters:
store
- the constraint store to which the constraint is imposed to.
-
queueVariable
Search & Backtracking- Overrides:
queueVariable
in classConstraint
- Parameters:
level
- the level of the store at which the change has occurred.variable
- variable which has changed.
-
updateGraph
private void updateGraph() -
consistency
Description copied from class:Constraint
It is a (most probably incomplete) consistency function which removes the values from variables domains. Only values which do not have any support in a solution space are removed.- Specified by:
consistency
in classConstraint
- Parameters:
store
- constraint store within which the constraint consistency is being checked.
-
removeLevel
public void removeLevel(int level) Description copied from interface:Stateful
This function is called in case of the backtrack, so a constraint can clear the queue of changed variables which is no longer valid. This function is called *before* all timestamps, variables, mutablevariables have reverted to their previous value.- Specified by:
removeLevel
in interfaceStateful
- Parameters:
level
- the level which is being removed.
-
removeLevelLate
public void removeLevelLate(int level) Description copied from interface:RemoveLevelLate
This function is called in case of the backtrack. It is called after all timestamps, variables, mutablevariables have reverted to their values *after* removing the level.- Specified by:
removeLevelLate
in interfaceRemoveLevelLate
- Parameters:
level
- the level which is being removed.
-
toString
Identifiers- Overrides:
toString
in classConstraint
-