X-Git-Url: https://mattmccutchen.net/match/match.git/blobdiff_plain/bc14b3b3a9345cb74bc7d8f3808a1d8cdd0bf479..e95df3f5aa9099829c63bab4a5c5ea96808edeb0:/program/Evaluation.hs diff --git a/program/Evaluation.hs b/program/Evaluation.hs index c93e799..f69668d 100644 --- a/program/Evaluation.hs +++ b/program/Evaluation.hs @@ -10,7 +10,7 @@ import ArrayStuff type MatchingEvaluation = Array Int Wt evaluateMatching :: PMConfig -> PMInstance -> PMatching -> MatchingEvaluation -evaluateMatching cfg inst@(PMInstance numRvrs numProps rloadA prefA) matching = +evaluateMatching cfg inst@(PMInstance numRvrs numProps rloadA prefA) (PMatching matching) = let reviewersByProposal = accumArray (flip (:)) [] (0, numProps-1) $ map (\(i,j) -> (j,i)) matching :: Array Int [Int] in @@ -18,15 +18,11 @@ evaluateMatching cfg inst@(PMInstance numRvrs numProps rloadA prefA) matching = -- Sort this proposal's reviews, best first. let jPrefsInc = sort $ map (\i -> prefA ! (i,j)) rl in -- Charge each review's assignmentCost. - sum $ zipWith (\wt prf -> (numAsWt wt) * assignmentCost cfg prf) - -- The assignment costs are weighted by - -- reviewsEachProposal, ..., 1 from best to worst. - -- (It's most important for the best to be good.) - (take (reviewsEachProposal cfg) $ - iterate (subtract 1) (reviewsEachProposal cfg)) + sum $ zipWith (\wt prf -> wt * assignmentCost cfg prf) + (reviewEvalWeights cfg) -- A missing review counts as a preference of 50 (really bad). (jPrefsInc ++ repeat 50) - ) + ) reviewersByProposal doEvaluateMatching :: PMConfig -> PMInstance -> MatchingEvaluation