Planning Équipes

Search Français Let’s talk

Weight and disable rules

You will know how a rule is switched off or weighted, what the confirmation dialog guarantees and what it does not, how the screen says what a rule is set to and which action to offer when it is in breach, and how to read a floor, the kind of rule that penalises everything for lack of data.

The screen says what the rule is set to

A description answers why, never how much. Each rule therefore carries, on its own line, the settings it reads: the field’s label word for word, and the field itself at the edition’s value. A setting read by several rules (the break, the meal window) appears on each and is changed at any of them: it is one value. The server sends the setting’s key (cle) with its label; nothing is written before “Save”. A rule lists all the settings it reads (dureeHebdomadaireMax is why: its ceiling is weekly, but the week is measured in effective work, which depends on the break). Three things are absent: the weight, which has its own column; a Labour Code constant (10 h daily, 11 h rest, six days before weekly rest), which the description names; a referential datum (a category’s ceiling, premium stand, appraisals), where the screen points through the floor. The inventory is ConstraintParameters (external site), next to ConstraintCatalog.

When a rule is in breach: the action, not the weight

The catalogue says the gesture, the screen renders it (ADR 0064 (external site)). ConstraintCatalog carries, for each medium and soft rule (and hard rules with a precise lever), the ordered list of its levers (Lever, a type, never a sentence), and BlockerPlaybook translates each lever into navigation positioned on the first breach; the list is in GET /api/constraints (actions field). Four invariants, tested by BlockerPlaybookTest:

  • no medium or soft rule has the weight as its only gesture: each names first a lever that changes the plan or the referential;
  • “Lower the importance” always comes last, never on a hard rule, and no more when the weight is already at its lowest;
  • only this button speaks of the weight: the first gesture repeats the rule’s advice, unless it proposes lowering the importance;
  • “Set the ceiling” or “the thresholds” exists only on a rule that reads a setting (ConstraintParameters).

The “where” comes from the same analysis: BreachHotspots crosses stand and timeslot for the three places gathering the most breaches of each rule (hotspots, identifiers), and each opens the Planning page on that seat (the frozen past is excluded). An aggregated rule with no place falls back to the most affected stands, then days. When the breach falls on a seat held by a single person, “Who can hold this seat?” becomes “Who can replace?”.

Enable and disable

Deactivation holds for the next solve and touches neither the weight nor the logic. A constraint_toggle row carries a rule’s explicit state (nom, actif); its absence means what the catalogue says. Almost all rules are active by default; the one the catalogue ships off is in ConstraintCatalog.DESACTIVEES_PAR_DEFAUT: mineurNecessiteEncadrementMajeur (ADR 0041 (external site)), whose switching on writes a row. Asking for the state the catalogue already gives erases the row. A scenario says both directions: contraintes.desactivees and contraintes.activees.

The state is consulted by ConstraintToggleSupport.actif(...) at the tail of the stream, on breaches, just before the penalty: breaches number in the tens where seats number in the thousands, and a guard at the head would make the head unshareable between rules (SeatStreams). The catalogue default is read there, not only in the service: a Java harness gets what an untouched edition gets. A rule whose stream is not wrapped by actif shows a switch with no effect: ConstraintToggleStructurelleTest fails on any catalogue rule in that case, and ConstraintToggleTest checks the mechanism per family (same dataset penalised without the toggle, exactly zero with it).

Who is present on a stand × timeslot line

Three rules read who holds a stand at a given time (standComplexeAvecReferent, repartitionMineursParCreneau, favoriserMixiteDesNiveaux): all read the same line (SeatStreams), the seats still held over the rest of the timeslot. The origin seat of a split seat (ADR 0066 (external site)) stops where its continuation begins: whoever left at 9:20 is neither referent, adult nor beginner for the afternoon.

The solver can then produce a planning contrary to the Labour Code while showing a zero hard score. Four categories are protected (CATEGORIES_PROTEGEES, protegee field): “Legal (minors)”, “Legal (working time)”, “Safety (minors)” and “Organisation (meals)”; the others are unticked without friction. Only two are grounded in law (CATEGORIES_LEGALES, legale field): the two “Legal (…)”; lifting the other two commits the organiser without making the planning illegal, and the dialog must not claim so: it picks its wording on legale, decided by the server.

The screen asks for a confirmation naming the rule, recalling its basis and repeating the terms-of-use formula: the organiser remains the employer and the responsible party for the planning produced. Reactivating asks nothing. The API asks nothing: an MCP client or a curl deactivates without the dialog, the guard is ergonomic, not contractual. Confirmation only, decision owned: no reason, no author journal (without a notion of user, a trace would not be attributable); the Planning rules screen permanently shows what is deactivated, and the shared banner repeats it wherever a solve is launched or judged.

Weight a rule

Each rule penalises with a literal weight in its code; this default is overridable by ConstraintWeightOverrides without touching Java, in three layers, the nearest winning: the deployment (planning.constraint-weights.*, 1 for a hard rule, 5 for a medium or soft rule, 25 for published-plan stability), the edition (ponderation_contrainte), and the scenario when the file pins its dosage. The weight ranges from 1 to 500; 0 is refused. It is set by PUT /api/constraints/{name}/poids or the modifier_contrainte tool (rules API).

