Genetic algorithm learning notes (2)

Source: Internet
Author: User
Tags random seed

Genome coding principles

1. The genetic algorithm is used to encode the parameters for solving the problem, rather than the parameters themselves. This requires the genetic algorithm to be based on a finite alphabet, and encode the naturally generated set of optimization problems into strings of limited length. (Transformed into a gene, the bits are called genes). A bits are called chromosomes, and a set of individual with characteristics forms a population. Encoding parameters according to certain rules is called genetic encoding. The parameter encoding principle of genetic algorithm adopts the minimum alphabet principle, and selects a minimum alphabet that is naturally expressed by the problem for encoding, such as binary or non-binary encoding.

ASIDE: it is important to write comments, but more importantly, why.

Pattern Theory of genetic algorithms: the larger the number of patterns, the better the genetic efficiency. Because of this, binary encoding is often used.

2 fitness functions

Select a fitness function: non-negative, single value, small amount of calculation, strong versatility; the fitness function is usually transformed from the target function, reducing the continuous and micro-dependent on the target function.

In order to maintain the diversity and competitiveness of the population, and prevent excessive individual replication due to fitness, the adaptive individuals are eliminated prematurely so that valuable individuals do not multiply. Therefore, it is necessary to adjust the fitness.

Linear transformation, power function transformation, exponential transformation

3. Genetic Optimization process

Genetic algorithm is not a blind search method, but a target-oriented Heuristic Search Method Based on fitness functions.

 

Round Robin method:

 

Process:

1) Check each chromosome -- observe the performance to solve the problem -- allocate adaptive scores

2) select two members as the parent

3) perform hybridization Based on the crossover rate (crossover rate ).

4) variation based on variation rate

Repeat the preceding steps until the new group of 100 members is created. Such a process is called the entire cycle of generation (or generation)

 

Random Number in genetic algorithms:

In Genetic Algorithm Programming, iterations and random numbers are common practices, but many problems are encountered in actual programming. The random numbers generated after each iteration are the same. This requires that a different random seed be added each time, for example, an increasing integer. However, I was wondering, if such an additional condition is added and this integer is being written, if it is extended to multiple threads, will it lead to Contention or the same random number, which leads to the same problem.

I wrote it here and wrote a multi-threaded code in VS to test it, it is true that different threads use the same Random Seed to generate the same random number (but sometimes it does not)

(The first serial number is the thread number, the middle is a random number, followed by a random seed)

Genetic Algorithms get rid of the dependence of traditional algorithms on problematic parameters, such as continuous, bootable, and micro-restricted parameters. They only need to perform parameter encoding to reduce the complexity of the problem, it is also a global search algorithm to avoid falling into the local optimal solution.

Reference books: C ++ Implementation of genetic algorithms and gambling

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.