The Programming Game An Alternative to GP for Expression Search - - PowerPoint PPT Presentation

the programming game
SMART_READER_LITE
LIVE PREVIEW

The Programming Game An Alternative to GP for Expression Search - - PowerPoint PPT Presentation

The Programming Game An Alternative to GP for Expression Search DAASE/COW Open Workshop Tuesday 23rd April 2013 David R White SICSA Research Fellow University of Glasgow A Confession DAASE and Genetic Programming An Alternative Program


slide-1
SLIDE 1

The Programming Game

An Alternative to GP for Expression Search DAASE/COW Open Workshop Tuesday 23rd April 2013 David R White SICSA Research Fellow · University of Glasgow

slide-2
SLIDE 2

A Confession

slide-3
SLIDE 3

DAASE and Genetic Programming An Alternative Program Search Method Two Experiments Wrap-Up

slide-4
SLIDE 4

DAASE and Genetic Programming An Alternative Program Search Method Two Experiments Wrap-Up

slide-5
SLIDE 5

Observation

“There have been exciting recent breakthroughs in the use of genetic programming to re-design aspects of systems to fix bugs, to migrate to new platforms and languages and to optimise non-functional properties.” Harman et al., Dynamic Adaptive Search Based Software Engineering, ESEM 2012.

slide-6
SLIDE 6

Genetic Programming as a Hyper-Heuristic

slide-7
SLIDE 7

The Demands of DAASE

◮ Dynamic, online, run-time optimisation. ◮ Continuous adaptation.

slide-8
SLIDE 8

Anytime Algorithms

Evolutionary Algorithms are often viewed as anytime algorithms:

Time Quality Algorithm 1 Algorithm 2

slide-9
SLIDE 9

Anytime Algorithms

Evolutionary Algorithms are often viewed as anytime algorithms:

Time Quality Algorithm 1 Algorithm 2

. . . but I would argue that they are somewhat imperfect anytime

  • algorithms. Especially GP.
slide-10
SLIDE 10

Why GP is not so Anytime

◮ Bloat ◮ Parameter Setting ◮ Difficulty of Allocating Computational Budget ◮ Notions of Progress and Coverage

slide-11
SLIDE 11

Why GP is not so Anytime

◮ Bloat ◮ Parameter Setting ◮ Difficulty of Allocating Computational Budget ◮ Notions of Progress and Coverage

How well do we understand a GP search? How can we hope to control it? (“Insight”)

slide-12
SLIDE 12

Steal from Artificial Intelligence Research

slide-13
SLIDE 13

DAASE and Genetic Programming An Alternative Program Search Method Two Experiments Wrap-Up

slide-14
SLIDE 14

Monte Carlo Tree Search

slide-15
SLIDE 15

Game Tree

slide-16
SLIDE 16

Sampling

29 possible moves for White here.

slide-17
SLIDE 17

Programming is a One-Player Game

slide-18
SLIDE 18

Tristan Cazenave’s Work

Nested Monte-Carlo Expression Discovery, Cazenave, ECAI 2010. Monte-Carlo Expression Discovery, International Journal on Artificial Intelligence Tools, Cazenave, 22 (1) 2013.

slide-19
SLIDE 19

A Stack Machine

+ * a b sqrt { +, *, -, /} {a, b}

root Each atom added is a move through the game tree. Stack using Reverse Polish notation. atoms

slide-20
SLIDE 20

Building the Game Tree

  • 1. Selection
  • 2. Expansion
  • 3. Sampling
  • 4. Update
slide-21
SLIDE 21

Python Implementation

def uct ( max evals , terms , nonterms , ucb constant , max nodes , s c o r e f ) : root = TreeNode ( None , terms , nonterms , None , ucb constant , 1 , 0 , max nodes ) f o r i i n xrange ( max evals ) : i f root . e x p l o r e d : break stac k = E x p r e s s i o n S t a c k ( max nodes ) l e a f = t r e e p o l i c y ( root , terms , nonterms , ucb constant , stack , max nodes ) s c o r e = p l ay ou t ( stack , terms , nonterms , s c o r e f ) backup ( l e a f , s c o r e ) return root def t r e e p o l i c y ( node , terms , nonterms , ucb constant , stack , max nodes ) : while stac k . l e a v e s > 0: i f not node . a l l a t o m s t r i e d ( ) : n e w c h i l d = expand ( node , stack , terms , nonterms , ucb constant , max nodes ) stac k . push ( n e w c h i l d . node atom ) i f stac k . l e a v e s == 0: n e w c h i l d . e x p l o r e d = True n e w c h i l d . p o s s i b l e a t o m s = [ ] return n e w c h i l d e l s e : node = b e s t c h i l d ( node ) stac k . push ( node . node atom ) return node