Importance in three positions

The screen does not ask for a number: the “Organisation policy” block of Planning rules offers each rule a level (mandatory, or a preference strong, normal or light, of weight 25, 5 and 1) and the “Advanced” block three positions for preferences (core/importance.ts, ConstraintCatalog.POIDS_FAIBLE/NORMAL/FORT). The shipped default is the middle position, so that “lower the importance” always makes sense. A factor of five between neighbouring positions is enough for a strong rule to come before a normal one without crushing the others of its level (ADR 0057 (external site)). Another weight stays allowed (numeric field of the panel, “custom”).

The level: mandatory or preference

An organisation rule has a level chosen per edition (ADR 0111 (external site), applying 0106 (external site)). Mandatory: the rule counts at the hard level, at the rank of legal rules; a plan violating it is infeasible and the diagnostic names it. Preference: it counts at the medium level, at the weight of its position (light 1, normal 5, strong 25). It is the same rule written once: only the place in the score where its breach goes changes. The level is chosen for the medium rules of “Organisation quality”, the meal break and the supervision of minors (niveauReglable); legal, assignment, ad hoc and lock rules stay mandatory, soft preferences stay preferences: a level requested for them is refused. A mandatory rule counts one hard point per breach (its stored weight is kept, not applied); making mandatory a rule an edition cannot hold gives an infeasible plan, which the feasibility analysis says before the solve.

What is weighted, what is not

The rules that really vary from one organiser to another are the medium rules of “Organisation quality” (dosable()): they trade comfort against comfort. A hard rule is respected or the planning is invalid: its weight changes only the convergence speed, and reweighting a legal rule makes it neither more nor less mandatory; they have only their switch. A weight never changes a rule’s level: this is why consecutive days exist in two forms (Rest and consecutive days).

Keeping a trace of a weighting

Each change of activation, weight or level enters the action journal (“Rules” filter: which rule, when, by whom, never the value), and each solve stores the dosage under which it was launched: two plans computed under different dosages cannot be compared at equal weights, and the Plan versions comparison flags it (a juxtaposition, not a measure of effect).

The fairness rules

equilibrerCharge puts loadBalance().unfairness(), a BigDecimal typically below 1, at ×10 scale before truncating to int (otherwise any moderate imbalance truncated to 0 and the solver had no gradient). For “more or less importance”, use planning.constraint-weights.equilibrerCharge; touch UNFAIRNESS_SCALE only for “more or less granularity”. equilibrerCreneauxPenibles applies the same technique on the tiring or premium seats only.

The floor: a rule that penalises everything for lack of data

A rule whose measured datum does not exist in the referential (no declared wish, no referent) can make most of the medium score a constant, and an organiser cannot guess it. Each analysis therefore reads each non-hard rule as a ratio breaches ÷ elements evaluated, the denominator being the rule’s grain (seats filled for souhaitsIncompatibles, stand × timeslot groups for standComplexeAvecReferent, consecutive pairs for eviterChangementEmplacementEloigne, published seats for stabiliteDuPlanPublie). The table is ConstraintFloorRules (external site), exhaustive by test: a medium or soft rule added without a line fails ConstraintFloorRulesTest.

Eleven rules have no per-element reading and are never a floor: the aggregated matches (equilibrerCharge, equilibrerCreneauxPenibles), a reward (affiniteAdHoc) and eight weight-function rules, where the number of matches is a breach and not a boolean per element (a ratio of 1.0 there means “everyone is in breach of a reducible amount”). Cases where the missing datum makes the rule inert (zero premium stands, zero minors) are no floors either: it matches nothing, “satisfied” is exact.

From 95% (FLOOR_THRESHOLD, not 100%: a handful of seats always escapes), the rule is flagged: a mark in the Breaches column of Planning rules, and in its panel the ratio and the named datum, with a link to the entry screen when the referential holds none. A floor nothing of the kind explains is flagged anyway, without a link, but needs a sample: under ten elements evaluated (FLOOR_MIN_SAMPLE), it is not said. A floor the referential explains is flagged whatever the size. The score excluding floors (the raw score minus what the flagged rules cost) is the part a solve can move: it is shown next to the raw score in the Calculate tab and in the Plan versions comparison (kpi; absent, never zero, before the measure). Nothing is deactivated: it is up to the organiser to enter the datum, lower the weight or switch the rule off (ADR 0031 (external site)).

What these rules measure is read in Diagnostic, Load tab (GET /api/planning/equite), which says column by column whether a solver rule weighs it and whether it is active: evening, weekend and holiday hours are measured by no rule there. Weekend and holiday hours are attributed whole to the timeslot’s date (like the ISO week by Creneau.semaineIso()); only evening hours are pro rata, the evening being an hour of the day and not a day.

A mistake, an omission? Fix this page on GitHub. (external site)

A question no guide answers?

Let’s talk See hosting