Make the evaluator's review weights configurable.
[match/match.git] / program / ProposalMatcher.hs
index 86bbf88..96c2c32 100644 (file)
@@ -4,25 +4,8 @@ import Data.Graph.Inductive.Graph
 import Data.Graph.Inductive.Tree
 import Data.List
 
-import Instance
-import IMinCostFlow
-
-data PMConfig = PMConfig {
-       minCostFlow :: MinCostFlowImpl,
-       reviewsEachProposal :: Int,
-       prefIsExpert :: Wt -> Bool,
-       prefIsKnowledgeable :: Wt -> Bool,
-       prefIsBoring :: Wt -> Bool,
-       prefIsVeryBoring :: Wt -> Bool,
-       prefIsConflict :: Wt -> Bool,
-       loadTolerance :: Int,
-       marginalLoadCost :: Wt -> Wt,
-       marginalBoringCost :: Wt -> Wt,
-       marginalVeryBoringCost :: Wt -> Wt,
-       assignmentCost :: Wt -> Wt,
-       knowledgeableBonus :: Wt,
-       expertBonus :: Wt
-}
+import PMInstance
+import PMConfig
 
 prefBoringness cfg p = if prefIsVeryBoring cfg p then 2
        else if prefIsBoring cfg p then 1 else 0
@@ -58,8 +41,8 @@ indexEdges i ((v1, v2, re):es) =
        let (imax, ies) = indexEdges (i+1) es in
        (imax, (v1, v2, re{ reIdx = i }) : ies)
 
-doReduction :: PMConfig -> Instance -> ReductionResult
-doReduction cfg (Instance numRvrs numProps rloadA prefA) =
+doReduction :: PMConfig -> PMInstance -> ReductionResult
+doReduction cfg (PMInstance numRvrs numProps rloadA prefA) =
        let
                source = 0
                sink = 1
@@ -118,8 +101,8 @@ doReduction cfg (Instance numRvrs numProps rloadA prefA) =
        ReductionResult (mkGraph theNodes theEdges) source sink (0, imax-1) edIdx
 
 -- Returns a list of reviews as ordered pairs (reviewer#, proposal#).
-doMatching :: PMConfig -> Instance -> [(Int, Int)]
-doMatching cfg inst@(Instance numRvrs numProps _ _) =
+doMatching :: PMConfig -> PMInstance -> PMatching
+doMatching cfg inst@(PMInstance numRvrs numProps _ _) =
        let ReductionResult graph source sink idxBounds edIdx = doReduction cfg inst in
        let flowArray = minCostFlow cfg idxBounds reIdx reCap reCost graph (source, sink) in
        let pairs = do