slide-22
SLIDE 22

Python Implementation (Cont.)

def expand ( node , stack , terms , nonterms , ucb constant , e x p r s i z e , max nodes ) : atom = node . next atom ( ) e l e a v e s = stack . l e a v e s + atom . a r i t y − 1 e s i z e = l e n ( stack . e x p r e s s i o n )+1 c = TreeNode ( atom , terms , nonterms , node , ucb constant , e l e a v e s , e s i z e , max nodes ) node . a d d c h i l d ( c ) return c def backup ( node , s c o r e ) : while node i s not None : node . v i s i t s = node . v i s i t s + 1 node . sum scores = node . sum scores + s c o r e i f node . a l l a t o m s t r i e d ( ) : done = True f o r c i n node . c h i l d r e n : done = done and c . e x p l o r e d node . e x p l o r e d = done node = node . parent

slide-23
SLIDE 23

A Simple Example

Symbolic regression with the language {+, ∗, a, b}.

slide-24
SLIDE 24

Example Game Tree Construction

[null] [null], 1, 0.1 [+], 1, 0.1 + a b score = 0.1 [+], 1, 0.1 + [*], 1, 0.3 a a

*

score = 0.3 [null], 2, 0.4 [+], 1, 0.1 + [*], 1, 0.3 [null], 4, 0.5

*

a score = 0 b [+], 1, 0.1 + [*], 1, 0.3 [null], 3, 0.5

*

a score = 0.1 [a], 1, 0.1 [a], 1, 0.1 [+], 1, 0.1 + [*], 2, 0.8 [null], 3, 0.5

*

a b [a], 1, 0.1 [*,+], 1, 0.5 + a b score = 0.5 b [null], 5, 1.0 [b], 1, 0.1 [b], 1, 0.1 Step 1 Step 2 Step 3 Step 4 Step 5 Step 6

slide-25
SLIDE 25

Balancing Exploration and Exploitation

Choose child with highest UCT score. Sc nc + K

  • 2 ln nc

np Sc total score for playouts involving this node. nc number of visits to this node. np number of visits to the parent of this node. K constant

slide-26
SLIDE 26

DAASE and Genetic Programming An Alternative Program Search Method Two Experiments Wrap-Up

slide-27
SLIDE 27

The Target Problem

Find an equation using the numbers {1 . . . 10} exactly once and the arithmetic operators +,-,/,* so that the result is as close to 737 as possible.

slide-28
SLIDE 28

Target Problem: Results

  • 1e+01

1e+03 1e+05 0.0 0.2 0.4 0.6 0.8 1.0

Comparing Median Best Fitness on the Target Problem

Evaluations (log scale) Fitness Score + + + + + + + + + + + + + + + + + + + + x x x x x x x x x x x x x x x x x x x x

  • +

x GP Nested UCT

slide-29
SLIDE 29

Prime Generation

Find an equation that generates unique prime numbers when fed with the natural numbers as input. The function set is +,-,*,/ and the terminal set is {1 . . . 10} and all the prime numbers under 100.

slide-30
SLIDE 30

Prime Problem: Results

  • 1e+01

1e+03 1e+05 10 20 30 40 50

Comparing Median Best Fitness on the Prime Problem

Evaluations (log scale) Fitness Score + + + + + + + + + + + + + + + + + + + + x x x x x x x x x x x x x x x x x x x x

  • +

x GP Nested UCT

slide-31
SLIDE 31

Advantages of MCTS

Concise Solutions. Game Tree is Human-Readable. Parallelisation.

slide-32
SLIDE 32

Relevant Previous Work

Real-time Games UCT for Tactical Assault Planning in Real-Time Strategy Games, Balla and Fern, ICAI 2009. Scheduling Problems Monte-Carlo Tree Search in Production Management Problems, Chaslot et al., Benelux Conference on AI, 2006. (includes a comparison to EAs) Feature Selection Feature Selection as a One-Player Game, Gaudel and Sebag, ML 2010.

slide-33
SLIDE 33

DAASE and Genetic Programming An Alternative Program Search Method Two Experiments Wrap-Up

slide-34
SLIDE 34

What next?

A better paper! Further adapting MCTS for program search. e.g. use of grammars to introduce typing. Application to challenging problems.

slide-35
SLIDE 35

Acknowledgements

Juan E. Tapiador Tristan Cazenave

slide-36
SLIDE 36

Further Reading

Highly recommended: A Survey of Monte Carlo Tree Search Methods, Browne et al., IEEE Trans. on Computational Intelligence and AI in Games, 2012.