- Implement CS2 min-cost-flow adaptor and generalize common min-cost-flow stuff
[match/match.git] / program / IMinCostFlow.hs
diff --git a/program/IMinCostFlow.hs b/program/IMinCostFlow.hs
new file mode 100644 (file)
index 0000000..edd43a2
--- /dev/null
@@ -0,0 +1,16 @@
+module IMinCostFlow where
+import Data.Array.IArray
+import Data.Graph.Inductive.Graph
+
+type MinCostFlowImpl1 gr a b i f c =
+       (i, i)       -> -- Range of edge indices
+       (b -> i)     -> -- Edge label -> unique edge index
+       (b -> f)     -> -- Edge label -> flow capacity
+       (b -> c)     -> -- Edge label -> cost per unit of flow
+       gr a b       -> -- Graph
+       (Node, Node) -> -- (source, sink)
+       Array i f       -- ! edge index -> flow value
+
+type MinCostFlowImpl =
+       forall gr a b i f c. (Graph gr, Ix i, Real f, Real c) =>
+       MinCostFlowImpl1 gr a b i f c