49 template<
typename TCost>
82 return call(G, lowerBound, upperBound, cost, supply, flow, dual);
206 G,lowerBound,upperBound,cost,supply,flow,value);
212 template<
typename TCost>
253 template<
typename TCost>
264 if (lowerBound[e] > upperBound[e])
277 template<
typename TCost>
290 if (flow[e] < lowerBound[e] || upperBound[e] < flow[e]) {
294 value += flow[e] * cost[e];
313 if (sum != supply[v]) {
static void generateProblem(Graph &G, int n, int m, EdgeArray< int > &lowerBound, EdgeArray< int > &upperBound, EdgeArray< TCost > &cost, NodeArray< int > &supply)
Generates an instance of a min-cost flow problem with n nodes and m + n edges.
Declaration of graph generators.
node pred() const
Returns the predecessor in the list of all nodes.
edge theEdge() const
Returns the edge associated with this adjacency entry.
Data type for general directed graphs (adjacency list representation).
virtual ~MinCostFlowModule()
int randomNumber(int low, int high)
Returns random integer between low and high (including).
MinCostFlowModule()
Initializes a min-cost flow module.
Interface for min-cost flow algorithms.
node firstNode() const
Returns the first node in the list of all nodes.
node succ() const
Returns the successor in the list of all nodes.
static bool checkProblem(const Graph &G, const EdgeArray< int > &lowerBound, const EdgeArray< int > &upperBound, const NodeArray< int > &supply)
Checks if a given min-cost flow problem instance satisfies the preconditions.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
virtual bool call(const Graph &G, const EdgeArray< int > &lowerBound, const EdgeArray< int > &upperBound, const EdgeArray< TCost > &cost, const NodeArray< int > &supply, EdgeArray< int > &flow)
Computes a min-cost flow in the directed graph G.
edge newEdge(node v, node w)
Creates a new edge (v,w) and returns it.
Class for the representation of edges.
Class for the representation of nodes.
node lastNode() const
Returns the last node in the list of all nodes.
static bool checkComputedFlow(const Graph &G, const EdgeArray< int > &lowerBound, const EdgeArray< int > &upperBound, const EdgeArray< TCost > &cost, const NodeArray< int > &supply, const EdgeArray< int > &flow)
checks if a computed flow is a feasible solution to the given problem instance.
void randomGraph(Graph &G, int n, int m)
Creates a random graph.
Includes declaration of graph class.
bool isSelfLoop() const
Returns true iff the edge is a self-loop (source node = target node).
Declaration of simple graph algorithms.
static bool checkComputedFlow(const Graph &G, const EdgeArray< int > &lowerBound, const EdgeArray< int > &upperBound, const EdgeArray< TCost > &cost, const NodeArray< int > &supply, const EdgeArray< int > &flow, TCost &value)
checks if a computed flow is a feasible solution to the given problem instance.
node source() const
Returns the source node of the edge.
The namespace for all OGDF objects.
Container::value_type sum(const Container &values)
Returns the sum of an iterable container of given values.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
bool isConnected(const Graph &G)
Returns true iff G is connected.
Class for adjacency list elements.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.