University of Kurdistan Artificial Intelligence Methods AIM Lecture

  • Slides: 37
Download presentation

University of Kurdistan Artificial Intelligence Methods (AIM) Lecture 2: Genetics Algorithms (GA’s) Lecturer: Kaveh

University of Kurdistan Artificial Intelligence Methods (AIM) Lecture 2: Genetics Algorithms (GA’s) Lecturer: Kaveh Mollazade, Ph. D. Department of Biosystems Engineering, Faculty of Agriculture, University of Kurdistan, Sanandaj, IRAN.

Contents • This lecture will cover: – Introduction – History – Biological background –

Contents • This lecture will cover: – Introduction – History – Biological background – GA operators – Examples Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 1

Introduction Ø Genetic algorithms (GA’s) are a part of evolutionary computing, which is a

Introduction Ø Genetic algorithms (GA’s) are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence. Ø Genetics algorithms are a technique to solve problems which need optimization based on idea that evolution represents search for optimum solution set. GA’s are based on Darwin’s theory of evolution. Simply said, solution to a problem solved by genetic algorithms is evolved. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 2

Darwin’s theory of evolution Artificial Intelligence Methods – Department of Biosystems Engineering – University

Darwin’s theory of evolution Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 3

History • Idea of evolutionary computing was introduced in the 1960 s by I.

History • Idea of evolutionary computing was introduced in the 1960 s by I. Rechenberg in his work "Evolution strategies“. • Genetic Algorithms (GAs) were invented by John Holland developed by him and his students and The 2006 NASA ST 5 spacecraft colleagues. This lead to Holland's book "Adaption in antenna. This complicated shape Natural and Artificial Systems" published in 1975. was found by an evolutionary computer design program to create the best radiation pattern. It is known as an Evolved antenna. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 4

Our world Ø It is changing continuously. Ø Each animate who wants to live

Our world Ø It is changing continuously. Ø Each animate who wants to live in the world should adapt himself to the environment conditions. Ø The process of adaptation to the environment is known as evolution. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 5

Different kinds of evolution Ø Evolution: q Natural selection q Reproduction q Mutation q

Different kinds of evolution Ø Evolution: q Natural selection q Reproduction q Mutation q Symbiosis Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 6

Evolution examples Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan

Evolution examples Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 7

Genetics: the manuscript of nature Ø To do the optimization properly, the nature should

Genetics: the manuscript of nature Ø To do the optimization properly, the nature should keep the information obtained during the million years ago. Ø Chemical elements are the basis of animates. The nature uses these elements to save the information of biological species. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 8

Biological inspiration Ø Cell: The cell is the basic structural, functional, and biological unit

Biological inspiration Ø Cell: The cell is the basic structural, functional, and biological unit of all known living organisms. Cells are the smallest unit of life that can replicate independently, and are often called the "building blocks of life". The nucleus, located in the center of cell, contains the genetic information. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 9

Biological inspiration Ø Chromosome: Chromosomes are thread-like structures located inside the nucleus of animal

Biological inspiration Ø Chromosome: Chromosomes are thread-like structures located inside the nucleus of animal and plant cells. Each chromosome is made of protein and a single molecule of deoxyribonucleic acid (DNA). Passed from parents to offspring, DNA contains the specific instructions that make each type of living creature unique. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 10

Biological inspiration Ø DNA structure: A DNA molecule is like a helical ladder in

Biological inspiration Ø DNA structure: A DNA molecule is like a helical ladder in which the main branches (backbone) is made up sugar-phosphate strips. The ladder base is made up of four different chemical compounds called nucleotide or organic bases. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 11

Biological inspiration Ø DNA structure: Four different kind of combinations, which require a hydrogen

Biological inspiration Ø DNA structure: Four different kind of combinations, which require a hydrogen compound, is possible to made. TA AT GC CG Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 12

Biological inspiration Ø Gene: The chromosome is divided in parts called genes. A gene

Biological inspiration Ø Gene: The chromosome is divided in parts called genes. A gene is the basic physical and functional unit of heredity. Genes act as instructions to make molecules called proteins. Every gene has a unique position on the chromosome that is called locus. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 13

Biological inspiration Ø Phenotype vs genotype: Phenotype Genotype Artificial Intelligence Methods – Department of

Biological inspiration Ø Phenotype vs genotype: Phenotype Genotype Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 14

An important conclusion Ø There is a unique relationship between an animate and its

An important conclusion Ø There is a unique relationship between an animate and its gene sequences. This mean each animate has a fixed unique DNA structure which is not repeated in other animates. Ø This phenomenon is known as coding. The phenotype holds the main information of an animate and DNA sequence is its coding. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 15

Search space Ø If we are solving some problem, we are usually looking for

Search space Ø If we are solving some problem, we are usually looking for some solution, which will be the best among others. The space of all feasible solutions (it means objects among those the desired solution is) is called search space (also state space). Each point in the search space represent one feasible solution. Each feasible solution can be "marked" by its value or fitness for the problem. We are looking for our solution, which is one point (or more) among feasible solutions - that is one point in the search space. Ø The looking for a solution is then equal to a looking for some extreme (minimum or maximum) in the search space. The search space can be whole known by the time of solving a problem, but usually we know only a few points from it and we are generating other points as the process of finding solution continues. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 16

