Skip to main content
Patterns control the sequence of shift assignments, either within a single day or across multiple days. Use patterns to enforce or discourage specific shift combinations.

Pattern Types

patterns is a top-level array in the request body (alongside shifts, employees, rules, etc.). Each pattern is automatically applied to every employee in the request — patterns cannot currently be scoped to a subset of employees.

Satisfiability Levels

Single-Day Patterns

Prevent an employee from working both early and late shifts on the same day:
PROHIBITED patterns create hard constraints. If unavoidable, the solution becomes infeasible.
For SINGLE_DAY patterns, the number of ON elements must exactly match the total number of shifts assigned to the employee that day (matched in chronological order). If the employee has additional shifts beyond the ON elements listed, the pattern will not match.
Prefer no late shift after an early shift:

Multi-Day Patterns

Prohibit early shifts immediately after late shifts (next day):
This prevents “clopening” scenarios where an employee closes late and opens early the next day.
Prefer a rotation of early → late → late:

Pattern Elements

type
string
ON - Employee works a shift with matching tags OFF - Employee does not work a shift with matching tagsIf omitted, type defaults to ON.
tags
array
List of shift tags that this element matches (e.g., ["EARLY"], ["NIGHT"])Omit tags (or pass an empty array) to match/require any shift regardless of tag — there is no special "ALL" tag.

Setting Up Shift Tags

Patterns use tags defined on shifts. Add tags to group shifts:

Pattern Weight

Adjust the importance of any pattern — PREFERRED, UNPREFERRED, or PROHIBITED — with weight:
Higher weights make the solver try harder to satisfy the pattern. Use weights to prioritize between multiple preferred patterns.For PROHIBITED patterns, weight scales the hard-constraint penalty (useful for ranking multiple infeasibilities); for PREFERRED/UNPREFERRED, it scales the soft reward/penalty.

Common Patterns