Skip to main content
Use assignments to set an initial schedule or lock specific employee-shift pairings that the solver cannot change.

Use Cases

  • Warm start - Provide an initial solution for faster optimization
  • Fixed assignments - Lock confirmed shifts that cannot change
  • Partial planning - Keep some assignments fixed while optimizing others
  • Incremental scheduling - Add new shifts while preserving existing schedule

Warm Start

Provide an initial schedule without locking to help the solver find better solutions faster:
{
  "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 }
  ],
  "assignments": [
    { "employee": "Alice", "shift": "shift-1", "locked": false },
    { "employee": "Bob", "shift": "shift-2", "locked": false }
  ]
}
With locked: false, the solver uses these assignments as a starting point but may reassign them if a better solution exists.

Locked Assignments

Lock assignments that must not change:
{
  "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 }
  ],
  "assignments": [
    { "employee": "Alice", "shift": "shift-1", "locked": true },
    { "employee": "Bob", "shift": "shift-2", "locked": true }
  ]
}
Locked assignments are treated as hard constraints. If they conflict with other hard constraints (e.g., skills, availability), the solution becomes infeasible.

Assignment Properties

shift
string
required
Name of the shift to assign
employee
string
required
Name of the employee to assign
locked
boolean
default:"false"
When true, the solver cannot modify this assignment

Mixed Locking

Combine locked and unlocked assignments for partial replanning:
{
  "assignments": [
    { "employee": "Alice", "shift": "shift-1", "locked": true },
    { "employee": "Bob", "shift": "shift-2", "locked": false },
    { "employee": "Carol", "shift": "shift-3", "locked": false }
  ]
}
Alice stays on shift-1. Bob and Carol’s assignments serve as suggestions that the solver may improve.

Best Practices

  • Large problems where finding any solution is slow
  • Incremental changes to existing schedules
  • Testing “what-if” scenarios from a known state
  • Employee has confirmed the shift
  • Contractual obligations require specific assignments
  • External constraints not modeled in the API
  • Don’t lock assignments that violate skills or availability
  • Leave flexibility for the solver to optimize
  • Use locked: false for preferences, locked: true only for requirements