Commit | Line | Data |
---|---|---|
8c5ee850 | 1 | module Instance where |
967c39ef MM |
2 | import Data.Array.IArray |
3 | import Data.Array.Unboxed | |
4 | import ArrayStuff | |
5 | import Formatter | |
6 | ||
8c5ee850 MM |
7 | type Wt = Double -- Can be any RealFrac. |
8 | numAsWt x = fromInteger (toInteger x) | |
9 | ||
967c39ef MM |
10 | data Instance = Instance |
11 | Int -- numReviewers | |
12 | Int -- numProposals | |
13 | (UArray Int Wt) -- ! reviewer -> relative load | |
14 | (UArray (Int, Int) Wt) -- ! (reviewer, proposal) -> pref | |
15 | deriving Eq | |
16 | ||
17 | instance Show Instance where | |
18 | show (Instance numRvrs numProps loadA prefA) = | |
5a07db44 MM |
19 | let theRvrs = [0..numRvrs-1]; theProps = [0..numProps-1] in |
20 | "Instance with " ++ show numRvrs ++ " reviewers and " ++ show numProps ++ " proposals:\n" ++ formatTable ( | |
21 | ( "" : map (\i -> "R#" ++ show i ) theRvrs) : | |
22 | ( "RLoad" : map (\i -> show (loadA ! i) ) theRvrs) : | |
23 | map (\j -> ("P#" ++ show j) : map (\i -> show (prefA ! (i, j))) theRvrs) theProps | |
24 | ) |