Skip to content

Hitori (NP-complete) solver using different approaches (tabu search and linear programming)

Notifications You must be signed in to change notification settings

11jolek11/HitoriSolver

Repository files navigation

Hitori

Hitori (Japanese: "Alone" or "one person"; ひとりにしてくれ Hitori ni shite kure, literally "leave me alone") is a type of logic puzzle. Hitori is classified as an NP-complete problem.

Rules

Hitori is played on a grid of squares or cells, with each cell initially containing a number. The game involves eliminating squares/numbers by blacking them out. The objective is to transform the grid into a state where all the following rules are satisfied:

  • No row or column can have more than one occurrence of any given number.
  • Black cells cannot be horizontally or vertically adjacent, though they can be diagonal to one another.
  • The remaining numbered cells must all be connected to each other, either horizontally or vertically.

Files

  • hitori.mod - CPLEX solution.
  • task.dat - Data for the solver.
  • converter.py - Converts a Python puzzle instance representation to a solver representation and saves it in task.dat.
  • meta.py - Implementation of a heuristic algorithm.
  • problems.py - Example problems with solutions.
  • hitori_cp.py - Tests and validates the results of hitori.mod.

About

Hitori (NP-complete) solver using different approaches (tabu search and linear programming)

Topics

Resources

Stars

Watchers

Forks