Tushar Lachman
Melbourne · RMIT ’27
CONSTRAINT SOLVINGRMIT · team

Exam Timetable Solver in Answer Set Programming

No search algorithm was written. The constraints were written, and Clingo did the rest.

Intelligent Decision Making · 2026
Exam Timetable Solver in Answer Set Programming — screenshot

The app, screen by screen

CLICK TO ENLARGE

Every figure here was written by the project’s own code — matplotlib and seaborn output from the notebook and the experiment scripts, exported unedited. Nothing on this page is a mock-up or a redrawing.

WHY IT EXISTS

A university exam timetabler built in Answer Set Programming: real benchmark instances in the Examination Timetable Format, hard constraints that a calendar must satisfy and weak constraints it is scored against, solved with Clingo and then measured across time budgets, thread counts, constraint sets and weightings.

How it’s put together

L00
Answer Set Programming
L01
Clingo
L02
Python
L03
Prolog
L04
pytest
L05
matplotlib

Built with

Answer Set ProgrammingClingoPythonPrologpytestmatplotlib
PERIOD
Intelligent Decision Making · 2026
ROLE
Team of three

The hard parts

06 NOTES
1

The problem is declared rather than searched. Exams, rooms, timeslots, student clashes, room capacities and durations are stated as rules and constraints in ASP, and Clingo finds and optimises the calendar — there is no hand-written search anywhere in the system.

2

Hard and weak constraints are genuinely separated: a hard constraint eliminates an answer set outright, a weak one adds cost. That distinction is what lets the same encoding express “this must never happen” and “avoid this where you can” without collapsing them into one weighted mush.

3

YAML instances are parsed into ASP facts by a Python front end, and solved calendars come back as TSV. An independent Prolog validator checks the output against the specification, so a calendar is verified by something other than the code that produced it.

4

A pytest suite of purpose-built instances covers the constraints one at a time — each with an instance designed to be satisfiable, unsatisfiable, or to carry a specific cost — so a regression in one rule fails a named test rather than silently shifting a total.

5

Experiments were scripted rather than run by hand: a harness sweeps time limits, thread counts, per-constraint configurations and weight settings, writes results to CSV with metadata, and a second script turns those CSVs into the charts below. Any number in the report can be regenerated from the raw run.

6

Two of the experiments returned nothing, and that is a result too. With a fixed time budget, wall-clock time is pinned to the budget regardless of thread count — 324.7s against 324.8s across one to twelve threads — so parallelism has to be judged on solution quality, not on time, which is what the threads-versus-cost chart measures instead.

Want the parts that aren’t on this page — the architecture arguments, the things that broke, a live walkthrough?

NEXTFlight Routing & Trip Planner in Prolog