27
Product Geometric Crossover for the Sudoku Puzzle Alberto Moraglio, Julian Togelius & Simon Lucas IEEE CEC 2006

Product Geometric Crossover for the Sudoku Puzzle

Embed Size (px)

DESCRIPTION

IEEE CEC 2006. Product Geometric Crossover for the Sudoku Puzzle. Alberto Moraglio, Julian Togelius & Simon Lucas. Contents. Geometric Crossover and Product Geometric Crossover Design of Geometric Crossover for the Sudoku Puzzle Experimental Results and Conclusions. I. Geometric Crossover. - PowerPoint PPT Presentation

Citation preview

Product Geometric Crossover for the Sudoku

Puzzle

Alberto Moraglio, Julian Togelius

& Simon Lucas

IEEE CEC 2006

Contents

I. Geometric Crossover and Product Geometric Crossover

II. Design of Geometric Crossover for the Sudoku Puzzle

III. Experimental Results and Conclusions

I. Geometric Crossover

Geometric Crossover

• Line segment

• A binary operator GX is a geometric crossover if all offspring are in a segment between its parents.

• Geometric crossover is dependent on the metric

x y

Geometric Crossover

• The traditional n-point crossover is geometric under the Hamming distance.

10110

11011

A

B

A

B

11010X

X2

1

3

H(A,X) + H(X,B) = H(A,B)

Many Recombinations are Geometric

• Traditional Crossover extended to multary strings

• Recombinations for real vectors

• PMX, Cycle Crossovers for permutations

• Homologous Crossover for GP trees

• Ask me for more examples over a coffee!

Being geometric crossover is important because….

• We know how the search space is searched by geometric crossover for any representation: convex search

• We know a rule-of-thumb on what type of landscapes geometric crossover will perform well: “smooth” landscape

• This is just a beginning of general theory, in the future we will know more!

Product Geometric Crossover

• GX1:AxAA geometric under d1• GX2:BxB B geometric under d2• A product crossover of GX1 and GX2 is an

operator defined on the cartesian product of their domains PGX:(A,B)x(A,B)(A,B) that applies GX1on the first projection and GX2 on the second projection. GX1 and GX2 do not need to be independent.

• Theorem: PGX is a geometric crossover under the distance d = d1+d2

Properties of Product Geometric Crossover

• It is a simple and general method to build more complex geometric crossovers from simple geometric crossovers

• Multi-crossover: same representation, same crossover n times

• Hybrid crossover: same representation, different crossover for each projection

• Hybrid representation: different representation (and crossover) for each projection

• No independence required: base crossovers do not need to be independent

II. Geometric Design for Sudoku

The Sudoku Game

Fill in the grid so that every row,every column, and every 3x3 boxcontains the digits 1 through 9

Constraints

It is a constraint-satisfaction problem with 4 types of constraints:

1) Fixed Elements

2) Rows are permutations

3) Columns are permutations

4) Boxes are permutations

Computational Complexity

• The general Sudoku puzzle is based on a (n^2)x(n^2) grid

• The problem is NP-Complete• Relaxation (3 constraints)

– Latin square completion: (1+2+3) NP-Hard– Sudoku puzzle generator: (2+3+4) Polynomial?– Initialisation problem: (1+2+4 or 1+3+4) NP-Hard?

• Relaxation (2 constraints): Polynomial!

Geometric Design

1) Look at the problem and build a nice fitness landscape (= fitness function + distance)

- the smaller search space the better- the smoother landscape the better

2) Pick genetic operators that match the landscape: mutation and crossover should be geometric under the distance chosen

Soft & Hard Constraints

• Hard constraints: all feasible solutions must respect them. Search operators take feasible solutions and produce feasible solutions

• Soft constraints: level of fulfillment is the fitness of a solution

• More than one combination of soft and hard constraints available!

Restricted Hamming space

• Hard constraint: fixed positions• Soft constraints: permutations on rows, columns

and boxes• Distance: Hamming distance between grids• Feasible Mutation: change any non-fixed element• Feasible Crossover: traditional crossover over the

vector obtained by joining the rows of the grid

Row-swap space

• Hard constraints: fixed positions and permutations on rows

• Soft constraints: permutations on columns and boxes

• Distance: sum of swap distances between paired rows (row-swap distance)

• Feasible mutation: swap two non-fixed elements in a row

Geometric crossovers for row-swap space

• Row-wise PMX and row-wise cycle crossover• Feasibility:

– Row permutation: simple PMX and cycle crossovers recombine permutations and produce permutations

– Fixed elements: they both preserve fixed positions in the parents

• Geometricity:– Known: simple PMX and cycle crossovers are geometric under

swap distance– For the product geometric theorem: row-wise PMX and row-wise

cycle crossovers are geometric under row-swap distance

Fitness Function

• Fitness: level of fulfilment of soft constraints

• Fitness to maximize:– Sum of unique elements in each row, plus,– Sum of unique elements in each column, plus,– Sum of unique elements in each box

• For a 9x9 grid the fitness corresponding to a fully correct grid is 243

Smooth Fitness Landscapes• Restricted Hamming Space:

– a single element change affects the current fitness of -1, 0 or +1 for its row, for its column and for its box. Absolute maximum total change in fitness for a single change is 3

• Row-swap space:– A single swap in a row affects the current fitness of 0 for its row, between -2

and +2 for the columns touched, and the same for the boxes touched. The absolute maximum total change in fitness for a single swap in a row is 4

• Maximum delta fitness:– Max fitness for 9x9 grid: 243– Min fitness for 9x9 grid: 27– Max delta fitness in the landscape: 243 – 27=216

• Index of smoothness:– Change in fitness at distance one divided maximum change in fitness– 0: perfectly smooth landscape, 1: max and min fitness are neighbours– Index for Restricted Hamming Space: 3/216– Index for Row-swap Space: 4/216– Both Fitness Landscapes are very smooth!

Prediction!

• Both fitness landscapes are very smooth so geometric crossovers and mutations associated with both spaces should work well

• Advantages of the row-swap search space:– it is much smaller because it restricts the search to

feasible rows

– The restriction includes the optimum grid and prunes only grids with lower fitness

• Bet: Row-swap operators will win!

III. Experimental Results

Hamming space crossovers with uniform swap mutation

Row-swap space crossovers with row-swap mutation

Hill Climbers

• Crossovers based on row-swap space better than those based on hamming space

• Crossover (with mutation) better than hill climbers

• Many more experiments in the paper!

• Future work: smartsquare + crossover

Results summary

Conclusions

• Extended the geometric crossover with the notion of Product Geometric Crossover

• Product geometric crossover for Sudoku– Designed geometric crossovers to deal naturally with constraints– New geometric crossovers for the entire grid by using simple

geometric crossover for each rows– The associated distance has allowed us to analyse the crossover

fitness landscape and predict that the crossovers will perform well

• Extensive experimental results confirm that the crossovers designed perform well