weekdaze-0.0.0.2: A school-timetable problem-solver.

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

# Types

## Data-types

data Criterion c Source #

• 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 # Instance details Methods Eq c => Eq (Criterion c) Source # Instance details Methods(==) :: Criterion c -> Criterion c -> Bool #(/=) :: Criterion c -> Criterion c -> Bool # Ord c => Ord (Criterion c) Source # Instance details Methodscompare :: Criterion c -> Criterion c -> Ordering #(<) :: Criterion c -> Criterion c -> Bool #(<=) :: Criterion c -> Criterion c -> Bool #(>) :: Criterion c -> Criterion c -> Bool #(>=) :: Criterion c -> Criterion c -> Bool #max :: Criterion c -> Criterion c -> Criterion c #min :: Criterion c -> Criterion c -> Criterion c # Show c => Show (Criterion c) Source # Instance details MethodsshowsPrec :: Int -> Criterion c -> ShowS #show :: Criterion c -> String #showList :: [Criterion c] -> ShowS # (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. Instance details MethodsgetErrors :: Criterion c -> [String] #isValid :: Criterion c -> Bool #

# Constants

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.

## Constructors

mkCriterion :: Real c => String -> c -> Criterion c Source #

Smart constructor.

Build a criterion from a Bool, arbitrarily assuming True is better than False.