• 沒有找到結果。

Genetic Algorithm

在文檔中 訂單型之旅行家問題 (頁 24-28)

Chapter 4 Approximate Solutions

4.3 Genetic Algorithm

In the early 1970s, John Holland introduced the concept of genetic algorithms borrowing the principle of evolution from the nature. The result of such a simulation is a series of optimization algorithms, usually based on a simple set of rules. Optimization iteratively improves the quality of solutions until an optimal, or at least feasible, solution is found. Some merits of GA are that it can be implementing easily, search the solution globally, and adapt to the changing conditions in the problem.

Despite of these advantages, since GA does not use unequivocal rules of how to search for the solutions, it is often slower than conventional methods such as heuristic

methods or local search methods. For this reason, we can adapt hybrid methods that combine GA with other conventional techniques. In this thesis, we adapt a method that combines GA and Local Search method [9]. The Local Search method used to be the mutation operator of GA; but the local search methods easily let the solutions falls into local optimum. To avoid the situation occupied, the crossover operator provides the capability of jumping out form the local optimum. The algorithm consists of the following steps.

Initialization

Generate a population of chromosomes and calculate the fitness of each chromosome. The size of population is denoted by M.

Natural Selection

Set the crossover probability Pc. Within each generation, M*(1 - Pc%) chromosomes are selected to stay in the new population without crossover.

Chromosome selection is based on their fitness values. The others that are not selected are going to produce the offspring which can be added to the new population.

Reproduction

Choose M*Pc% chromosomes randomly and produce an offspring from each pair of individuals.

Mutation by local search

Set the mutation probability Pm. Then choose M*Pm% chromosomes randomly and improve them by 2-Opt. The individuals that stay in the new population by natural selection are always chosen. This can help the search process find the optimum more quickly.

20

The followings describe the detail of each of the above steps.

Initialization

Chromosome coding and representation are the most crucial to the design of genetic algorithms. Clear represent the problem solution in chromosomes and easy-to-compute definition of fitness functions are not trivial to achieve. Because the studied problem is a variant of the TSP, we adapt the sequence representation to encode the chromosome. Examples are given in the following.

After the chromosome coding, we need to generate the initial population:

Initial population:

For greedy method

Pick up the initial nodes of each solution randomly Construct an initial solution by greedy fashion Generate M chromosomes

To avoid the solution fall into local optimum too early, we generate the half of initial population randomly.

Natural Selection

Each generation we should pick up M*(1-Pc%) chromosomes to stay in the new population without crossover. The chance of survival is defined by the fitness value. It can avoid dropping the chromosome which is better than other ones. We first sort the individuals in fitness value order and then compare the fitness values and pick up the first M*(1-Pc%) chromosomes. Each selected chromosome is improved by the mutation operator.

Crossover in Reproduction

When we apply the local search to a solution, it often falls into a local optimum. It this needs some method to jump out from the local optimum. Let’s consider the two chromosomes which have fallen into local optimum. Each of

7

them may have some best genes for different parts of the chromosome. It is possible to get a better chromosome if we combine the two chromosomes which have fallen into local optimum. Beside it may get better chromosome, the search process also can have the capacity jumping out the local optimum. Although we can not sure which parts of chromosome is good, we can expect the solution to be located in the valley of the global optimum.

We propose a new crossover operator named “head-tail crossover (HTC)”.

By using the HTC, we can not only keep some sub-gene of the origin chromosomes but also jump out from the local optimum. In the HTC, for example, the chromosome of parents are ga = (1, 3, 2, 4, 6, 5, 7), gb = (2, 7, 5, 4, 3, 1, 6). The process of crossover is shown in Fig.2 and algorithm as following.

Firstly, we pick up the gene from ga in position 0, and then add the selected gene to new chromosome from head to tail. On the other hand, we pick up the gene form ga in position 6, and then add the selected gene to new chromosome from tail to head. If the selected gene which have add into the new chromosome, discard the selection and pick up next gene from its process. This kind of construction skill can not only avoid to get a infeasible solution but also remain the partial structure of the parents.

While round less than n

22

begin

if (round mod 2) = 0 then

while aa_index does not have placed on gc

a_index++

c

c_head =

a

a_index

a_index++

c_head++

else

while bb_index doesn’t have placed on gc

b_index--

The 2opt we have introduced in the local search and tabu search. In the GA, we still need to use the local search to sure the solution is the best of its local area. In genera, GA use the crossover operator to keep the good parts of the parents that search process can find the better solution; then use the Mutation operator to try jumping out the local optimum. But in the hybrid method we use, the mutation by local search is the main idea to find local optimum. We use the crossover to avoid the search process fall into local optimum. Therefore, when we define the parameter of GA, the crossover rate and the mutation rate is not like the traditional design. We should define the parameter by the computational experiments.

在文檔中 訂單型之旅行家問題 (頁 24-28)

相關文件