chore: extende random distribution with nudges
This commit is contained in:
parent
b36a15c0b2
commit
9b0adab023
@ -51,7 +51,6 @@ import qualified Data.List as List
|
|||||||
import Data.Either.Combinators (maybeToRight)
|
import Data.Either.Combinators (maybeToRight)
|
||||||
|
|
||||||
import Data.ExtendedReal
|
import Data.ExtendedReal
|
||||||
import Data.Ratio (Ratio)
|
|
||||||
|
|
||||||
import qualified Data.RFC5051 as RFC5051
|
import qualified Data.RFC5051 as RFC5051
|
||||||
|
|
||||||
@ -306,8 +305,11 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
decreaseBiggestOutlier n currentOccurrences = decreaseBiggestOutlier (pred n)
|
decreaseBiggestOutlier n currentOccurrences = decreaseBiggestOutlier (pred n)
|
||||||
$ Map.update predToPositive biggestOutlier currentOccurrences
|
$ Map.update predToPositive biggestOutlier currentOccurrences
|
||||||
where
|
where
|
||||||
currentRatios :: Map ExamOccurrenceId (Ratio Natural)
|
currentRatios :: Map ExamOccurrenceId Rational
|
||||||
currentRatios = Map.merge Map.dropMissing Map.dropMissing (Map.zipWithMatched $ const (%)) currentOccurrences occurrencesMap
|
currentRatios = Map.merge Map.dropMissing Map.dropMissing (Map.zipWithMatched calculateRatio)
|
||||||
|
currentOccurrences occurrencesMap
|
||||||
|
calculateRatio :: ExamOccurrenceId -> Natural -> Natural -> Rational
|
||||||
|
calculateRatio k c m = fromIntegral c % fromIntegral m - eaocNudgeSize * fromIntegral (lineNudges k)
|
||||||
biggestOutlier :: ExamOccurrenceId
|
biggestOutlier :: ExamOccurrenceId
|
||||||
biggestOutlier = fst . List.maximumBy (comparing $ view _2) $ Map.toList currentRatios
|
biggestOutlier = fst . List.maximumBy (comparing $ view _2) $ Map.toList currentRatios
|
||||||
extraCapacity :: Natural
|
extraCapacity :: Natural
|
||||||
|
|||||||
Reference in New Issue
Block a user