Class NetworkFlow

All Implemented Interfaces:
RemoveLevelLate, Stateful, UsesQueueVariable

public class NetworkFlow extends Constraint implements UsesQueueVariable, Stateful, RemoveLevelLate
The network flow constraint. Use the NetworkBuilder to create a network and instantiate the network.
Version:
4.10
  • 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

      static AtomicInteger idNumber
      Instance counter
    • network

      public final Pruning network
      The network
    • costVariable

      public IntVar costVariable
      The cost variable
    • map

      public final Map<IntVar,VarHandler> map
      The variables and their handlers
    • queue

      public final Set<IntVar> queue
      The set of queued variables
    • disableQueueVariable

      public boolean disableQueueVariable
      Disables the queue variable function during consistency
    • previousLevel

      public int previousLevel
  • Constructor Details

  • Method Details

    • getConsistencyPruningEvent

      public int getConsistencyPruningEvent(Var var)
      Description copied from class: Constraint
      It retrieves the pruning event which causes reevaluation of the constraint.
      Overrides:
      getConsistencyPruningEvent in class Constraint
      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 class Constraint
    • impose

      public void impose(Store store)
      Description copied from class: Constraint
      It imposes the constraint in a given store.
      Overrides:
      impose in class Constraint
      Parameters:
      store - the constraint store to which the constraint is imposed to.
    • queueVariable

      public void queueVariable(int level, Var variable)
      Search & Backtracking
      Overrides:
      queueVariable in class Constraint
      Parameters:
      level - the level of the store at which the change has occurred.
      variable - variable which has changed.
    • updateGraph

      private void updateGraph()
    • consistency

      public void consistency(Store store)
      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 class Constraint
      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 interface Stateful
      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 interface RemoveLevelLate
      Parameters:
      level - the level which is being removed.
    • toString

      public String toString()
      Identifiers
      Overrides:
      toString in class Constraint