Package org.jacop.constraints.netflow
Class ArcCompanion
java.lang.Object
org.jacop.constraints.netflow.ArcCompanion
- All Implemented Interfaces:
Comparable<ArcCompanion>
,VarHandler
This class extends the definition of an arc by a lower bound on the capacity
and connects the arc to variables that constrain it.
The ArcCompanion plays the role of the VarHandler for X- and W-variables. It also provides a hook for S-variables of any
- Version:
- 4.9
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Arc
The (forward) arcint
Identifier for this arc in the structure variableint
Current lower capacity of the arcint
The pruningScoreThe associated structure variableThe FDV for lower and upper costThe FDV for lower and upper capacity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeCapacity
(int min, int max) Changes the lower and upper capacity of the arc in any way, performing the necessary changes to node balance and flow offset functions.void
changeMaxCapacity
(int max) void
changeMinCapacity
(int min) int
compareTo
(ArcCompanion that) int
getPruningEvent
(Var var) Retrieves the consistency pruning event of a handler variable that causes the handler to be reevaluated.void
processEvent
(IntVar variable, MutableNetwork network) Informs the handler that one of its variable has changed and asks the handler to update the state of the network accordingly.void
restore
(MutableNetwork network) Restores the capacity and weight of the arc after backtracking.void
setFlow
(int flow) Forces the flow to a given value (within capacity bounds).toString()
private boolean
updateSVar
(int level) interaction with structure variable
-
Field Details
-
arc
The (forward) arc -
flowOffset
public int flowOffsetCurrent lower capacity of the arc -
xVar
The FDV for lower and upper capacity -
wVar
The FDV for lower and upper cost -
structure
The associated structure variable -
arcID
public int arcIDIdentifier for this arc in the structure variable -
pruningScore
public int pruningScoreThe pruningScore
-
-
Constructor Details
-
ArcCompanion
-
-
Method Details
-
toString
-
changeCapacity
public void changeCapacity(int min, int max) Changes the lower and upper capacity of the arc in any way, performing the necessary changes to node balance and flow offset functions.- Parameters:
min
- the new lower capacitymax
- the new upper capacity
-
changeMinCapacity
public void changeMinCapacity(int min) -
changeMaxCapacity
public void changeMaxCapacity(int max) -
listVariables
- Specified by:
listVariables
in interfaceVarHandler
- Returns:
- the list of variables handled by this handler
-
processEvent
Description copied from interface:VarHandler
Informs the handler that one of its variable has changed and asks the handler to update the state of the network accordingly.- Specified by:
processEvent
in interfaceVarHandler
- Parameters:
variable
- the variable that changednetwork
- the network
-
restore
Restores the capacity and weight of the arc after backtracking.- Parameters:
network
- the network
-
setFlow
public void setFlow(int flow) Forces the flow to a given value (within capacity bounds).- Parameters:
flow
- the new flow value
-
getPruningEvent
Description copied from interface:VarHandler
Retrieves the consistency pruning event of a handler variable that causes the handler to be reevaluated. For instance, X- and W-variables will listen to BOUND events while S-variables typically consider ANY events.- Specified by:
getPruningEvent
in interfaceVarHandler
- Parameters:
var
- a handler variable- Returns:
- the pruning event which causes reevaluation of the handler
-
updateSVar
private boolean updateSVar(int level) interaction with structure variable- Parameters:
level
- current store level- Returns:
- whether the domain of the s-variable has been updated
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ArcCompanion>
-