FlowConstraint(G, f, source, sink, flow_value, capacity=None, graphName='')¶
Network flow constraint.
Constraintimplementations, this one is instanciated by the user (via a wrapper function), so it is raising exceptions instead of making assertions.
Network flow constraint conversion.
__init__(G, f, source, sink, flow_value, capacity=None, graphName='')¶
Construct a network flow constraint.
G (networkx DiGraph.) – A directed graph.
f (dict) – A dictionary of variables indexed by the edges of
source – Either a node of
Gor a list of nodes in case of a multi-source flow.
sink – Either a node of
Gor a list of nodes in case of a multi-sink flow.
flow_value – The value of the flow, or a list of values in case of a single-source/multi-sink flow. In the latter case, the values represent the demands of each sink (resp. of each source for a multi-source/single-sink flow). The values can be either constants or
capacity – Either
Noneor a string. If this is a string, it indicates the key of the edge dictionaries of
Gthat is used for the capacity of the links. Otherwise, edges have an unbounded capacity.
graphName (str) – Name of the graph as used in the string representation of the constraint.
Draw the graph.