2. Genetic algorithm (1)--Evolutionary algorithm

Source: Internet
Author: User

This blog post describes the genetic algorithm (genetic algorithm), a genetic algorithm is the most famous evolutionary algorithm.

The content still comes from the blogger's lecture record and the professor's ppt.

Outline
    1. Simple Genetic algorithm
    2. Individual representation
    3. Variation
    4. Recombinant

1. Simple genetic algorithm (genetic algorithm)

Holland's early genetic algorithms were thought of as " simple genetic algorithms " or "authoritative genetic algorithms". (Simple genetic algorithm or canonical genetic algorithm)

1. Direct illustration

  problem Description : Using genetic algorithm to solve the maximum value of two function y=x2 on interval [0,31]

At first glance, it's a stupid question, so let's use GA to set it up and look at the process.

[0, 31] The point x is the individual (individual), the function value f (x) can be used as the fitness of x (fitness), the interval [0, 31] is a population (population).

The population size is set to 4, and the chromosome is encoded with a 5-bit binary number.

Assume 4 individuals:

s1:13 = 01101 (binary)

s2:24 = 11000

S3:8 = 01000

s4:19 = 10011

  

  first column is the number, second column is the binary value of the initial value (initial population), third column is the given Initial values, Fourth Column f (x) = x^2 is the degree of fitness (fitness), and of course the higher the fitness, the better the expectations. the Fifth column is the selection probability (prob) of individuals in the population (calculated according to the fourth column). the Seventh column is the number of individuals in the pairing pool (mating pools).

The calculation formula for the selection probability is:

Start the reorganization pairing (crossover) below:

  

Tables are the process of pairing recombination. The first column is still numbered, the second column is the pairing pool, the third column represents the point at which the reorganization begins, the fourth column is paired with the reconstituted descendant, the Fifth column is the value of the new descendant, and the Sixth column is the degree of fitness.

Here is the mutation (mutation):

  

The first two columns are the same as before, the third column is the mutated binary value, the individual with number 1 has mutated in the first place, and the individual with number 4 has mutated in the third place. The values have changed and the degree of fitness has changed.

  Note : Here bloggers to the professor's ppt to change a bit, because bloggers do not think he originally wrote the value is correct. The original values are as follows: In the fourth column of S1, the number on the original PPT is 26 and the fifth column is 676. In the fourth column of S4, the number on the original PPT is 18, and the number on the fifth column is 324. Of course, the following sum, average, and maximum are all changed.

  There is one question , why did the first and the fourth be mutated, while the second one did not mutate? How does a computer determine which individual is to be mutated?

Here is a concept called mutation rate (mutation rates), which is a fixed value, in this problem we set a mutation rate of 0.001, that is, to tell the computer in advance a value. On each of the genes, that is, each of the binary codes, the computer produces a random number that ranges between [0,1]. The computer then compares this random number to the mutation rate, and if the random number is less than the mutation rate, then the gene on this one will reverse. Judging from the result of this mutation, the mutation is going in the right direction.

This round of evolution has come to a point where new descendants can be seen:

S1:x = approx., f (x) = 784

S2:x = +, f (x) = 625

S3:x = +, f (x) = 729

S4:x = +, f (x) = 400

You can compare the first table and the last table, the average degree of fitness increased from 293 to 634.5, and the most suitable population grew from 576 to 784. Of course the ultimate best, we want the result is 31^2 = 961.

  

2. Summary of features
    • There is a binary representation (a binary representation)
    • Adaptive , proportional selection (Fitness proportionate selection)
    • Variation of low probability (probability of mutation)
    • Use of innovative restructuring (RECOMBINATION,CROSSOVER) to generate new alternates solution

Also add a Professor PPT on the table

  

  Summary of disadvantages :

    • Representation is too restrictive
    • Mutation & crossovers only applicable for bit-string & integer Representations
    • Selection mechanism sensitive for converging populations with close fitness values
    • Generational population model (step 6 in SGA repr cycle) can is improved with explicit survivor selection

2. Individual representation (representation of individuals) 2.1 binary representation (binary representations)

Binary expression is one of the simplest ways to express. For example, the problem above is the binary representation.

For a given question, we need to decide: the length of the 1.string. 2. How to use it to represent a phenotype (phenotype).

  specifically , we need to ensure that each of our binary encodings is capable of representing a valid solution, and vice versa, all possible solution can be expressed.

