This repository contains the work from Mingyang Li’s independent study during Spring 2025 at Davidson College. The project focuses on using SAT solvers and related techniques to explore heuristics and find solutions for the L-shape graph coloring problem.
-
Generate the CNF File
The main functions are located inlshape_to_cnf.py.
These functions generate a CNF file encoding the L-shape coloring constraints. Alternative function are all int the same folder. See the comments of each functions. -
Solve the CNF File
- Open
solve.sh. - Enter the name of the generated CNF file.
- Use your desired SAT solver (e.g., Kissat, CaDiCaL) to solve the problem.
- Open
-
**Generate permutation class of a single lshape problem
- Open
visualize.ipynb - Follow the instruction inside
- Currently we can only generate all permutation classes of 4*4 matrices with 2 colors. Others may take long time and may be better to do it in slurm job.
- Open
-
Tuning hyperparamaters of Kissat solver
- Code for tuning and the parameter space is in
grid_search.py - To run it submit the
grid_search.shjob. - You can check top parameters setting and common setting in
grid_search.ipynb
- Code for tuning and the parameter space is in
- Check the distribution of parameter settings and see if we can figure out better parameter space.
- Use Reinforcement learning or other techniques to learn from simpler case and solve 21*21 grid.
- This project emphasizes experimentation with solver heuristics and search for solutions.
- Additional scripts and utilities for preprocessing and postprocessing are included in the repository.