-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Partition the sequence of items to the subsequences in the order given -- -- The LinearSplit module implements partitioning the sequence of items -- to the subsequences in the order given. The items can be splitted -- using greedy heuristic or using linear partition algorithm to minimize -- the maximum cost over all ranges (see the 'The Algorithm Design -- Manual' by Steven S. Skiena..) @package LinearSplit @version 0.1 -- | The LinearSplit module implements partitioning the sequence of items -- to the subsequences in the order given. The next functions are -- exported: a) gPartition - split the sequence of items items using -- greedy heuristic. b) lPartition - split the sequence of items to -- minimize the maximum cost over all the subsequences using linear -- partition algorithm (see the 'The Algorithm Design Manual' by Steven -- S. Skiena..) c) ltPartition - the approximation of the linear -- partition algorithm. The large size of the work items space is -- decreased by combining the consecutive items based on the threshold -- parameter. module Data.LinearSplit -- | Representation of the work item data Item a b Item :: a -> b -> Item a b item :: Item a b -> a weight :: Item a b -> b -- | Range of work items data Range a b Range :: b -> a -> a -> Range a b price :: Range a b -> b low :: Range a b -> a high :: Range a b -> a -- | Partition items to minimize the maximum cost over all ranges lPartition :: (Num b, Ord b) => Int -> [Item a b] -> [Range a b] -- | Partition items with accumulating small items ltPartition :: (Num b, Ord b) => Int -> [Item a b] -> b -> [Range a b] -- | Partition the items based on the greedy algoritm gPartition :: (Ord b, Num b) => ([Item a b] -> Bool) -> Int -> [Item a b] -> [Range a b] instance Eq b => Eq (Cell b) instance Show b => Show (Cell b) instance Ord b => Ord (Cell b) instance (Eq a, Eq b) => Eq (Range a b) instance (Show a, Show b) => Show (Range a b) instance (Ord a, Ord b) => Ord (Range a b) instance (Eq a, Eq b) => Eq (Item a b) instance (Show a, Show b) => Show (Item a b) instance (Ord a, Ord b) => Ord (Item a b)