Top Banner
Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni
24

Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence

Genetic Algorithms and Applications of Genetic Algorithms in Compilers

Prasad A. Kulkarni

Page 2: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence2

Search Strategies in AI

Searching is a very important application area of artificial intelligence.

Common search strategies– depth first search– breadth first search– best first search– hill climbing– simulated annealing– genetic algorithms

Page 3: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence3

Outline

Introduction and historical background Biological background Stages in a genetic algorithm Phase ordering problem in compilers Applying GA to address phase ordering Other GA applications Conclusions

Page 4: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence4

Introduction and Historical Background

GAs are part of evolutionary computing introduced by I. Rechenberg in the 1960s.

GAs were invented by John Holland in 1975. GAs are based on Darwin’s principle of

evolution and survival of the fittest. GA is a biased sampling search technique.

Page 5: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence5

Outline

Introduction and historical background Biological background Stages in a genetic algorithm Phase ordering problem in compilers Applying GA to address phase ordering Other GA applications Conclusions

Page 6: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence6

Biological Background

Page 7: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence7

Biological Background (cont...)

Crossover, mutation

Page 8: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence8

Outline

Introduction and historical background Biological background Stages in a genetic algorithm Phase ordering problem in compilers Applying GA to address phase ordering Other GA applications Conclusions

Page 9: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence9

GA Stage 1 – Initialization

Randomly initialize some number of individual solutions to form an initial population

Create initialCreate initialpopulation of population of chromosomeschromosomes

Evaluate fitness ofEvaluate fitness ofeach chromosomeeach chromosomein the populationin the population

Terminate Terminate cond. ?cond. ?

Output the Output the bestbest

solution solution foundfound

Perform crossover/Perform crossover/mutation to createmutation to create

new generationnew generation

YY

NN

Page 10: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence10

GA Stage 2 – Evaluation and Selection

Evaluate the fitness value of each chromosome.

Create initialCreate initialpopulation of population of chromosomeschromosomes

Evaluate fitness ofEvaluate fitness ofeach chromosomeeach chromosomein the populationin the population

Terminate Terminate cond. ?cond. ?

Output the Output the bestbest

solution solution foundfound

Perform crossover/Perform crossover/mutation to createmutation to create

new generationnew generation

YY

NN

Page 11: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence11

GA Stage 3 – Check Termination

The algorithm terminates when some pre-determined termination condition is reached.

Create initialCreate initialpopulation of population of chromosomeschromosomes

Evaluate fitness ofEvaluate fitness ofeach chromosomeeach chromosomein the populationin the population

Terminate Terminate cond. ?cond. ?

Output the Output the bestbest

solutionsolutionfoundfound

Perform crossover/Perform crossover/mutation to createmutation to create

new generationnew generation

YY

NN

Page 12: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence12

GA Stage 4 – Reproduction

Perform crossover and mutation to generate a new population from the current chromosomes.

Create initialCreate initialpopulation ofpopulation ofchromosomeschromosomes

Evaluate fitness ofEvaluate fitness ofeach chromosomeeach chromosomein the populationin the population

Terminate Terminate cond. ?cond. ?

Output the Output the bestbest

solution solution foundfound

Perform crossover/Perform crossover/mutation to createmutation to create

new generationnew generation

YY

NN

Page 13: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence13

GA Stage 5 – Output Solution

Output the best solution found during the algorithm.

Create initialCreate initialpopulation ofpopulation ofchromosomeschromosomes

Evaluate fitness ofEvaluate fitness ofeach chromosomeeach chromosomein the populationin the population

Terminate Terminate cond. ?cond. ?

Output the Output the bestbest

solution solution foundfound

Perform crossover/Perform crossover/mutation to createmutation to create

new generationnew generation

YY

NN

Page 14: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence14

Outline

Introduction and historical background Biological background Stages in a genetic algorithm Phase ordering problem in compilers Applying GA to address phase ordering Other GA applications Conclusions

Page 15: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence15

Phase Ordering Problem

Optimizing compilers apply several optimization phases to improve the performance of applications.

Optimization phases interact with each other. Determining the best order of applying

optimization phases has been a long standing problem in compilers.

Page 16: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence16

Addressing the Phase Ordering Problem

Most researchers consider exhaustive enumeration infeasible– largest optimization sequence length in our

experiments was 32– 15 phases for an optimization sequence length of

32 would result in 1532 evaluations! Heuristics are used to search only a small

portion of the optimization phase order space– random search, genetic algorithms etc.

Page 17: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence17

Outline

Introduction and historical background Biological background Stages in a genetic algorithm Phase ordering problem in compilers Applying GA to address phase ordering Other GA applications Conclusions

Page 18: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence18

GA Stage 1 – Initialization

a

b

c

d

e

f

e

c

f

a

a

c

a

d

e

c

f

e

population1

Page 19: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence19

GA Stage 2 – Evaluation and Selection

a

b

c

d

e

f

e

c

f

a

a

c

a

d

e

c

f

e

population1

88 20 95

Page 20: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence20

GA Stage 3 – Check Termination

Terminating conditions– the desired performance is reached– specified number of generations have elapsed– time constraint for genetic algorithm exceeded

Page 21: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence21

GA Stage 4 – Reproduction

Crossover - 20% sequences in each generation replaced

Mutation - phases in each sequence replaced with a low probability

Page 22: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence22

Outline

Introduction and historical background Biological background Stages in a genetic algorithm Phase ordering problem in compilers Applying GA to address phase ordering Other GA applications Conclusions

Page 23: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence23

Other GA Applications

Designing electronic circuits Designing of aircrafts Routing in circuit switched telecommunication

networks Genetic algorithm applied to robot trajectory

design and many more....

Page 24: Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.

Artificial Intelligence24

Conclusion

Genetic algorithm are a class of heuristic biased sampling approach to searching large spaces.

Described steps during a genetic algorithm Presented detailed application of genetic

algorithm to phase ordering problem in compilers.