Professor's original text: In choosing the genotype-phenotype mapping for a specific problem, one have to make sure that the encoding allows tha T all possible bit strings denote a valid solution to the given problem and that, vice versa, all possible so Lutions can be represented.

2.2 Other expression methods

The main first to take binary expression surgery, the other expression first skipped.

In addition to the binary representation, there are some other expression methods, listed below:

    • Integral type Representation (integer representations)
    • Real-valued representation
    • Floating-point representation
    • Permutation representations

Some problems do not always apply to binary representations. For example, in the process of looking for a path on a square grid map, we may use the integer {0,1,2,3} to represent the direction {East, south, west, North}. It is clear that the integral type is more appropriate than binary.

  

3. Mutation (Mutation)

Mutation was originally a biological noun, and here is the indication that the mutation operator (variation operators) has created a new descendant by using only one parent, through some random changes to the genotype.

The original text is as follows: Mutation is the generic name given to those variation operators, the use of only one parent and create one CHILD by applying some kind of randomised change to the representation (genotype).

3.1 Variation of binary expression (Mutation for binary representations)

The mutation of the binary expression has been demonstrated in the first example.

The most common binary variation is to consider whether the genes on each gene are reversed (from 1 to 0, from 0 to 1), and this reversal has a very small probability of Pm.

3.2 Variations of other expressions

The main first to take binary expression surgery, the other expression first skipped.

    • Variation of Integer expression (Mutation Operators for integer representations)
    • Mutation Operators for floating-point representations
    • Mutation Operators for permutation representations

4. Reorganization (recombination)

Recombination is considered to be one of the most important features of genetic algorithms .

The concept of reorganization has been described in the previous chapter, where a textbook description is cited.

Recombination, the process whereby a new individual solution is created from the information contained within both (or more ) Parent solutions, is considered by many to being one of the most important features in genetic algorithms (GA).

The concept of reorganization here, sometimes said recombination, sometimes said crossover. Crossover is more commonly used to represent two-parent case.

"The use of the" > reorganization operator "(recombination operators) will have a crossover rate, the probability value range is approximately [0.5,1.0]. Usually in the process of reorganization, the probability of a reorganization in a position will be in [0,1], and then this probability and the above we achieve the set reorganization rate If the value is lower than recombination rate asexually ). < Span style= "Background-color: #ffff99;" >) is generated by the direct copy of the parent, and some descendants express the solutions that they have not seen before.

  Review the rate of recombination (crossover rates) and variability (mutation rate)

  mutation Rates (mutation rate) are used to control how some parts of a chromosome change independently . The so-called independence only needs a father to be able.

  recombination rate (crossover rate) determines the opportunity for a group of fathers to restructure.

4.1 binary expression recombination operator (recombination Operators for binary representations)

4.1.1 Single-position cross-recombination (One-point Crossover)

Start a cross-reorganization from one location.

  

4.1. Cross-recombination in more than 2 locations (N-point Crossover)

Start a cross-reorganization from more than one location.

  

The two divisions look a little superfluous, but the western textbooks are so differentiated.

4.1.3 Balanced cross-recombination (Uniform Crossover)

Unlike the above two methods, theuniform crossover is not dependent on the specific location of the gene. It first produces a uniformly distributed set of random variables on [0,1], consisting of a string with the same length as the parent gene. Then there is a predetermined parameter p (usually 0.5). On each of the first descendants , if the random variable is less than this parameter, then the offspring inherit the first parent's gene, and conversely, if the random variable is greater than this parameter, then the offspring inherit the second one. The second offspring 's genes are the exact opposite of the first offspring's recombination.

  

  Summary and supplement of the above three types of methods

N-point crossover tend to keep the genes that are close to each other in place. This effect is called positional bias (positional bias)

On the contrary, uniform crossover does not have any positional bias. He was able to pass 50% of genes from each parent and prevent the acquisition of a large number of genes from one of his parents alone. This effect is called the distribution bias (distributional bias).

4.2 Other expressions of the recombination operator

The main first to take binary expression surgery, the other expression first skipped.

    • Recombination Operators for Integer representations
    • Recombination Operators for floating-point representations
    • Recombination Operators for permutation representations

2. Genetic algorithm (1)--Evolutionary algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.