Matt McCutchen's Web Site
/
match
/
match.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The random instance generator and other improvements.
[match/match.git]
/
program
/
ProposalMatcher.hs
diff --git
a/program/ProposalMatch.hs
b/program/ProposalMatcher.hs
similarity index 83%
rename from
program/ProposalMatch.hs
rename to
program/ProposalMatcher.hs
index
028f22c
..
c0bd7a0
100644
(file)
--- a/
program/ProposalMatch.hs
+++ b/
program/ProposalMatcher.hs
@@
-1,17
+1,12
@@
-module ProposalMatch where
+module ProposalMatch
er
where
import UnitMinCostFlow
import Data.Array.IArray
import Data.Graph.Inductive.Graph
import Data.Graph.Inductive.Tree
import Data.List
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
prefBoringness p = if prefIsVeryBoring p then 2
else if prefIsBoring p then 1 else 0
@@
-19,7
+14,7
@@
prefExpertness p = if prefIsExpert p then 2
else if prefIsKnowledgeable p then 1 else 0
doReduction :: Instance -> Gr () Wt
else if prefIsKnowledgeable p then 1 else 0
doReduction :: Instance -> Gr () Wt
-doReduction (Instance numRvrs numProps rload
F prefF
) =
+doReduction (Instance numRvrs numProps rload
A prefA
) =
let
source = 0
sink = 1
let
source = 0
sink = 1
@@
-29,8
+24,8
@@
doReduction (Instance numRvrs numProps rloadF prefF) =
in
let
totalReviews = reviewsEachProposal * numProps
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]
-- A...H refer to idea book p.429
edgesABC = do
i <- [0 .. numRvrs - 1]
@@
-48,7
+43,7
@@
doReduction (Instance numRvrs numProps rloadF prefF) =
edgesD = do
i <- [0 .. numRvrs - 1]
j <- [0 .. numProps - 1]
edgesD = do
i <- [0 .. numRvrs - 1]
j <- [0 .. numProps - 1]
- let pref = pref
F i j
+ let pref = pref
A ! (i, j)
if prefIsConflict pref
then []
else [(rvrNode i (prefBoringness pref),
if prefIsConflict pref
then []
else [(rvrNode i (prefBoringness pref),
@@
-73,7
+68,7
@@
doReduction (Instance numRvrs numProps rloadF prefF) =
todo = undefined
-- Returns a list of reviews as ordered pairs (reviewer#, proposal#).
doMatching :: Instance -> [(Int, Int)]
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
-- Copied from doReduction. There should be a better way to get these here.
let
source = 0