- Implement CS2 min-cost-flow adaptor and generalize common min-cost-flow stuff
[match/match.git] / program / Instance.hs
CommitLineData
fd0d2377
MM
1module Instance (module Instance, Wt) where
2import ProposalMatcherConfig (Wt)
967c39ef
MM
3import Data.Array.IArray
4import Data.Array.Unboxed
5import ArrayStuff
6import Formatter
7
967c39ef
MM
8data Instance = Instance
9 Int -- numReviewers
10 Int -- numProposals
11 (UArray Int Wt) -- ! reviewer -> relative load
12 (UArray (Int, Int) Wt) -- ! (reviewer, proposal) -> pref
13 deriving Eq
14
15instance Show Instance where
16 show (Instance numRvrs numProps loadA prefA) =
5a07db44
MM
17 let theRvrs = [0..numRvrs-1]; theProps = [0..numProps-1] in
18 "Instance with " ++ show numRvrs ++ " reviewers and " ++ show numProps ++ " proposals:\n" ++ formatTable (
19 ( "" : map (\i -> "R#" ++ show i ) theRvrs) :
20 ( "RLoad" : map (\i -> show (loadA ! i) ) theRvrs) :
21 map (\j -> ("P#" ++ show j) : map (\i -> show (prefA ! (i, j))) theRvrs) theProps
22 )