API Documentation

In some scenarios, employees need to cover multiple responsibilities simultaneously. A supervisor might be "on call" for two departments, or a manager might oversee several areas at once. We call these shift collisions-when one employee is assigned to overlapping shifts.


How collisions work

By default, the solver prevents employees from working overlapping shifts. This makes sense for most scenarios: you can't physically be in two places at once.

But sometimes overlap is exactly what you need. Configure this two ways:

1. Per-shift collision allowances

On individual shifts, specify which spots can overlap using allowedCollisionSpots:

{
  "id": 100,
  "spot": 5,
  "start": "2024-03-15T08:00:00Z",
  "end": "2024-03-15T16:00:00Z",
  "allowedCollisionSpots": [7, 8]
}

If this shift is assigned to an employee who also has concurrent shifts at spots 7 or 8, the solver won't treat it as a conflict. The assignment is valid.

2. Global collision limit

At the request level, set the maximum number of shift collisions allowed across the entire schedule:

{
  "employees": [...],
  "shifts": [...],
  "spots": [...],
  "numberOfAllowedShiftCollisions": 5,
  "settings": {...},
  "callbackUrl": "..."
}

This tells the solver: "I accept up to 5 instances of employees working overlapping shifts." The solver will use these sparingly, only when they significantly improve the solution.

When to allow collisions

Use shift collisions for:

  • On-call roles - A manager covering multiple departments simultaneously
  • Supervisory positions - Someone overseeing several work areas
  • Backup coverage - An employee who can "float" between adjacent areas during peak times
  • Training scenarios - A trainer present across multiple trainee assignments

Important notes

Allowing shift collisions doesn't bypass other constraints. The employee must still:

  • Have the required skills for all overlapping shifts
  • Belong to allowed teams for all spots
  • Respect contract rules (though overlapping shifts count once toward daily limits, not twice)
  • Honor unavailability wishes

The solver uses collisions strategically to improve solution quality, not as a way to force invalid assignments.


Example

You have three spots: Reception (ID 10), Pharmacy (ID 11), and Admin Office (ID 12). Your department head needs to be available across all three areas during business hours.

Define her shifts with collision allowances:

{
  "shifts": [
    {
      "id": 501,
      "spot": 10,
      "start": "2024-03-20T09:00:00Z",
      "end": "2024-03-20T17:00:00Z",
      "importance": "MANDATORY",
      "allowedCollisionSpots": [11, 12],
      "suggestedEmployees": [7]
    },
    {
      "id": 502,
      "spot": 11,
      "start": "2024-03-20T09:00:00Z",
      "end": "2024-03-20T17:00:00Z",
      "importance": "MANDATORY",
      "allowedCollisionSpots": [10, 12],
      "suggestedEmployees": [7]
    },
    {
      "id": 503,
      "spot": 12,
      "start": "2024-03-20T09:00:00Z",
      "end": "2024-03-20T17:00:00Z",
      "importance": "OPTIONAL",
      "allowedCollisionSpots": [10, 11],
      "suggestedEmployees": [7]
    }
  ],
  "numberOfAllowedShiftCollisions": 3
}

The solver can assign employee 7 to all three overlapping shifts, counting as two collision instances (three shifts = two overlaps).