- Implement CS2 min-cost-flow adaptor and generalize common min-cost-flow stuff
[match/match.git] / program / InstanceGenerator.hs
index cf61e6a..ab56d5f 100644 (file)
@@ -5,14 +5,6 @@ import RandomizedMonad
 import Data.Array.IArray
 import ArrayStuff
 
-randomMap :: RandomGen g => g -> (g -> a -> b) -> [a] -> [b]
-randomMap g f l = case l of
-       [] -> []
-       h:t -> let (g1, g2) = split g in (f g1 h):(randomMap g2 f t)
-randomRep :: RandomGen g => g -> (g -> a) -> Int -> [a]
-randomRep g f n = if n == 0 then []
-       else let (g1, g2) = split g in (f g1):(randomRep g2 f (n-1))
-
 numTopics = 20
 
 -- Expertise on each of the topics
@@ -73,6 +65,7 @@ randomInstance numRvrs numProps = do
                        jj = proposalInfos ! j
                        topicPref = case fst jj of
                                PTopic1 t1 -> expertnessToPref (ii ! t1)
-                               PTopic2 t1 t2 -> (expertnessToPref (ii ! t1) + expertnessToPref (ii ! t2)) / 2
+                               PTopic2 t1 t2 -> (expertnessToPref (ii ! t1)
+                                       + expertnessToPref (ii ! t2)) / 2
                in topicPref * snd jj - 4)
        return $ Instance numRvrs numProps loadA prefA