95e00ee8e01a811a9a7127f59987023dcf7b27eb
[match/match.git] / program / Instance.hs
1 module Instance where
2 import Data.Array.IArray
3 import Data.Array.Unboxed
4 import ArrayStuff
5 import Formatter
6
7 type Wt = Double -- must implement RealFrac
8
9 data Instance = Instance
10         Int                 -- numReviewers
11         Int                 -- numProposals
12         (UArray Int Wt)     -- ! reviewer -> relative load
13         (UArray (Int, Int) Wt) -- ! (reviewer, proposal) -> pref
14         deriving Eq
15
16 instance Show Instance where
17         show (Instance numRvrs numProps loadA prefA) =
18                 "Instance: " ++ show numRvrs ++ " reviewers, " ++ show numProps ++ " proposals\n"
19                 ++ "Reviewer relative load: " ++ show loadA ++ "\n"
20                 ++ "Preferences:\n"
21                 ++ formatTable (array2DtoListOfLists (amap2 show prefA :: Array (Int, Int) String))