Make proposal-matcher configuration non-global to make it more practical to
[match/match.git] / program / PMDefaults.hs
similarity index 57%
rename from program/ProposalMatcherConfig.hs
rename to program/PMDefaults.hs
index 90bc9b1..5f9ede2 100644 (file)
@@ -1,53 +1,55 @@
-module ProposalMatcherConfig
-       (module ProposalMatcherConfig, minCostFlow) where
+module PMDefaults where
+import Instance
+import ProposalMatcher
+
+import qualified NaiveMinCostFlow
+import qualified CS2MinCostFlow
+
+pmDefaults = PMConfig {
 
 -- Choose a min-cost flow implementation (timings on mattlaptop2):
 
 -- A naive implementation that is slow for all but the smallest instances
 -- (30s on a 20x50 example).
-import NaiveMinCostFlow
+minCostFlow = NaiveMinCostFlow.minCostFlow,
 
 -- Uses CS2 (http://www.igsystems.com/cs2/), which requires a license for
 -- non-research use but is faster (<1s on a 20x50 example, 64s on a 60x500
 -- example).  Configure the path to cs2.exe in CS2MinCostFlow.hs.
---import CS2MinCostFlow
-
-type Wt = Double -- Can be any RealFrac.
+--minCostFlow = CS2MinCostFlow.minCostFlow,
 
-type Pref = Int
+reviewsEachProposal = 3,
 
-numAsWt x = fromInteger (toInteger x) :: Wt
+prefIsExpert = \p -> p <= 10,
+prefIsKnowledgeable = \p -> p <= 20,
 
-reviewsEachProposal = 3 :: Int
+prefIsBoring = \p -> p > 15,
+prefIsVeryBoring = \p -> p > 25,
 
-prefIsExpert p = p <= 10
-prefIsKnowledgeable p = p <= 20
-
-prefIsBoring p = p > 15
-prefIsVeryBoring p = p > 25
-
-prefIsConflict p = p >= 40
+prefIsConflict = \p -> p >= 40,
 
 -- For now this is absolute.  Later it might be proportional to a reviewer's
 -- target load.
-loadTolerance = 1 :: Int
+loadTolerance = 1,
 
 -- Cost to overload by one review.
 -- tx = 0 at target load, 1 at end of tolerance.
-marginalLoadCost tx = 1000 + tx*1000 :: Wt
+marginalLoadCost = \tx -> 1000 + tx*1000,
 
 -- Cost to review a boring (or very boring) proposal.
 -- lx = 0 at no load, 1 at target load.
-marginalBoringCost lx = 1000 + lx*1000 :: Wt
+marginalBoringCost = \lx -> 1000 + lx*1000,
 -- Additional cost to review a very boring proposal.
-marginalVeryBoringCost lx = 1000 + lx*1000 :: Wt
+marginalVeryBoringCost = \lx -> 1000 + lx*1000,
 
 -- Cost to make a review.
 -- I'm using quadratic cost functions as a first attempt.
-assignmentCost pref = (numAsWt 10 + pref) ^ 2 :: Wt
+assignmentCost = \pref -> (numAsWt 10 + pref) ^ 2,
 
 -- Bonus for a first knowledgeable or expert review.
-knowledgeableBonus = 1000 :: Wt
+knowledgeableBonus = 1000,
 
 -- Bonus for an additional expert review.
-expertBonus = 1000 :: Wt
+expertBonus = 1000
+
+}