This repo provides useful solvers of some interesting puzzles. Some basic demos of classic OR problems are also included. The main solver I used in the repo is Google Operations Research software ORtools, especially its CS-SAT solver. Commercial solver Gurobi (Licence required, of course) is also used for specific puzzle(Like Slitherlink).
Since most present solver of those problems are based on logical methods, this repo provides solvers based on mathematical Programming (Integer Programming, Constraint Programming etc..)
Take it slowly, it'll go fast.
✅ Python Environment: Python 3.10.12,
✅ Gurobi Optimizer Version: 10.0.3.
✅ ortools Optimizer Version: 9.7.2996
-
Ortools for diversified Sudoku-like Puzzles: 🥰 The very beginning of my repo. In this note, most of the sudokus (and variants) are well-designed so you can easily add or delete or integrate these constraints and solve comprehensive Sudoku grid, such as "Killer sudoku with Thermo Constraints" or "Anti-Knight Diagnoal Sudoku". A very good example is This.
-
Solvers for Logic Puzzles using CS-SAT or MILP. More INTERESTING and brain-burned logic puzzles. Including path-finding, digit-filling and flag-placing puzzles. The puzzles that have been solved:
ID | Sudoku and variants | Chinese Translation | Finished and Tested | Note |
---|---|---|---|---|
1 | Standard Sudoku | 标准数独 | ✅ | Rules |
2 | Killer Sudoku | 杀手数独 | ✅ | Rules |
3 | Jigsaw Sudoku | 锯齿数独 | ✅ | Rules |
4 | Consecutive Sudoku | 连续数独 | ✅ | Rules |
5 | Sandwich Sudoku | 三明治数独 | ✅ | Rules |
6 | Thermometer Sudoku | 温度计数独 | ✅ | Rules |
7 | Petite-Killer Sudoku | 小杀手数独 | ✅ | Rules |
8 | Anti-Knight Sudoku | 无马数独 | ✅ | Rules |
9 | Anti-King Sudoku | 无缘数独 | ✅ | Rules |
10 | Greater-Than Sudoku | 不等式数独 | ✅ | Rules |
11 | Diagonal Sudoku | 对角线数独 | ✅ | Rules |
12 | Vudoku | V宫数独 | ✅ | Rules |
13 | Arrow Sudoku | 箭头数独 | ✅ | Rules |
14 | XV Sudoku | XV数独 | ✅ | Rules |
15 | Window Sudoku | 窗口数独 | ✅ | Rules |
16 | Kropki Sudoku | 黑白点数独 | ✅ | Rules |
17 | Even-Odd Sudoku | 奇偶数独 | ✅ | Rules |
Table of Sudoku and its variants: 👆
ID | Name of Other Puzzles | Chinese Translation | Finished? | Note |
---|---|---|---|---|
1 | An Alphadoku | 25 by 25 字母独 | ✅ | |
2 | Akari (aka: light UP!) | 照明 | ✅ | Rules |
3 | Cryptarithmetic Puzzle | 破译密码 | ✅ | |
4 | Norinori | 海苔 | ✅ | Rules |
5 | Number Link | 数链 | ✅ | |
6 | A Minesweeper | 静态扫雷 | ✅ | |
7 | Simple Loop (aka: Loopy~) | 简单回路 | ✅ | 🚀 Gurobi used for MILP |
8 | Siltherlink | 环 | ✅ | 🚀 Gurobi used for MILP |
9 | Mosaic | 马赛克 | ✅ | Rules |
10 | Tent | 帐篷 | ✅ | Rules |
11 | Nonogram | 数织 | ✅ | No use of ortools |
12 | Aquaium | 水箱 | ✅ | |
13 | Kakurasu | 方阵和 | ✅ | |
14 | Starbattle | 星战 | ✅ | |
15 | LITS | LITS | ❌ | |
16 | Pentomino | 五联骨牌 | ✅ | Rules |
17 | Suguru | 🤔️ | ✅ | Rules |
18 | Shikaku | 直角 | 🐌 | Rules |
19 | Kakuro | 交叉和 | ✅ | |
20 | Binario | 二进制 | ✅ | |
21 | Five Cells(aka: Faibuseruzu) | 五空格 | ✅ | |
22 | Fobidoshi (aka: Forbidden Four) | 禁止四连 | ✅ | Rules |
23 | Hitori | 请勿打扰 | ✅ | 🚀 Gurobi used for MILP |
24 | Monotone | 单调性 | ✅ | 🚀 Gurobi used for MILP |
25 | Creek | 小溪 | ✅ | 🚀 Gurobi used for MILP |
26 | Patchwork (aka: Tatami) | 榻榻米 | ✅ | Rules |
27 | Kalkulu | 解谜游戏 | ✅ | Rules and dataset |
Table of Other Puzzles: 👆
Some materials for self-learning:
- Ortools for Linear Programming : Tutorials.
- Ortools for Mixed Integer Programming: Tutorials.
- Ortools for Constraint Programming: Tutorials.
- Ortools for Knapsack Problem: Tutorials.
- Ortools for VRP: Variants and ortools codes( of official website for self-learning).
- Ortools & Gurobi for TSP: Two main methods for TSP.
For text explanation and mathematical Modeling, visit My Website for more info.
-
Column Generation Method: Large-Scale Linear Programming and Cutting Stock Problems: Team Meeting report.
-
Branch & Price for Parallel Machine Scheduling: 🐌...
- Some basic / classic Operations Research Modeling :
- ORtools Official
- Hakank's ORtools tutorials
- Puzzle data: Raetsel's Janko, Puzzle