Skip to content

pchs20/rooks-problem

Repository files navigation

Rooks problem

The rooks problem in chess involves determining the number of ways to place N rooks on an N x N chessboard such that no two rooks threaten each other. This means each rook must be placed in a unique row and a unique column.

This project solves this problem using a 8 x 8 chessboard. To do so, a solver called SCIP, one of the most powerful non-commercial solvers, is used. The Pyomo library is also used to interact with such model.

Find here the model expressed mathematically.

Installation

  • Base enviornment: You should have installed Python and pip.
  • Miniconda (or Conda): It provides the most straightforward installation of the solver, already compiled. Check out this page.

Development tools

  • Type checking with flake8:
$ flake8 --max-line-length=89

Running

$ python main.py

Code structure

  • main.py: Main execution file. It orchestrates the execution.
  • model.py: Model definition and construction.
  • solver.py: Defines the solver and its functions.
  • concrete_model_dump.txt: Internal structure of the model (for debugging)
  • conda-env.yml: Environment for Conda/Miniconda.
  • requirements.txt: Requirements of the project.

Attributions

  • Base of the code and ideas extracted from Josep's blog here.
  • Definition of the rooks problem extracted from here.

About

Rooks problem

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages