← Back to portfolio

Artificial intelligence · Automated planning

Lightsout

An automated-planning study for solving Lightsout and comparing the cost of finding solutions with fewer moves.

Period
Jun 2025
Team
Two-person project
Context
Academic Artificial Intelligence project.
My role
Code and report developed jointly

My contribution

My colleague and I worked together on the code, experiments and report, without a fixed division of tasks.

  • Python
  • PDDL
  • Unified Planning
  • Fast Downward
  • Breadth-first search
Diagram of a move on a Lightsout board
Diagram from the report: pressing a cell toggles it and its orthogonal neighbours.
  • Planning with PDDL
  • Comparing runtime and plan length

Modelling the problem

In the variant we studied, the board starts with every light off and the goal is to turn them all on. Each press toggles a cell and its orthogonal neighbours.

We modelled states and actions with PDDL and Unified Planning for Fast Downward. We then implemented a modified breadth-first search with a heuristic prioritising states with more lights on.

Effect of a second press on a Lightsout board
A move can turn previously lit cells off, making intermediate states important.

Fewer moves, more search time

The heuristic retains N successors at each expansion. Increasing N explores more alternatives but raises runtime. These are the documented results for the 5 × 5 test case:

Comparison for the report’s 5 × 5 test case
MethodMovesRuntime
Fast Downward490.61 s
BFS · N = 2250.99 s
BFS · N = 31714.20 s
BFS · N = 41558.95 s
BFS · N = 515175.63 s

What the experiment showed

With N = 2, the solver took 25 moves in under a second. With N = 4, it found a 15-move plan but took approximately 59 seconds. These are separate configurations: the largest reduction was not achieved at sub-second runtime.

Successor pruning limits the search. These results do not prove general optimality or that the algorithm outperforms Fast Downward on every problem. We worked jointly on both the implementation and the report.

Documented from the academic report and presentation. No public source repository is linked.