-module ProposalMatch where
+module ProposalMatcher where
import UnitMinCostFlow
import Data.Array.IArray
import Data.Graph.Inductive.Graph
import Data.Graph.Inductive.Tree
import Data.List
-import ProposalMatchConfig
-
-data Instance = Instance
- Int -- numReviewers
- Int -- numProposals
- (Int -> Wt) -- reviewer -> relative load
- (Int -> Int -> Wt) -- reviewer -> proposal -> pref
+import Instance
+import ProposalMatcherConfig
prefBoringness p = if prefIsVeryBoring p then 2
else if prefIsBoring p then 1 else 0
else if prefIsKnowledgeable p then 1 else 0
doReduction :: Instance -> Gr () Wt
-doReduction (Instance numRvrs numProps rloadF prefF) =
+doReduction (Instance numRvrs numProps rloadA prefA) =
let
source = 0
sink = 1
in
let
totalReviews = reviewsEachProposal * numProps
- totalRelativeLoad = foldl (+) 0 (map rloadF [0 .. numRvrs - 1])
- targetLoad i = ceiling (numAsWt totalReviews * rloadF i / totalRelativeLoad)
+ totalRelativeLoad = foldl (+) 0 (map (rloadA !) [0 .. numRvrs - 1])
+ targetLoad i = ceiling (numAsWt totalReviews * (rloadA ! i) / totalRelativeLoad)
-- A...H refer to idea book p.429
edgesABC = do
i <- [0 .. numRvrs - 1]
edgesD = do
i <- [0 .. numRvrs - 1]
j <- [0 .. numProps - 1]
- let pref = prefF i j
+ let pref = prefA ! (i, j)
if prefIsConflict pref
then []
else [(rvrNode i (prefBoringness pref),
todo = undefined
-- Returns a list of reviews as ordered pairs (reviewer#, proposal#).
doMatching :: Instance -> [(Int, Int)]
-doMatching inst@(Instance numRvrs numProps rloadF prefF) =
+doMatching inst@(Instance numRvrs numProps _ _) =
-- Copied from doReduction. There should be a better way to get these here.
let
source = 0