Package org.jacop.constraints.netflow
Class NetworkBuilder
- java.lang.Object
-
- org.jacop.constraints.netflow.NetworkBuilder
-
- Direct Known Subclasses:
Arithmetic.ArithmeticBuilder,SoftAlldifferent.SoftAlldiffBuilder,SoftGCC.SoftGCCBuilder
public class NetworkBuilder extends java.lang.ObjectA builder class for the network flow constraints. Models should use or inherit from this class to build a network.- Version:
- 4.8
-
-
Field Summary
Fields Modifier and Type Field Description java.util.List<Arc>arcListIntVarcostVariablejava.util.List<VarHandler>handlerListprivate intnextNodeNamejava.util.List<Node>nodeList
-
Constructor Summary
Constructors Constructor Description NetworkBuilder()NetworkBuilder(IntVar costVariable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArcaddArc(Node from, Node to)ArcaddArc(Node from, Node to, int weight)ArcaddArc(Node from, Node to, int weight, int capacity)ArcaddArc(Node from, Node to, int weight, int lowerCapacity, int upperCapacity)ArcaddArc(Node from, Node to, int weight, IntVar xVar)ArcaddArc(Node from, Node to, IntVar wVar, int lowerCapacity, int upperCapacity)ArcaddArc(Node from, Node to, IntVar wVar, IntVar xVar)NodeaddNode()NodeaddNode(int balance)NodeaddNode(java.lang.String name)NodeaddNode(java.lang.String name, int balance)NetworkFlowbuild()java.util.ArrayList<IntVar>listVariables()java.util.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.voidsetCostVariable(IntVar costVariable)private voidsumC(java.util.List<Constraint> list, Store store, java.util.List<IntVar> vars, IntVar result)Node[][]valueGraph(IntVar[] vars, IntDomain[] domains)Returns two arrays containing the nodes for each variable and the nodes for each domain, respectively.
-
-
-
Field Detail
-
nextNodeName
private int nextNodeName
-
costVariable
public IntVar costVariable
-
nodeList
public final java.util.List<Node> nodeList
-
arcList
public final java.util.List<Arc> arcList
-
handlerList
public final java.util.List<VarHandler> handlerList
-
-
Constructor Detail
-
NetworkBuilder
public NetworkBuilder()
-
NetworkBuilder
public NetworkBuilder(IntVar costVariable)
-
-
Method Detail
-
setCostVariable
public void setCostVariable(IntVar costVariable)
-
addNode
public Node addNode()
-
addNode
public Node addNode(int balance)
-
addNode
public Node addNode(java.lang.String name)
-
addNode
public Node addNode(java.lang.String name, int balance)
-
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 nodesdomains- nodes for each variable- Returns:
- two arrays containing the nodes for each variable and the nodes for each domain, respectively
-
listVariables
public java.util.ArrayList<IntVar> listVariables()
-
build
public NetworkFlow build()
-
primitiveDecomposition
public java.util.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(java.util.List<Constraint> list, Store store, java.util.List<IntVar> vars, IntVar result)
-
-