Documentation
¶
Overview ¶
Package invigcalc computes the fair distribution of invigilation duties: given the total invigilation minutes to cover and each invigilator's factor and already-credited contributions, it derives the per-invigilator target minutes (factor-weighted, with largest-remainder rounding so the targets sum exactly to the work) and the per-invigilator todo summary. These are pure functions over graph/model types with no I/O, split out of the plexams package so the correctness-critical math is isolated and unit-tested.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FairTargets ¶
func FairTargets(workMinutes int, reqs []*model.Invigilator) ( todoPerInvigilator, countedContributions int, targets map[int]int, enough map[int]bool, )
FairTargets computes the factor-weighted invigilation minutes each invigilator should be planned for, given workMinutes (= SumExamRooms + SumReserve) of actual invigilation that must be covered and the already credited other contributions (Beisitz, Live-Coding, Master, ...) of every invigilator.
It solves
Σ_active max(0, T·Factor_i − contributions_i) = workMinutes
as a fixed point: an invigilator whose contributions already reach or exceed their share (T·Factor_i) does no invigilation, so they drop out of *both* numerator and denominator. Their over-contribution is "Schicksal" -- it cannot be redistributed because only the workMinutes that actually exist can be shared. Removing such an invigilator only raises T (and thus the threshold), so the active set shrinks monotonically and the loop converges in at most len(reqs) rounds.
It returns:
- todoPerInvigilator: the fair T, rounded to the nearest integer (display value only).
- countedContributions: the contributions of the still-active invigilators,
- targets: the integer invigilation minutes each invigilator (by teacher ID) should be planned for, net of their other contributions. The float shares T·Factor_i − contributions_i sum to exactly workMinutes; they are rounded to integers with the largest-remainder method so the *sum of targets stays exactly workMinutes*.
- enough: invigilators who already contributed at least their fair share and therefore do no invigilation (target 0).
func Todos ¶
func Todos(invigilations []*model.Invigilation, totalMinutes int, enough bool) *model.InvigilatorTodos
Todos builds the per-invigilator todos: the credited doingMinutes (self invigilations count 0, reserves a fixed 60 min, see SumReserve), the set of invigilation days and the given fair target.
Types ¶
This section is empty.