NPC Pill #1: Single Overlap RX3C

NPC Pills (NP-Complete pills) is a collection of some NP-completeness proofs that I posted on the Q&A sites and Up to my knowledge they are original and some of them are not so trivial. At present, most of them are just sketches that contain the NP-hardness reduction idea, but for some of them I wrote (or I’m going to write) a more formal paper. If you are particularly interested in one of them write me an email.


The EXACT COVER BY 3-SETS (X3C) problem is:

Instance: Set $X = \{x_1,x_2,…,x_{3q}\}$ and a collection $C = \{C_1,…,C_m\}$ of 3-element subsets of $X$.
Question: Does $C$ contain an exact cover for $X$, i.e. a subcollection $C’ \subseteq C$ such that every element of $X$ occurs in exactly one member of $C’$?

X3C is NP-complete [1], and as shown in [2] it remains NP-complete even if every element $x_i$ contained in exactly 3 subsets of $C$ (Restricted Exact Cover by 3-Sets – RX3C).

We proved that it remains NP-complete even if every pair of subsets in $C$  share at most one element; i.e. for all $i \neq j,\; | C_i \cap C_j | \leq 1$ and we call this restricted version SINGLE OVERLAP RX3C.

[1] M. R. Garey, David S. Johnson: Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman 1979, ISBN 0-7167-1044-7.
[2] Teofilo F. Gonzalez: Clustering to Minimize the Maximum Intercluster Distance. Theor. Comput. Sci. 38: 293-306 (1985).


Weapon-target assignment problem

The decision version of the Weapon-Target Assignment (WTA) problem is as follows:

There are a number of weapons and a number of targets. The weapons are of type $i = 1, \ldots, m$ . There are $W_{i}$ available weapons of type $i$. Similarly, there are $j = 1, \ldots, n$ targets, each with a value of $V_{j}$ . Any of the weapons can be assigned to any target. Each weapon type has a certain probability of destroying each target, given by $p_{i,j}$ . Does there exist a weapon-target assignment such that:

$$D = \sum_{j=1}^n V_j \prod_{i=1}^m q_{i,j}^{x_{i,j}} \leq k$$

where $k$ is a given integer; $x_{i,j} = 1$ if weapon $i$ is assigned to target $j$, $x_{i,j} =0$ otherwise; $q_{i,j} = 1 – p_{i,j}$ is the survival probability of target $j$ when hit by weapon $i$. No more than $W_i$ weapons of type $i$ can be used, so we must add the following constraint:

$$\sum_{j=1}^n x_{i,j} \leq W_i \quad \mbox{ for } i = 1,\ldots,m$$

WTA problem is NP complete (see L. Chen, C. J. Ren, and S. Deng, “An efficient approximation for weapon-target assignment,” vol. 1, Computing, Communication, Control, and Management. ISES International Colloquium, 2008, pp. 764-767), we give an alternate hardness proof using a reduction from the NP-complete SUBSET PRODUCT problem. Continue reading

The Crazy Frog Puzzle and Permutation Reconstruction from Differences

The Crazy Frog Puzzle (CFP) is the following: we have a $n \times n$ partially filled board, a crazy frog placed on an empty cell and a sequence of horizontal, vertical, and diagonal jumps; each jump has a fixed length and two possible opposite directions. The crazy frog must follow the sequence of jumps, and at each step it can only choose among the two available directions. Can the frog visit every empty cell of the board exactly once (it cannot jump on a blocked cell and on the same cell two times)?

 Crazy Frog PuzzleFigure 1: an example of the Crazy Frog Puzzle on the left and its solution on the right.

 We prove that the Crazy Frog Puzzle is $\sf{NP}$-complete even if restricted to 1 dimension and even without blocked cells. The 1-D CFP without blocked cells corresponds to the problem of reconstructing a permutation from its differences:

Permutation Reconstruction from Differences problem:
Input: a set of $n-1$ distances $a_1,a_2,…,a_{n-1}$
Question: does exist a permutation $\pi_1,…,\pi_n$ of the integers $[1..n]$ such that $| \pi_{i+1} – \pi_i| = a_i$, $i=1,…,n-1$ ?

For example, given the differences $(2,1,2,1,5,3,1,1)$ a valid permutation of $[1..9]$ is $(5,7,6,8,9,4,1,2,3)$

Update 2013-12-19: a new version of the paper is available.

The Complexity of Crazy Frog Puzzle and Permutation Reconstruction from Differences click here to download a draft of the paper


Complexity of the Hidden Polygon Puzzle

The Hidden Polygon Puzzle (for brevity HPP) decision problem  is:

Input: a set $P$ of $m$ integer points on a $n \times n$ square grid and an integer $k \leq m$;

Question: does exist a simple rectilinear polygon with $k$ or more vertices $(v_1,v_2, …, v_t), \; v_i \in P, t \geq k$?

The following figure shows an example of a HPP puzzle.

Hidden Polygon PuzzleFigure 1: Given the 21 points on the right, can we find
a simple rectilinear polygon with at least 16 vertices?
A possible solution is shown on the right.

The problem is a slight variant of the $\sf{NP}$-complete puzzle game Hiroimono; we prove that the Hidden Polygon Puzzle is  $\sf{NP}$-complete, too using a completely different reduction.

click here to download the paper

Hidato is NP-complete

Hidato (also known as Hidoku) is a logic puzzle game invented by Dr. Gyora Benedek, an Israeli mathematician. The rules are simple: given a grid with $n$ cells some of which are already filled with a number between $1$ and $n$ (the first and the last number are circled), the player must completely fill the board with consecutive numbers that connect horizontally, vertically, or diagonally.


Figure 1: An Hidato game (that fits on a $8 \times 8$ grid) and its solution on the right.

We prove that the corresponding decision problem $\sf{HIDATO}$ : “Given a Hidato game that fits in a $m \times n$ grid, does a valid solution exist?” is $\sf{NP}$-complete.

Continue reading

Binary Puzzle is NP-complete

Net puzzleBinary Puzzle (also known as Binary Sudoku) is an addictive puzzle played on a $n \times n$ grid; intially some of the cells contain a zero or a one; the aim of the game is to fill the empty cells according to the following rules:

  • Each cell should contain a zero or a one and no more than two similar numbers next to or below each other are allowed
  • Each row and each column should contain an equal number of zeros and ones
  • Each row is unique and each column is unique

We prove that the decision version of Binary Puzzle is NP-complete.

click here to download the paper

The complexity of the puzzle game Net: rotating wires can drive you crazy

An amateur proof that the puzzle game Net is NP-complete.

Net puzzleAbstract
The puzzle game Net, also known as FreeNet or NetWalk, is played on a grid filled with terminals and wires; each tile of the grid can be rotated and the aim of the game is to connect all the terminals to the central power unit avoiding closed loops and open-ended wires. We prove that Net is NP-complete.

click here to download the paper

Rolling a cube can be tricky

An amateur proof that the rolling cube puzzle is NP-complete.

We settle two open problems related to the rolling cube puzzle: Hamil-
tonian cycles are not unique even in fully labeled boards and rolling
cube puzzle is NP-complete in labeled boards without free cells and with
blocked cells.

Rolling a cube can be tricky click here to download the paper

NOTE: another example of two distinct Hamiltonian cycles in a fully labeled board has also been found by Pálvölgyi Dömötör (see this post on mathoverflow).