This project demonstrates the use of Answer Set Programming (ASP) to model and analyze gerrymandering strategies in grid-based electoral systems.
The objective is to partition a voting region (represented as a 2D grid) into a fixed number of contiguous districts to maximize the number of seats won by a given political party.
The repository contains the following main components:
-
benchmarks/Contains 100 benchmark instances in ASP format (.lp). -
imgs/Graphical results, plots, and heatmaps used in the report. -
report/PDF reports containing theoretical background and experimental analysis (English and Italian versions). -
test/Utility scripts for vote counting (count_voters.py) and debugging (debug_districting.lp). -
extra/Notebooks and study notes from the Declarative Programming course. -
political_districting.lpThe main ASP encoding for the districting problem. -
generate_benchmarks.pyPython script used to generate randomized benchmark instances. -
run_experiments_python.pyPython script orchestrating the solver using Clingo. -
results_python.csvOutput file collecting all experiment results.
Theoretical background, model structure, and experimental analysis are detailed in the project reports:
- ๐ฌ๐ง report/GerrymanderingENG.pdf โ English version
- ๐ฎ๐น report/GerrymanderingITV.pdf โ Italian version
For inquiries or feedback regarding this project:
- Aurora Felisari - aurora.felisari@studenti.unipr.it
- Claudio Bendini - claudio.bendini@studenti.unipr.it
This work was developed as part of the Declarative Programming course at the University of Parma to explore logic-based modeling and optimization using ASP and Python.