main = do
incsv <- hGetContents stdin
-- handle errors another day, or let the platform do it
- let Right inll = parseTSV "standard input" incsv
+ let inll = parseTSV incsv
- let loadList = head inll
+ let loadList = tail (head inll)
let numRvrs = length loadList
let loadA = listArray (0, numRvrs-1) (map read loadList)
- let numProps = length (tail inll)
+ let numProps = length (tail inll) `div` 2
-- explicit type on the next line appears to be necessary
let pxarr = listOfListsToArray2D (tail inll) :: Array (Int,Int) String
-- careful, we end up transposing the array in here
- let prefA = funcArray ((0,0), (numRvrs-1,numProps-1)) (\(i,j) -> read (pxarr ! (j, i)))
- let theInst = PMInstance numRvrs numProps loadA prefA
+ let prefFixA = funcArray ((0,0), (numRvrs-1,numProps-1)) (\(i,j) ->
+ let
+ cell = pxarr ! (2*j, i+1)
+ (fix, pstr) = if last cell == '*' then (True, init cell) else (False, cell)
+ pref = read pstr
+ in (pref, fix)) :: Array (Int,Int) (Wt,Bool)
+ let prefA = amap2 fst prefFixA; fixA = amap2 snd prefFixA
+ let expA = funcArray ((0,0), (numRvrs-1,numProps-1)) (\(i,j) -> read $ pxarr ! (2*j+1, i+1))
+ let pnrA = funcArray (0, numProps-1) (\j -> read $ pxarr ! (2*j, 0))
+ let theInst = PMInstance numRvrs numProps loadA prefA expA fixA pnrA
let PMatching theMatching = doMatching pmDefaults theInst
- hPutStr stdout $ printTSV $ map (\(i, j) -> map show [i, j]) theMatching
+ hPutStr stdout $ formatTSV $ map (\(i, j) -> map show [i, j]) theMatching
--- /dev/null
+ Proposal matcher implementation
+
+ By Matt McCutchen <matt@mattmccutchen.net>
+ in collaboration with Samir Khuller <samir@cs.umd.edu>
+
+ TODO: There is probably more to say here about the program, even after we add
+ the paper about the algorithm/reduction.
+
+ Setup
+ -----
+
+ Requirements:
+ - GHC on your $PATH
+ - GHC "fgl" package
+
+ Compile with "make".
+
+ Interactive experimentation
+ ---------------------------
+
+ "./run" starts GHCi with all of the important definitions of the proposal
+ matcher in scope. This is good for interactive experimentation.
+
+ Batch front-end
+ ---------------
+
+ ./match is a front-end that reads an instance from stdin and prints the matching
+ to stdout.
+
++<<< FIXME: Adapt the following for popl2012 branch >>>
+ Input: A tab-separated array with one column per reviewer. The first row gives
+ the relative loads of the reviewers. Thereafter, each row gives the preference
+ values (1 to 39, 40 = conflict of interest) of all reviewers for a single
+ proposal. See the example.in.
+
+ Reviewers and proposals are numbered from 0 in the order they appear in the
+ input.
+
+ Output: A tab-separated array. Each row gives the reviewer number and proposal
+ number of a matched pair.