module Test ( -- Export everything we need to have fun in GHCi: -- See the results of examples. module Test, -- Generate instances. module Instance, module InstanceGenerator, -- Solve instances. module ProposalMatcher, module ProposalMatcherConfig, -- Run randomized things. module System.Random, module RandomizedMonad, -- Visualize graphs. module Data.Graph.Inductive.Graphviz ) where import Instance import InstanceGenerator import ProposalMatcher import ProposalMatcherConfig import System.Random import RandomizedMonad import Data.Graph.Inductive.Graphviz -- Other imports we need import BellmanFord import UnitMinCostFlow import Data.Array.IArray import Data.Array.Unboxed import Data.Graph.Inductive.Graph import Data.Graph.Inductive.Tree import ArrayStuff myGraph = mkGraph [(0, ()), (1, ()), (2, ())] [(0, 1, 2), (0, 2, 3), (2, 1, -2)] :: Gr () Double spTree1 = spTree 0 myGraph (flowVal, flowResid) = umcf 0 1 myGraph -- Example from idea book p. 425 {- (myNumRvrs, myNumProps) = (4, 3) myPrefsArray = array ((0,0), (myNumRvrs-1,myNumProps-1)) [ ((0, 0), 15), ((1, 0), 10), ((2, 0), 15), ((3, 0), 40), ((0, 1), 30), ((1, 1), 7), ((2, 1), 10), ((3, 1), 15), ((0, 2), 15), ((1, 2), 25), ((2, 2), 20), ((3, 2), 20) ] -} (myNumRvrs, myNumProps) = (5, 3) myPrefs = transposeArray $ listArray ((0,0), (myNumProps-1,myNumRvrs-1)) [ 15, 10, 15, 40, 20, 30, 7, 10, 15, 15, 15, 25, 20, 20, 15 ] :: UArray (Int, Int) Wt myInst = Instance myNumRvrs myNumProps (funcArray (0, myNumRvrs-1) $ const 1) myPrefs rdnGraph = doReduction myInst (rdnFlowVal, rdnFlowResid) = umcf 0 1 rdnGraph rdnFlow = flowDiff rdnGraph rdnFlowResid myMatching = doMatching myInst