schedulrv0.14.0

Conflicts and errors

The structure of a Conflict, which constraint names you will see and what they mean, and the validation messages of CompileError.

Conflict

explain, check, SchedulingState::check_feasibility, commit and evaluate_move report problems as Conflict values:

Field Content
severity Blocking or Advisory
constraint_name Name of the violated constraint, see below
involved The ActivityIds taking part
entity The Resource, Participant or Activity concerned, if any
message Readable text, prefixed with the resource or participant name

Conflicts on resources are Blocking. Conflicts on participants are Advisory by default: a booking desk may accept them. Batch solve still treats participant double-booking as a hard constraint and never returns a plan with it. A problem that cannot tolerate a double-booked person says so with ParticipantConflictPolicy::Blocking — then a participant conflict is reported exactly like a resource conflict (a timetable does this: one teacher cannot be in two lessons).

let problem = SchedulingProblem::new(resources, participants, activities)
    .with_participant_conflict_policy(ParticipantConflictPolicy::Blocking);

Constraint names

Name Raised when
NoOverlap Two activities overlap on a resource with capacity 1, on a participant, or across a NoOverlap relation
Cumulative Activities on a resource with capacity above 1 exceed that capacity
AlternativeResourceCapacity The candidates of flexible requirements cannot hold all activities
Precedence A Precedence relation is violated
Equal A SameStart, Consecutive or FixedOffset relation is violated (including the instances of a recurring activity)
PeriodicValues A start lies outside the slot calendar or on an exception
ForbiddenValues A start lies in an unavailable range of a resource or participant
ParticipantChoiceGroup A participant choice group gets a selection it does not allow
MaximumBucketLoad A MaximumDailyLoad or MaximumBucketStarts limit is exceeded
BucketBlockPattern A bucket’s occupancy does not match its BucketLoadPattern
MaximumActiveBuckets An entity is active in more buckets than MaximumActiveBuckets allows
MinimumDistance, MinimumBreak Two activities are closer than a MinimumBreak requires
MinimumDailyLoad, MaximumDailySpan, MinimumGapBetweenBuckets, FreeRunWithin, MaximumOccupancyAtOffsets A DayRule of the matching DayRuleKind is violated
MaximumDistinctPerBucket More distinct groups start in one bucket than the limit allows
Model SchedulingState received invalid input, for example an unknown activity to exclude
ActivityDomain evaluate_move got an unknown activity or a window outside the activity’s domain, or check got an assignment for an activity the problem does not contain
Unassigned check found a modeled activity without an assignment in the solution

Only hard rules raise conflicts. A rule made soft with .soft(...), a ConsecutiveRunLimit and every goal are preferences: what they cost appears in score_components under their category, not as a Conflict.

Messages for overlaps name the intervals, for example:

Blocking NoOverlap [a1, a2]: Lab 1: Intervals [9, 11) and [10, 12) overlap
Advisory NoOverlap [a1, a2]: Chris: Intervals [9, 11) and [10, 12) overlap

CompileError

compile validates the whole problem first and returns every problem at once. CompileError::messages() lists them; Display joins them with ; . The checks:

  • duplicate resource, participant or activity ids;
  • a resource with zero capacity;
  • an activity with an invalid window (end not after start, window shorter than the duration, or duration 0);
  • unknown resources, participants, groups, pools or subgroups in activities, memberships and pools;
  • a zero-unit resource requirement;
  • a requirement with no matching resource or participant;
  • a participant group cycle;
  • a schedule template with a cycle length of 0 or less, or without any slot;
  • an activity outside the academic period;
  • a score rule for an unknown activity or with a weight of 0 or less;
  • an activity relation with an unknown activity, or relating an activity to itself;
  • a MaximumDailyLoad, MinimumBreak, DayRule, IsolatedBlockGoal, JointPresenceGoal or ConcurrentFreeGoal naming an unknown resource or participant, or an activity;
  • a TimePreference naming an unknown resource or participant, or with a window that ends before it starts;
  • a ParticipantChoiceGroup with an unknown activity, an activity without a solver-chosen participant, or no candidate common to all its activities.

From the conflicts example:

CompileError: resource r1 has zero capacity
CompileError: activity a1 has an invalid time window
CompileError: activity a2 requires unknown resource r9
CompileError: duplicate activity id a2

Edit this page on GitHub · Docs for v0.14.0