The random instance generator and other improvements.
[match/match.git] / program / Instance.hs
diff --git a/program/Instance.hs b/program/Instance.hs
new file mode 100644 (file)
index 0000000..95e00ee
--- /dev/null
@@ -0,0 +1,21 @@
+module Instance where
+import Data.Array.IArray
+import Data.Array.Unboxed
+import ArrayStuff
+import Formatter
+
+type Wt = Double -- must implement RealFrac
+
+data Instance = Instance
+       Int                 -- numReviewers
+       Int                 -- numProposals
+       (UArray Int Wt)     -- ! reviewer -> relative load
+       (UArray (Int, Int) Wt) -- ! (reviewer, proposal) -> pref
+       deriving Eq
+
+instance Show Instance where
+       show (Instance numRvrs numProps loadA prefA) =
+               "Instance: " ++ show numRvrs ++ " reviewers, " ++ show numProps ++ " proposals\n"
+               ++ "Reviewer relative load: " ++ show loadA ++ "\n"
+               ++ "Preferences:\n"
+               ++ formatTable (array2DtoListOfLists (amap2 show prefA :: Array (Int, Int) String))