- Implement CS2 min-cost-flow adaptor and generalize common min-cost-flow stuff
[match/match.git] / program / ProposalMatcherConfig.hs
CommitLineData
fd0d2377
MM
1module ProposalMatcherConfig
2 (module ProposalMatcherConfig, minCostFlow) where
3
4-- Choose a min-cost flow implementation (timings on mattlaptop2):
5
6-- A naive implementation that is slow for all but the smallest instances
7-- (30s on a 20x50 example).
8import NaiveMinCostFlow
9
10-- Uses CS2 (http://www.igsystems.com/cs2/), which requires a license for
11-- non-research use but is faster (<1s on a 20x50 example, 64s on a 60x500
12-- example). Configure the path to cs2.exe in CS2MinCostFlow.hs.
13--import CS2MinCostFlow
14
15type Wt = Double -- Can be any RealFrac.
d7d9561e 16
2e7d5426 17type Pref = Int
2e7d5426
MM
18
19numAsWt x = fromInteger (toInteger x) :: Wt
20
21reviewsEachProposal = 3 :: Int
22
d7d9561e 23prefIsExpert p = p <= 10
2e7d5426
MM
24prefIsKnowledgeable p = p <= 20
25
26prefIsBoring p = p > 15
27prefIsVeryBoring p = p > 25
28
d7d9561e
MM
29prefIsConflict p = p >= 40
30
2e7d5426
MM
31-- For now this is absolute. Later it might be proportional to a reviewer's
32-- target load.
33loadTolerance = 1 :: Int
d7d9561e 34
2e7d5426
MM
35-- Cost to overload by one review.
36-- tx = 0 at target load, 1 at end of tolerance.
37marginalLoadCost tx = 1000 + tx*1000 :: Wt
38
39-- Cost to review a boring (or very boring) proposal.
40-- lx = 0 at no load, 1 at target load.
41marginalBoringCost lx = 1000 + lx*1000 :: Wt
42-- Additional cost to review a very boring proposal.
43marginalVeryBoringCost lx = 1000 + lx*1000 :: Wt
44
45-- Cost to make a review.
d7d9561e 46-- I'm using quadratic cost functions as a first attempt.
2e7d5426
MM
47assignmentCost pref = (numAsWt 10 + pref) ^ 2 :: Wt
48
49-- Bonus for a first knowledgeable or expert review.
50knowledgeableBonus = 1000 :: Wt
51
52-- Bonus for an additional expert review.
53expertBonus = 1000 :: Wt