Class NetworkBuilder

java.lang.Object
org.jacop.constraints.netflow.NetworkBuilder
Direct Known Subclasses:
Arithmetic.ArithmeticBuilder, SoftAlldifferent.SoftAlldiffBuilder, SoftGCC.SoftGCCBuilder

public class NetworkBuilder extends Object
A builder class for the network flow constraints. Models should use or inherit from this class to build a network.
Version:
4.9
  • Field Details

    • nextNodeName

      private int nextNodeName
    • costVariable

      public IntVar costVariable
    • nodeList

      public final List<Node> nodeList
    • arcList

      public final List<Arc> arcList
    • handlerList

      public final List<VarHandler> handlerList
  • Constructor Details

    • NetworkBuilder

      public NetworkBuilder()
    • NetworkBuilder

      public NetworkBuilder(IntVar costVariable)
  • Method Details

    • setCostVariable

      public void setCostVariable(IntVar costVariable)
    • addNode

      public Node addNode()
    • addNode

      public Node addNode(int balance)
    • addNode

      public Node addNode(String name)
    • addNode

      public Node addNode(String name, int balance)
    • addArc

      public Arc addArc(Node from, Node to, IntVar wVar, IntVar xVar)
    • addArc

      public Arc addArc(Node from, Node to, int weight, IntVar xVar)
    • addArc

      public Arc addArc(Node from, Node to, IntVar wVar, int lowerCapacity, int upperCapacity)
    • addArc

      public Arc addArc(Node from, Node to, int weight, int lowerCapacity, int upperCapacity)
    • addArc

      public Arc addArc(Node from, Node to, int weight, int capacity)
    • addArc

      public Arc addArc(Node from, Node to, int weight)
    • addArc

      public Arc addArc(Node from, Node to)
    • valueGraph

      public Node[][] valueGraph(IntVar[] vars, IntDomain[] domains)
      Returns two arrays containing the nodes for each variable and the nodes for each domain, respectively.
      Parameters:
      vars - varibales for nodes
      domains - nodes for each variable
      Returns:
      two arrays containing the nodes for each variable and the nodes for each domain, respectively
    • listVariables

      public ArrayList<IntVar> listVariables()
    • build

      public NetworkFlow build()
    • primitiveDecomposition

      public List<Constraint> primitiveDecomposition(Store store)
      Generally speaking, especially in case of multiple arcs between two nodes and structure constraints imposed on arcs makes it hard to decompose network flow constraint into primitive ones. Since, the decomposition introduces new variables and removal of artificial solutions is not practically achievable in all cases it is possible that decomposition will have more solutions due to the fact that decomposition may use more expensive arcs to transfer the flow.
      Parameters:
      store - current store
      Returns:
      decomposed network using primitive constraints
    • sumC

      private void sumC(List<Constraint> list, Store store, List<IntVar> vars, IntVar result)