JaCoP.constraints.netflow
Class ArcCompanion

java.lang.Object
  extended by JaCoP.constraints.netflow.ArcCompanion
All Implemented Interfaces:
VarHandler, java.lang.Comparable<ArcCompanion>

public final class ArcCompanion
extends java.lang.Object
implements VarHandler, java.lang.Comparable<ArcCompanion>

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:
3.1
Author:
Robin Steiger and Radoslaw Szymanek

Field Summary
 Arc arc
          The (forward) arc
 int arcID
          Identifier for this arc in the structure variable
 int flowOffset
          Current lower capacity of the arc
 int pruningScore
          The pruningScore
 DomainStructure structure
          The associated structure variable
 IntVar wVar
          The FDV for lower and upper cost
 IntVar xVar
          The FDV for lower and upper capacity
 
Constructor Summary
ArcCompanion(Arc arc, int offset)
           
 
Method Summary
 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.
 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.
 java.util.List<IntVar> listVariables()
           
 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).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

arc

public final Arc arc
The (forward) arc


flowOffset

public int flowOffset
Current lower capacity of the arc


xVar

public IntVar xVar
The FDV for lower and upper capacity


wVar

public IntVar wVar
The FDV for lower and upper cost


structure

public DomainStructure structure
The associated structure variable


arcID

public int arcID
Identifier for this arc in the structure variable


pruningScore

public int pruningScore
The pruningScore

Constructor Detail

ArcCompanion

public ArcCompanion(Arc arc,
                    int offset)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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 capacity
max - the new upper capacity

changeMinCapacity

public void changeMinCapacity(int min)

changeMaxCapacity

public void changeMaxCapacity(int max)

listVariables

public java.util.List<IntVar> listVariables()
Specified by:
listVariables in interface VarHandler
Returns:
the list of variables handled by this handler

processEvent

public void processEvent(IntVar variable,
                         MutableNetwork network)
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 interface VarHandler
Parameters:
variable - the variable that changed
network - the network

restore

public void restore(MutableNetwork network)
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

public int getPruningEvent(Var var)
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 interface VarHandler
Parameters:
var - a handler variable
Returns:
the pruning event which causes reevaluation of the handler

compareTo

public int compareTo(ArcCompanion that)
Specified by:
compareTo in interface java.lang.Comparable<ArcCompanion>