Optimizing a Chess Heuristic Using Evolutionary Algorithms

11
Optimizing a Chess Heuristic Using Evolutionary Algorithms Benjamin Rhew 11-29-04

description

Benjamin Rhew 11-29-04. Optimizing a Chess Heuristic Using Evolutionary Algorithms. Chess and AI in History. Hoaxes The Automaton Chess-Player Ajeeb automaton Endgame Machine (1890) 1950s – True Chess Playing 1988 – Deep Thought 1997 – Deep Blue (vs Kasparov). - PowerPoint PPT Presentation

Transcript of Optimizing a Chess Heuristic Using Evolutionary Algorithms

Page 1: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Optimizing a Chess Heuristic Using Evolutionary Algorithms

Benjamin Rhew11-29-04

Page 2: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Chess and AI in History

Hoaxes

The Automaton Chess-Player

Ajeeb automaton

Endgame Machine (1890)

1950s – True Chess Playing

1988 – Deep Thought

1997 – Deep Blue (vs Kasparov)

Page 3: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Why Optimize (aka Motivation)?

Current evaluation method is becoming obsolete

Evaluate against optimized heuristic instead

Apply to other similar, more difficult problems

Other games

Optimization problems

etc

Page 4: Optimizing a Chess Heuristic Using Evolutionary Algorithms

The Problem

Take a previously existing heuristic and evolve it so that it becomes more effective

More generally, development of a heuristic to be used in a game-tree search algorithm

Page 5: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Representing an Individual

An individual has several genes, with most genes represented by a 64 by 64 array.

Genes that are not arrays are single integers.

Each of these genes corresponds to a heuristic for one piece, sometimes distinguished by color.

{-10,-5,-5,-5,-5,-5,-5, -10, -5 , 0, 0, 3, 3, 0, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 0, 3, 3, 0, 0, -5, -10,-5,-5,-5, -5, -5,-5,-10}

Page 6: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Evolutionary Operators

Crossover

Uniform based on genes (no sub-gene crossing){-10,-5,-5,-5,-5,-5,-5, -10, -5 , 0, 0, 3, 3, 0, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 0, 3, 3, 0, 0, -5, -10,-5,-5,-5, -5, -5,-5,-10}

{-10,-5,-5,-5,-5,-5,-5, -10, -5 , 0, 0, 3, 3, 0, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 0, 3, 3, 0, 0, -5, -10,-5,-5,-5, -5, -5,-5,-10}

{-10,-5,-5,-5,-5,-5,-5, -10, -5 , 0, 0, 3, 3, 0, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 0, 3, 3, 0, 0, -5, -10,-5,-5,-5, -5, -5,-5,-10}

{-10,-5,-5,-5,-5,-5,-5, -10, -5 , 0, 0, 3, 3, 0, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 0, 3, 3, 0, 0, -5, -10,-5,-5,-5, -5, -5,-5,-10}

{-10,-5,-5,-5,-5,-5,-5, -10, -5 , 0, 0, 3, 3, 0, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 0, 3, 3, 0, 0, -5, -10,-5,-5,-5, -5, -5,-5,-10}

{-10,-5,-5,-5,-5,-5,-5, -10, -5 , 0, 0, 3, 3, 0, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5,10,10, 5, 0, -5, -5 , 0, 5, 5, 5, 5, 0, -5, -5 , 0, 0, 3, 3, 0, 0, -5, -10,-5,-5,-5, -5, -5,-5,-10}

Page 7: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Evolutionary Operators

Mutation

1/n chance of mutating, where n is the number of genes.

Once a gene is picked, every value in it is mutated by a gaussian random value.

Page 8: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Other Evolutionary Parameters

Uses the Parallel Framework to speed up calculation

Split into 10 islands of 10 individuals each

Passes 1 individual every 10 generations

Individual is random

Page 9: Optimizing a Chess Heuristic Using Evolutionary Algorithms

The Fitness Function

Fitness is based on win/lose/stalemate

Win=1, lose=-1, stalemate=0

Initialized at 10 fitness, which is then modified by playing original heuristic

Each side has 30 minutes total

Fitness is then based on playing a random solution – and both fitnesses will be updated

Page 10: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Cassandre

Chess engine compatible with winboard and xboard

Already has moves and board representation in place

Only need to provide heuristic

Page 11: Optimizing a Chess Heuristic Using Evolutionary Algorithms

Questions?