1
Integer Programming Based
Algorithms
for Peg Solitaire Problem
ver. 2.1
Univ. of Tokyo Masashi KIYOMI
Univ. of Tokyo Tomomi MATSUI
2
Definitions
board: a board has holes
〇: hole on the board
example
configuration:
each hole contains at most one peg
●:hole with a peg
jump operation:
●●〇→〇〇●
〇●●→●〇〇
● 〇
●→〇
〇 ●
〇 ●
●→〇
● 〇
3
Definitions (jump positions)
jump position:
position where a jump operation occurs
38 vertical
+ 38 horizontal
jump positions
jump positions
= 76 jump positions in total
4
peg solitaire problem
given instance:
starting configuration
finishing configuration
solution
Find a sequence of jump operations, if it exists.
If not, say ``infeasible’’.
5
previous results
complexity
Uehara, Iwata (1990):
NP-completeness of solitaire problem
necessary conditions for feasibility
de Bruijn (1972):
necessary condition based on finite field
Berlekamp, Conway, Guy (1982):(Winning Ways)
necessary condition using pagoda function
(linear inequality system)
Avis, Deza (1996):
solitaire cone (polyhedral approach)
6
our results
We propose algorithms for peg solitaire
problems defined on the English board.
main idea:
ordinary backtrack search method
+
search space pruning procedure
based on integer programming (IP)
7
upper bound
IP finds an upper bound of the number of
jump operations at each jump position.
start
finish
∀solution, the # of jump operations at
(the # of jump operations) ≦1
the right-hand-side is a tight upper bound
8
notations
n: the number of holes
English board: n=33
1 2 3
4 5 6
7 ・ ・
・ ・ 27
28 29 30
31 32 33
configuration vector: the n-dimensional
0-1 vector corresponding to the configuration
1 1
1 1
1 1
1: hole with peg
0: empty hole
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1 1 1
1 1 1
1 1 1
0
0
0
1
1
1
0
1
・
・
・
0
∈{0,1}33
9
jump vector
0
1
0
0
1
0
1
0
0
ー
0
1
0
0
ー
1
0
0
-1 jump vectors
0
0
0
0
0
0
0
1
1
-1
=
0
0
0
0
0
0
0
0
1
jump operation = subtraction of jump vector
(jump vector contains two 1s and one -1)
10
jump matrix
holes
jump matrix: (holes)×(jump position)
jump positions
1 ‐1 ‥‥‥ ‐1 0
1 1 ‥‥‥ 0 0
A = -1 1 ‥‥‥ 1 1
0 0 ‥‥‥ 1 ‐1
0 0 ‥‥‥ 0 1
configuration p → configuration p’
jump operation at jump position j
⇔ p’=p - A uj (uj :jth unit vector)
11
jump matrix and peg solitaire problem
A: jump matrix (defined by the given board)
ps: configuration vector of starting config.
pf: configuration vector of finishing config.
If the given peg solitaire problem has a solution,
then ∃x=(x1,x2,...,xm)T:
(1) integer vector indexed by jump positions
(2) ps - Ax = pf
xj : # of jump operations at position j
12
integer programming
IPj: max.
xj
sub. to ps - Ax = pf , x≧0,
x=(x1,x2,...,xm)T is an integer vector.
(1) IPjs are infeasible
⇒ peg solitaire problem is infeasible
(2) (# of jump operations at j)≦(opt. val. of IPj)
The optimal value of IPj is an upper bound of
the # of jump operations at position j.
Our algorithm solves IPj for each position j.
76 jump positions, 76 variables, 33 constraints
13
example of upper bounds
given problem:
solve 76 IP problems:
obtained UB:
0
1
2
14
example of infeasible peg solitaire problem
given problem:
solve 76 IP problems:
IPj are infeasible
⇒ peg solitaire problem is infeasible
Our computational experiences show that the
above feasibility check is very powerful.
15
pagoda function approach
Berlekamp, Conway, Guy (1982):(Winning Ways)
a pagoda function exists ⇔∃y, yTA≧0, yT(ps - pf )<0
⇒ peg solitaire problem is infeasible
Farkas’ Lemma
exactly one of (1) and (2) is satisfied
(1) ∃y, yTA≧0, yT(ps - pf )<0,
(2) ∃x, ps - Ax = pf , x≧0.
IPj: max{xj | ps - Ax = pf , x≧0, x∈Zn }
Feasibility checking method by IPj is stronger
than pagoda function approach.
16
example of infeasible peg solitaire problems (2)
given problem:
infeasible!
76 IP problems have optimal solutions
obtained UB:
0
1
2
IP is infeasible ⇒ peg solitaire is infeasible
IP is infeasible peg solitaire is infeasible
17
algorithm
We propose algorithms for peg solitaire
problems defined on the English board.
main idea:
ordinary backtrack search method
+
search space pruning procedure
based on integer programming (IP)
18
game tree
given problem:
game tree:
all possible jumps
from starting config.
node: configuration
root: starting config.
child=parent+jump
finishing config.
19
search of game tree
depth first search
on game tree
starting
configuration
finishing
configuration
20
DFS+UB
starting
configuration
jump
operation
depth first search
+UB
2
UB of
# of jumps
0
1 1
1
2
1
0
1
1
0
1 1
0
0
1
1
finishing
configuration
0
21
DFS+UB
starting
configuration
depth first search
+UB
2
0
1 1
prune the search tree
1
2
1
0
1
1
0
1 1
0
0
1
1
finishing
configuration
0
22
hash table
We used hash table to avoid searching the same
configurations more than once.
hash size: 2,000,000
The hash technique saves much computational
efforts during the depth-first-search.
23
search method
forward-only search: ordinary DFS
finishing
forward-backward search:
configuration
reverse game tree
half depth
hash table
search game tree
starting
configuration
24
computational experience
MMX Pentium 233MHz with 64MB memory
problem (i)
76 IPs: 9.1 sec.
forward-only: 37 min.
forward-backward:1.4 sec.
problem (ii)
76 IPs: 122 sec.
forward-only: 3.0 sec.
forward-backward: hash overflow
25
END
26
27
28
29
30
© Copyright 2026 Paperzz