300 likes | 407 Views
Integer Programming Based Algorithms for Peg Solitaire Problem ver. 2.1. Univ. of Tokyo Masashi KIYOMI Univ. of Tokyo Tomomi MATSUI. Definitions. board : a board has holes 〇 : hole on the board example configuration :
E N D
Integer Programming Based Algorithms for Peg Solitaire Problemver. 2.1 Univ. of Tokyo Masashi KIYOMI Univ. of Tokyo Tomomi MATSUI
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: • ●●〇→〇〇● ● 〇 〇 ● • 〇●●→●〇〇 ●→〇 ●→〇 • 〇 ● ● 〇
Definitions (jump positions) • jump position: • position where a jump operation occurs • 38 vertical + 38 horizontal • jump positions jump positions • = 76 jump positions in total
peg solitaire problem • given instance: • starting configuration finishing configuration • solution • Find a sequence of jump operations, if it exists. • If not, say ``infeasible’’.
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)
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)
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
0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 1 ・ ・ ・ 0 notations 1 2 3 4 5 6 7 ・ ・ • n: the number of holes • English board: n=33 • configuration vector: the n-dimensional • 0-1 vector corresponding to the configuration ・ ・ 27 28 29 30 31 32 33 ∈{0,1}33 1: hole with peg 0: empty hole
jump vector • jump vectors • jump operation = subtraction of jump vector • (jump vector contains two 1s and one -1) 0 0 0 0 0 0 1 1 -1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 -1 0 0 1 0 0 1 0 1 0 0 ー ー =
jump matrix • 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 - Auj (uj :jth unit vector) holes
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
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
0 1 2 example of upper bounds • given problem: • solve 76 IP problems: • obtained UB:
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.
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.
0 1 2 example of infeasible peg solitaire problems (2) • given problem: • infeasible! • 76 IP problems have optimal solutions • obtained UB: • IP is infeasible ⇒ peg solitaire is infeasible • IP is infeasible peg solitaire is infeasible
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)
game tree • given problem: • game tree: • all possible jumps • from starting config. • node: configuration • root: starting config. • child=parent+jump finishing config.
starting configuration finishing configuration search of game tree • depth first search • on game tree
jump operation UB of # of jumps DFS+UB starting configuration • depth first search • +UB 2 1 1 0 2 1 0 0 1 1 1 1 1 0 1 1 0 0 finishing configuration
prune the search tree DFS+UB starting configuration • depth first search • +UB 2 1 1 0 2 1 0 0 1 1 1 1 1 0 1 1 0 0 finishing configuration
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.
reverse game tree half depth hash table search game tree starting configuration search method • forward-only search: ordinary DFS • forward-backward search: finishing configuration
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