Savanty

Shift scheduling & rostering

Shift scheduling is the canonical discrete constraint problem: finite staff, finite shifts, hard coverage and availability rules. Savanty translates the policy into ASP and Clingo produces a roster that provably satisfies every rule.

Domain: Scheduling

Rostering is the textbook discrete constraint problem, and it is exactly what Savanty is built for. You have a finite set of people, a finite set of shifts, and a set of hard rules: coverage requirements, availability windows, and fairness caps. Every one of those maps cleanly onto Answer Set Programming.

The shape of the problem

Each shift must be filled by staff drawn from a finite pool. That is a choice rule. Each policy — “one nurse per shift”, “no double shifts in a day”, “Bob is off on weekends” — is an integrity constraint. Savanty’s LLM front-end reads your English description and emits exactly this structure over the canonical assign(Var, Value) contract.

1 { assign(S, N) : nurse(N) } 1 :- slot(S).   % one nurse per slot
:- assign(d1_am, N), assign(d1_pm, N).         % no double shift on day 1
:- assign(S, bob), weekend(S).                 % Bob is off on weekends
#show assign/2.

Why the guarantee matters here

An LLM asked to write a roster produces a plausible table that may quietly violate coverage on Thursday. Savanty never lets the LLM answer — Clingo does, and a returned roster satisfies every constraint by construction. When staffing is genuinely too thin to cover the schedule, you get an honest UNSAT with a minimal unsatisfiable core pointing at the conflicting requirements, not a subtly-broken schedule.

When to reach for something else

If your scheduling problem involves continuous quantities (minimizing overtime cost as a smooth function) or heavy interval/cumulative reasoning, a dedicated CP-SAT model may fit better — see Savanty vs OR-Tools by hand. For discrete coverage-and-availability rostering described in English, Savanty is the short path.

Frequently asked questions

Can Savanty optimize for fairness, not just feasibility?

Yes — soft preferences like balancing workload become an optimization directive, while hard rules (coverage, availability) stay as integrity constraints. Describe which is which in plain English.

What if no valid roster exists?

Clingo returns UNSAT and Savanty extracts a minimal unsatisfiable core — the smallest set of rules that conflict — so you can see exactly why the roster is impossible (e.g. too few staff for the coverage you require).

Related

Try Savanty on your own problem

Open source, MIT licensed. Install from PyPI and solve your first constraint problem.