+prefBoringness cfg p = if prefIsVeryBoring cfg p then 2
+ else if prefIsBoring cfg p then 1 else 0
+prefExpertness cfg p = if prefIsExpert cfg p then 2
+ else if prefIsKnowledgeable cfg p then 1 else 0
+
+data REdge = REdge {
+ reIdx :: Int,
+ reCap :: Int,
+ reCost :: Wt
+}
+
+instance Show REdge where
+ show (REdge idx cap cost) = "#" ++ (show idx) ++ ": "
+ ++ (show cap) ++ " @ " ++ (show cost)
+
+data ReductionResult = ReductionResult {
+ rrGraph :: Gr () REdge,
+ rrSource :: Node,
+ rrSink :: Node,
+ rrEIdxBounds :: (Int, Int),
+ rrEDIdx :: (Int, Int) -> Int
+}
+
+-- Hack: show as much of the reduction result as we easily can
+data RR1 = RR1 (Gr () REdge) Node Node (Int, Int) deriving Show
+instance Show ReductionResult where
+ show (ReductionResult g so si eib _) = show (RR1 g so si eib)
+
+indexEdges :: Int -> [(Int, Int, REdge)] -> (Int, [(Int, Int, REdge)])
+indexEdges i [] = (i, [])
+indexEdges i ((v1, v2, re):es) =
+ let (imax, ies) = indexEdges (i+1) es in
+ (imax, (v1, v2, re{ reIdx = i }) : ies)
+
+doReduction :: PMConfig -> Instance -> ReductionResult
+doReduction cfg (Instance numRvrs numProps rloadA prefA) =