Basic genetic algorithm 1. Start with a large “population” of randomly generated “attempted solutions”

Basic genetic algorithm 1. Start with a large “population” of randomly generated “attempted solutions” to a problem. Repeatedly do the following: 2. Evaluate each of the attempted solutions. 3. Keep a subset of these solutions (the “best” ones). 4. Use these solutions to generate a new population. Quit when you have a satisfactory solution (or you run out of time). Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 17

Basic genetic algorithm Artificial Intelligence Methods – Department of Biosystems Engineering – University of

Basic genetic algorithm Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 18

GA operators q Methods of representation q Methods of selection q Methods of reproduction

GA operators q Methods of representation q Methods of selection q Methods of reproduction Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 19

GA operators: methods of representation Ø Encode solutions as binary strings: sequences of 1's

GA operators: methods of representation Ø Encode solutions as binary strings: sequences of 1's and 0's, where the digit at each position represents the value of some aspect of the solution. Ø Second approach is encode solutions as arrays of integers or decimal numbers. Ø A third approach is to represent individuals in a GA as strings of letters, where each letter again stands for a specific aspect of the solution. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 20

GA operators: methods of selection Ø There are many different techniques which a genetic

GA operators: methods of selection Ø There are many different techniques which a genetic algorithm can use to select the individuals to be copied over into the next generation. q Roulette-wheel selection q Elitist selection q Fitness-proportionate selection q Scaling selection q Rank selection q Generational selection q Hierarchical selection Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 21

GA operators: methods of selection Ø Roulette-wheel selection: • The fitter is the solution

GA operators: methods of selection Ø Roulette-wheel selection: • The fitter is the solution with the most chances to be chosen. • Conceptually, this can be represented as a game of roulette - each individual gets a slice of the wheel, but more fit ones get larger slices than less fit ones. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 22

GA operators: methods of selection Ø Roulette-wheel selection: No. String Fitness % Of Total

GA operators: methods of selection Ø Roulette-wheel selection: No. String Fitness % Of Total 1 01101 169 14. 4 2 11000 576 49. 2 3 01000 64 5. 5 4 10011 361 30. 9 1170 100. 0 Total Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 23

GA operators: methods of selection Ø Roulette-wheel selection: Artificial Intelligence Methods – Department of

GA operators: methods of selection Ø Roulette-wheel selection: Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 24

GA operators: methods of reproduction Ø Once selection has chosen fit individuals, they must

GA operators: methods of reproduction Ø Once selection has chosen fit individuals, they must be randomly altered in hopes of improving their fitness for the next generation. Ø There are two basic strategies to accomplish this: q Crossover q Mutation Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 25

GA operators: methods of reproduction Ø Crossover: • Two parents produce two offspring. •

GA operators: methods of reproduction Ø Crossover: • Two parents produce two offspring. • There is a chance that the chromosomes of the two parents are copied unmodified as offspring. • There is a chance that the chromosomes of the two parents are randomly recombined (crossover) to form offspring. Ø Generating offspring from two selected parents: q Single (one) point crossover q Two point crossover (Multi point crossover) q Uniform crossover Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 26

GA operators: methods of reproduction Ø Single (one) point crossover: • Randomly one position

GA operators: methods of reproduction Ø Single (one) point crossover: • Randomly one position in the chromosomes is chosen. • Child 1 is head of chromosome of parent 1 with tail of chromosome of parent 2. • Child 2 is head of 2 with tail of 1. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 27

GA operators: methods of reproduction Ø Two (multi) point crossover: • Randomly two positions

GA operators: methods of reproduction Ø Two (multi) point crossover: • Randomly two positions in the chromosomes are chosen. • Avoids that genes at the head and genes at the tail of a chromosome are always split when recombined. Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 28

GA operators: methods of reproduction Ø Single (one) point crossover: Cross point Ø Two

GA operators: methods of reproduction Ø Single (one) point crossover: Cross point Ø Two (multi) point crossover: Cross point Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 29

GA operators: methods of reproduction Ø Uniform crossover: • A random mask is generated.

GA operators: methods of reproduction Ø Uniform crossover: • A random mask is generated. • The mask determines which bits are copied from one parent and which from the other parent. • Bit density in mask determines how much material is taken from the other parent (takeover parameter). Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 30

GA operators: methods of reproduction Ø Mutation: • Generating new offspring from single parent

GA operators: methods of reproduction Ø Mutation: • Generating new offspring from single parent Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 31

GA implementation process selection Search space A 0 1 0 0 0 B 1

GA implementation process selection Search space A 0 1 0 0 0 B 1 0 1 1 0 C 1 1 0 0 1 1 D cross over 1 0 1 0 0 1 1 1 0 mutation Fitness evaluation population 1 0 0 1 1 1 0 reproduction Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 32

GA implementation process Artificial Intelligence Methods – Department of Biosystems Engineering – University of

GA implementation process Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 33

Summary • We have learned: – Definition of genetics algorithm – Biological background of

Summary • We have learned: – Definition of genetics algorithm – Biological background of GA. – Principles of GA operators – Some practical examples (exercise in the class) Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade 34

Kurdistan nature Winter Artificial Intelligence Methods – Department of Biosystems Engineering – University of

Kurdistan nature Winter Artificial Intelligence Methods – Department of Biosystems Engineering – University of Kurdistan http: //agri. uok. ac. ir/kmollazade