Safe Haskell | None |
---|---|
Language | Haskell2010 |
WeekDaze.ExecutionConfiguration.Criterion
Description
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Defines a single criterion, which quantifies the significant of some concept. These criteria represent soft-constraints of the problem; hard-constraints aren't relevent, because they are never allowed to be violated at all.
- Many such criteria may exist, & their weighted-mean drives the selection amongst either competing lesson-definitions at a specific time-slot in the timetable, or between competing timetables when attempting to optimise the solution.
- Each criterion is quantified by some
Fractional
value, but since the weighted-mean should ideally be affected by the suitability of the solution rather than the dimensions of the problem, each is required to be normalised into the closed unit-interval.
CAVEAT
- While this data-type could implement the classes Num, Fractional & Real, these interfaces allow one to construct invalid instances.
Synopsis
- data Criterion c
- median :: Fractional c => Criterion c
- invertNaturalNumbersIntoUnitInterval :: (Fractional f, Real f) => String -> f -> Criterion f
- invertWholeNumbersIntoUnitInterval :: (Enum c, Fractional c, Real c) => String -> c -> Criterion c
- reflectUnitInterval :: Real c => String -> c -> Criterion c
- calculateWeightedMean :: (Fractional weightedMean, Real criterionValue, Real criterionWeight) => [(Criterion criterionValue, CriterionWeight criterionWeight)] -> Writer [Maybe criterionValue] weightedMean
- mkCriterion :: Real c => String -> c -> Criterion c
- mkCriterionFrom :: Num c => Bool -> Criterion c
Types
Data-types
- Quantifies criteria used to assess the desirability of a resource.
- The larger the value the better, relative to the same criterion applied other resources.
Instances
Num c => Bounded (Criterion c) Source # | |
Eq c => Eq (Criterion c) Source # | |
Ord c => Ord (Criterion c) Source # | |
Defined in WeekDaze.ExecutionConfiguration.Criterion | |
Show c => Show (Criterion c) Source # | |
(Ord c, Real c) => SelfValidator (Criterion c) Source # | True if the specified 'criterion-weight' falls within the closed unit-interval; https://en.wikipedia.org/wiki/Unit_interval. |
Constants
median :: Fractional c => Criterion c Source #
Define the middle of the range of possible values.
Functions
invertNaturalNumbersIntoUnitInterval :: (Fractional f, Real f) => String -> f -> Criterion f Source #
Map a natural number into the unit-interval, by reflecting about one
& compressing the range; so that one
remains one
, but infinity
becomes zero
.
invertWholeNumbersIntoUnitInterval :: (Enum c, Fractional c, Real c) => String -> c -> Criterion c Source #
Map a whole number into the unit-interval, so that zero becomes one, & infinity becomes zero.
reflectUnitInterval :: Real c => String -> c -> Criterion c Source #
- Reflect a number in the unit-interval, so that zero becomes one, & one becomes zero.
- CAVEAT: if the number provided exceeds one, then an error will be generated.
calculateWeightedMean :: (Fractional weightedMean, Real criterionValue, Real criterionWeight) => [(Criterion criterionValue, CriterionWeight criterionWeight)] -> Writer [Maybe criterionValue] weightedMean Source #
- Calculates the weighted mean of the specified criterion-values using the corresponding criterion-weights.
- Also writes individual unweighted criterion-values, to facilitate post-analysis; if the corresponding weight is zero, evaluation of the criterion is avoided, both for efficiency & to avoid the possibility of generating an error while evaluating a criterion which may have no validity in the context of the current problem.
- CAVEAT: if all weights are zero, then the result can't be evaluated.