genetic programming part 2 jay shaffstall. genetic programming review of part 1 program graphing...

33
Genetic Programming Part 2 Jay Shaffstall

Upload: marjorie-cross

Post on 14-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Genetic Programming

Part 2

Jay Shaffstall

Page 2: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Genetic Programming

Review of Part 1

Program graphing

Program breeding

Program mutation

Fitness functions

Development life cycle

Real world applications

Conclusion

Page 3: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Review of Part 1

Genetic programming takes advantage of the power of evolution to grow a program

The fitness function determines which programs from any generation will survive to breed

The best programs out of every generation create the next generation

Page 4: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Review of Part 1

After millions of generations, we end up with a program that can solve the problem

But how does it all work?

Page 5: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Program Graphing

In order to breed programs, we have to represent them in some fashion. Genetic programming represents a program as a graph.

Programs are represented using a lisp like syntax, with the operation coming before the arguments

Page 6: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Program Graphing

Page 7: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Program Breeding

So we have two programs represented as program graphs. How do these two programs combine to form children?We randomly choose a node in each program. We delete the subtree from the first program and replace it with the subtree from the second program

Page 8: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Program Breeding -- Parents

Page 9: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Program Breeding -- Children

Page 10: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Program Mutation

Breeding is not the only way to change a program. We can also mutate a program. The program is changed in a random way, and the change will be passed on to any children.

Page 11: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Program Mutation

Types of mutationsReplace a random subtree with another randomly generated program

Duplicate a subroutine, and randomly half the calls to use the new subroutine

Duplicate arguments to a subroutine, and randomly change half the references to use the new argument

Page 12: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Program Mutation

Types of mutations (continued)Create a new subroutine

Delete an existing subroutine

Delete an existing argument

Page 13: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Fitness Functions

Eventually, between breeding and mutation, we can end up with some complex programs.

So how do we pick the ones that live and the ones that die?

Page 14: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Fitness Functions

The basic purpose of a fitness function is to determine the distance between one program’s solution and the ideal solution.

This allows us to pick the “closest” solutions for breeding.

Page 15: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Fitness Functions

An easy example is a program that must calculate the square of a number.

The fitness function can be something like this:

square (x) – program (x)

Page 16: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Fitness Functions

Those programs that score the lowest in the fitness function are those that are closest to the ideal solution.

Those are the programs that we choose to live and breed.

Page 17: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Fitness Functions

So how do we develop a fitness function for a complex problem, without running into the automated oracle problem?

For example, the problem of writing an order entry system?

Page 18: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Fitness Functions

The simple answer is that we cannot reliably create a fitness function for complex problems.

Does this mean that genetic programming is useless for more complex problems?

Not necessarily.

Page 19: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Fitness Functions

One possibility is to break the problem down into simpler modules that can be represented by a less complex fitness function.

We then evolve all the modules, which will work together to create the final product.

Page 20: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Fitness Functions

So this approach would be a combination of designing the system by a human, and evolving the pieces of the system by a computer.

Page 21: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Development Life Cycle

At first glance, genetic programming seems to require a waterfall method of development.

We’ve all seen that waterfall development only works for simple projects.

What life cycle do we use for complex projects using genetic programming?

Page 22: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Development Life Cycle

The best fit seems to be an iterative cycle, where a human designs the architecture down to simple modules that are then evolved to meet requirements.

As requirements change, only those modules that are affected need to be re-evolved.

Page 23: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Development Life Cycle

Since the modules are relatively simple, re-evolving them will not take as much time as re-evolving the entire program.

We also reduce the chance of getting unexpected features in the program, since the user-visible features will be specified in the human created design of the modules.

Page 24: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Development Life Cycle

In this type of life cycle, we use genetic programming as an entry level programmer, leaving humans free to do the higher level design work.

Page 25: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Real World Applications

So, how closely can genetic programming approach the results of a program written by a human?

John Koza, regarded as the inventor of genetic programming, took a number of problems in circuit design and evolved programs to see how competitive genetic programming was.

Page 26: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Real World Applications

The hardware he used to do this was a Beowulf style cluster of 1,000 Pentium II processors.

Clearly, for anything more than trivial problems, significant computing power is needed.

Page 27: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Real World Applications

What Koza found is that genetic programming does indeed produce results competitive with human designed circuits.

In fact, in several cases genetic programming produced results that were better than human created results

Page 28: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Real World Applications

Unfortunately, several of the genetically programmed designs also infringed on exiting U.S. patents.

This has led Koza to the idea that genetic programming can be used as an invention creator. Give it a problem you would like to solve, but have no idea how, and let it run.

Page 29: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Conclusion

We’ve seen how genetic programming works, and how it can produce competitive results for well defined problems.

Most of our problems in the business arena are not well defined, but I’ve suggested a way in which genetic programming could be a useful tool for implementing well defined pieces of a program.

Page 30: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

Conclusion

While I don’t expect business to start using genetic programming, after doing the research for this presentation, I think it could very well have a place in a business environment.

Page 31: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

ReferencesKoza, John, et al. (1999) Genetic Programming III Morgan Kaufmann PublishersJohn Koza's Home Page, includes basic information on genetic programming, available on the web at http://www.genetic-programming.com/johnkoza.html Koza, John, et al Human Competitive Machine Intelligence available on the web at http://www.genetic-programming.com/humancompetitive.html 

Page 32: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

ReferencesQureshi, Adil GPsys 2b: Java Genetic Programmin System available on the web at http://www.cs.ucl.ac.uk/staff/A.Qureshi/gpsys.html Genetic Programming Conference homepage, available on the web at http://www.genetic-programming.org/Genetic Programming Tutorial, available on the web at http://www.geneticprogramming.com/Tutorial/

Page 33: Genetic Programming Part 2 Jay Shaffstall. Genetic Programming Review of Part 1 Program graphing Program breeding Program mutation Fitness functions Development

References

Genetic Programming, available on the web at http://www2.informatik.uni-erlangen.de/~jacob/Evolvica/GP/Java/html/genprog/gp.html

Fundamentals in Genetic Programming, available on the web at http://www.dd.chalmers.se/~f96edfa/