Skip to main content
Fairness buckets ensure equitable workload distribution among a specific group of employees for selected shifts during a defined period.

Use Cases

  • Equal shift distribution - Ensure all team members get similar hours
  • Weekend rotation - Fairly distribute unpopular shifts
  • Skill-based teams - Balance workload within specialized groups

Basic Fairness

Define a fairness bucket with employees, shifts, and the evaluation period:
{
  "employees": [
    { "name": "Alice" },
    { "name": "Bob" },
    { "name": "Carol" }
  ],
  "shifts": [
    { "name": "shift-1", "from": "2024-01-01T08:00:00", "to": "2024-01-01T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-2", "from": "2024-01-02T08:00:00", "to": "2024-01-02T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-3", "from": "2024-01-03T08:00:00", "to": "2024-01-03T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-4", "from": "2024-01-04T08:00:00", "to": "2024-01-04T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-5", "from": "2024-01-05T08:00:00", "to": "2024-01-05T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-6", "from": "2024-01-06T08:00:00", "to": "2024-01-06T16:00:00", "min": 1, "max": 1 }
  ],
  "fairnessBuckets": [
    {
      "employees": ["Alice", "Bob", "Carol"],
      "shifts": ["shift-1", "shift-2", "shift-3", "shift-4", "shift-5", "shift-6"],
      "period": {
        "from": "2024-01-01",
        "to": "2024-01-07"
      },
      "target": "PT16H"
    }
  ]
}
The solver distributes the 6 shifts evenly: each employee gets 2 shifts during the week.

Fairness Properties

employees
array
required
List of employee names to include in this fairness group
shifts
array
required
List of shift names to distribute fairly among the employees
period
object
Time period during which fairness is evaluated
target
string (ISO 8601 duration)
required
Target workload per employee (e.g., PT40H for 40 hours)

Multiple Fairness Buckets

Create separate fairness groups for different teams or shift types:
{
  "fairnessBuckets": [
    {
      "employees": ["Alice", "Bob"],
      "shifts": ["morning-1", "morning-2", "morning-3"],
      "period": { "from": "2024-01-01", "to": "2024-01-07" },
      "target": "PT12H"
    },
    {
      "employees": ["Carol", "Dave"],
      "shifts": ["evening-1", "evening-2", "evening-3"],
      "period": { "from": "2024-01-01", "to": "2024-01-07" },
      "target": "PT12H"
    }
  ]
}
Each bucket operates independently. Morning shifts are distributed among Alice and Bob, while evening shifts go to Carol and Dave.

Target-Based Fairness

Set a specific workload target instead of equal distribution:
{
  "fairnessBuckets": [
    {
      "employees": ["Alice", "Bob", "Carol"],
      "shifts": ["shift-1", "shift-2", "shift-3"],
      "period": { "from": "2024-01-01", "to": "2024-01-07" },
      "target": "PT24H"
    }
  ]
}
Use target when employees have different availability or contract types but should work toward the same weekly hours.

Fairness vs Rules

ApproachBest For
FairnessEqual distribution of similar shifts
RulesHard limits on working days/hours
CombinedFair distribution within labor law constraints