Safe Haskell | None |
---|
Implementation of handling of Allocation Solutions
Synopsis
- type GenericAllocElement a = (List, Instance, [Node], a)
- allocMetric :: GenericAllocElement a -> a
- type AllocElement = GenericAllocElement Score
- data GenericAllocSolution a = AllocSolution {
- asFailures :: [FailMode]
- asAllocs :: Int
- asSolution :: Maybe (GenericAllocElement a)
- asLog :: [String]
- type AllocSolution = GenericAllocSolution Score
- emptyAllocSolution :: GenericAllocSolution a
- updateIl :: List -> Maybe (GenericAllocElement a) -> List
- extractNl :: List -> List -> Maybe (GenericAllocElement a) -> List
- bestAllocElement :: Ord a => Maybe (GenericAllocElement a) -> Maybe (GenericAllocElement a) -> Maybe (GenericAllocElement a)
- concatAllocs :: Ord a => GenericAllocSolution a -> OpResult (GenericAllocElement a) -> GenericAllocSolution a
- sumAllocs :: Ord a => GenericAllocSolution a -> GenericAllocSolution a -> GenericAllocSolution a
- collapseFailures :: [FailMode] -> FailStats
- genericDescribeSolution :: (a -> String) -> GenericAllocSolution a -> String
- genericAnnotateSolution :: (a -> String) -> GenericAllocSolution a -> GenericAllocSolution a
- annotateSolution :: AllocSolution -> AllocSolution
- solutionDescription :: (Group, Result (GenericAllocSolution a)) -> [String]
- data AllocSolutionCollection a = AllocSolutionCollection {
- ascFailures :: [FailMode]
- ascAllocs :: Int
- ascSolutions :: [GenericAllocElement a]
- ascLog :: [String]
- emptyAllocCollection :: AllocSolutionCollection a
- concatAllocCollections :: Ord a => AllocSolutionCollection a -> OpResult (GenericAllocElement a) -> AllocSolutionCollection a
- collectionToSolution :: Ord a => FailMode -> (GenericAllocElement a -> Bool) -> AllocSolutionCollection a -> GenericAllocSolution a
Documentation
type GenericAllocElement a = (List, Instance, [Node], a) Source #
A simple name for an allocation element (here just for logistic reasons), generic in the type of the metric.
allocMetric :: GenericAllocElement a -> a Source #
Obtain the metric of a GenericAllocElement.
type AllocElement = GenericAllocElement Score Source #
A simple name for an allocation element (here just for logistic reasons).
data GenericAllocSolution a Source #
Allocation/relocation solution.
AllocSolution | |
|
emptyAllocSolution :: GenericAllocSolution a Source #
The empty solution we start with when computing allocations.
:: List | The original instance list |
-> Maybe (GenericAllocElement a) | The result of the allocation attempt |
-> List | The updated instance list |
Calculate the new instance list after allocation solution.
:: List | The original node list |
-> List | The original instance list |
-> Maybe (GenericAllocElement a) | The result of the allocation attempt |
-> List | The new node list |
Extract the the new node list from the allocation solution.
bestAllocElement :: Ord a => Maybe (GenericAllocElement a) -> Maybe (GenericAllocElement a) -> Maybe (GenericAllocElement a) Source #
Compares two Maybe AllocElement and chooses the best score.
concatAllocs :: Ord a => GenericAllocSolution a -> OpResult (GenericAllocElement a) -> GenericAllocSolution a Source #
Update current Allocation solution and failure stats with new elements.
sumAllocs :: Ord a => GenericAllocSolution a -> GenericAllocSolution a -> GenericAllocSolution a Source #
Sums two AllocSolution
structures.
collapseFailures :: [FailMode] -> FailStats Source #
Build failure stats out of a list of failures.
genericDescribeSolution :: (a -> String) -> GenericAllocSolution a -> String Source #
Given a solution, generates a reasonable description for it.
genericAnnotateSolution :: (a -> String) -> GenericAllocSolution a -> GenericAllocSolution a Source #
Annotates a solution with the appropriate string.
annotateSolution :: AllocSolution -> AllocSolution Source #
Annotate a solution based on the standard metrics
solutionDescription :: (Group, Result (GenericAllocSolution a)) -> [String] Source #
Given a group/result, describe it as a nice (list of) messages.
Collection of Allocation Solutions for later filtering
data AllocSolutionCollection a Source #
Collection of Allocation Solution
AllocSolutionCollection | |
|
emptyAllocCollection :: AllocSolutionCollection a Source #
Empty collection of allocation solutions.
concatAllocCollections :: Ord a => AllocSolutionCollection a -> OpResult (GenericAllocElement a) -> AllocSolutionCollection a Source #
Update current collection of solution and failure stats with new elements.
:: Ord a | |
=> FailMode | Failure mode to assign to solutions filtered out in this step |
-> (GenericAllocElement a -> Bool) | predicate to restrict to |
-> AllocSolutionCollection a | |
-> GenericAllocSolution a |
From a collection of solutions collapse to a single one by chosing the best that fulfills a given predicate.