fix: use extraUsers instead of extraCapacity for unrestricted pseudo-capacity
This commit is contained in:
parent
b5ee9f2c05
commit
2be9d76af2
@ -434,14 +434,6 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
restrictedSpace :: Natural
|
restrictedSpace :: Natural
|
||||||
restrictedSpace = sum restrictedLengths
|
restrictedSpace = sum restrictedLengths
|
||||||
|
|
||||||
extraCapacity :: Natural
|
|
||||||
extraCapacity
|
|
||||||
| restrictedSpace > numUnassignedUsers = restrictedSpace - numUnassignedUsers
|
|
||||||
| otherwise = 0
|
|
||||||
where
|
|
||||||
numUnassignedUsers :: Natural
|
|
||||||
numUnassignedUsers = sum $ view _2 <$> wordLengths
|
|
||||||
|
|
||||||
longestLine :: Natural
|
longestLine :: Natural
|
||||||
-- ^ For scaling costs
|
-- ^ For scaling costs
|
||||||
-- longest restricted line (or 1 if all unrestricted)
|
-- longest restricted line (or 1 if all unrestricted)
|
||||||
@ -545,9 +537,18 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
optimumRatio :: Rational
|
optimumRatio :: Rational
|
||||||
optimumRatio = ((%) `on` fromIntegral . max 1 . sum) (map (view _2) wordLengths) restrictedLengths
|
optimumRatio = ((%) `on` fromIntegral . max 1 . sum) (map (view _2) wordLengths) restrictedLengths
|
||||||
|
|
||||||
|
numUnassignedUsers :: Natural
|
||||||
|
numUnassignedUsers = sum $ view _2 <$> wordLengths
|
||||||
|
|
||||||
|
extraUsers :: Natural
|
||||||
|
extraUsers
|
||||||
|
| numUnassignedUsers > restrictedSpace = numUnassignedUsers - restrictedSpace
|
||||||
|
| otherwise = 0
|
||||||
|
|
||||||
widthCost :: Maybe lineId -> ExamOccurrenceCapacity -> Natural -> Extended Rational
|
widthCost :: Maybe lineId -> ExamOccurrenceCapacity -> Natural -> Extended Rational
|
||||||
widthCost l Unrestricted w
|
widthCost l Unrestricted w
|
||||||
= Finite ((fromIntegral w - fromIntegral extraCapacity) % List.genericLength unrestrictedLines
|
= Finite (fromIntegral w
|
||||||
|
- (fromIntegral extraUsers % List.genericLength unrestrictedLines)
|
||||||
- nudgeRatio * fromIntegral longestLine)^2
|
- nudgeRatio * fromIntegral longestLine)^2
|
||||||
where
|
where
|
||||||
nudgeRatio :: Rational
|
nudgeRatio :: Rational
|
||||||
|
|||||||
Reference in New Issue
Block a user