CN110647994A - TSP (Total suspended particulate) optimization method based on improved mutation operator genetic algorithm - Google Patents
TSP (Total suspended particulate) optimization method based on improved mutation operator genetic algorithm Download PDFInfo
- Publication number
- CN110647994A CN110647994A CN201910735655.6A CN201910735655A CN110647994A CN 110647994 A CN110647994 A CN 110647994A CN 201910735655 A CN201910735655 A CN 201910735655A CN 110647994 A CN110647994 A CN 110647994A
- Authority
- CN
- China
- Prior art keywords
- mutation
- probability
- genetic algorithm
- total length
- chromosome
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/12—Computing arrangements based on biological models using genetic models
- G06N3/126—Evolutionary algorithms, e.g. genetic algorithms or genetic programming
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/04—Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
- G06Q10/047—Optimisation of routes or paths, e.g. travelling salesman problem
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Human Resources & Organizations (AREA)
- Health & Medical Sciences (AREA)
- Theoretical Computer Science (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Strategic Management (AREA)
- Economics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Development Economics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Evolutionary Computation (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Biomedical Technology (AREA)
- Artificial Intelligence (AREA)
- General Health & Medical Sciences (AREA)
- Genetics & Genomics (AREA)
- Game Theory and Decision Science (AREA)
- Physiology (AREA)
- Entrepreneurship & Innovation (AREA)
- Marketing (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Tourism & Hospitality (AREA)
- General Business, Economics & Management (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention relates to the field of a genetic algorithm application computer, in particular to a TSP (Total suspended particulate) optimization method based on an improved mutation operator genetic algorithm, which specifically comprises the following steps: chromosome coding, initial parameter definition, selection operation, crossover operation and mutation operation, wherein the mutation operation comprises the following steps: s1, randomly giving a probability P to each chromosome, and judging whether the probability P is greater than the mutation probability Pm; s2, if the chromosome probability P is smaller than the mutation probability Pm, ending the step, otherwise, calculating the total length of the circuits before and after mutation, and comparing the total length of the circuits before and after mutation; and S3, if the total length after mutation is larger than the total length before mutation, performing exchange mutation, and ending the step, otherwise, continuing to execute the next position, and repeating the step 2 until a complete traversal sequence is generated. The invention improves mutation operators, improves the accuracy and the convergence rate of the traditional genetic algorithm, and has better performance in a certain range.
Description
Technical Field
The invention relates to the field of genetic algorithm application computers, in particular to a TSP (transient state) optimization method based on an improved mutation operator genetic algorithm.
Background
The traveler problem, namely the TSP problem, is one of the most studied problems in the field of computer mathematics, and it refers to the shortest distance from a city to a salesman, and the shortest distance from the city to the origin, and the genetic algorithm is a randomized search method for solving the optimization problem evolved from the viewpoint of survival, superiority and inferiority of suitable persons in the darwinian evolution theory, so that the optimal solution in the TSP is obtained by analogy of the TSP problem with the genetic algorithm in the prior invention CN107122843A, which is the most effective solution compared with the exhaustive method, and in the traditional genetic algorithm, the operation steps of the algorithm are as follows: chromosome coding; initializing parameters, and defining city number, population scale, cross probability, variation probability and maximum algebra; calculating individual fitness and carrying out selection operation; performing cross operation; performing mutation operation; and finishing the operation and outputting the optimal solution.
In the mutation operation of the traditional genetic algorithm, the mutation operator usually adopts insertion mutation, namely a mode of randomly selecting one point and inserting the point into the next point is adopted, the mutation result generated by the mode has larger randomness, and the result after mutation may become better or worse, so that the accuracy of obtaining the optimal solution is lower.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a TSP optimization method based on an improved mutation operator genetic algorithm, which optimizes mutation operation and improves the accuracy of an optimal solution for solving the TSP problem by the genetic algorithm.
The technical scheme adopted by the invention is that a TSP optimization method based on an improved mutation operator genetic algorithm comprises the following steps: chromosome coding, initial parameter definition, selection operation, crossover operation and mutation operation, wherein the mutation operation comprises the following steps:
s1, randomly giving each chromosome probability P, judging whether the chromosome probability P is greater than the variation probability Pm, and executing a step S2;
s2, if the chromosome probability P is less than the mutation probability Pm, ending the step, otherwise, calculating the total length of the circuits before and after mutation, comparing the total length of the circuits before and after mutation, and executing the step S3;
and S3, if the total length after mutation is larger than the total length before mutation, performing exchange mutation, and ending the step, otherwise, continuing to execute the next position, and repeating the step 2 until a complete traversal sequence is generated.
The genetic algorithm solves the problem of the traveler by the following specific steps:
step 1: chromosome coding;
step 2: initializing parameters, and defining city number, population scale, cross probability, variation probability and maximum algebra;
and step 3: calculating individual fitness and carrying out selection operation;
and 4, step 4: performing cross operation, namely randomly performing cross interchange on a plurality of pairs of genes;
and 5: performing mutation operation;
step 6: if the iteration number is larger than or equal to the maximum iteration number, outputting the optimal solution, otherwise, circulating the steps.
The invention provides an optimization method aiming at mutation operation in a genetic algorithm, and the operation process comprises the following steps: and comparing the probability of each chromosome with the mutation probability, if the probability of the chromosome is smaller than the mutation probability, ending the mutation operation, otherwise, calculating the lengths of the loops before and after the mutation, judging whether the mutation is caused according to the distance before and after the mutation, if the distance after the mutation is larger than the distance before the mutation, performing exchange mutation, and otherwise, circulating the steps until the complete sequence is traversed.
The accuracy and the convergence speed of the traditional genetic algorithm for solving the TSP problem are greatly improved by the optimization method of judging the quality of the variation result and outputting the optimal solution.
Further, the calculating of the total lengths of the circuits before and after the mutation, and the comparing of the total lengths of the circuits before and after the mutation are specifically converted into the calculating of the distance before and after the comparison, the calculating method is as follows:
setting the current position of the mutation operation as i, the next position as j, the distance between chromosomes as d, d (i-1, i, i +1) represents the length from i-1 to i +1, d (j-1, j, j +1) represents the length from j-1 to j +1, d (i-1, j, i +1) represents the length from i-1 to j to i +1, d (j-1, i, j +1) represents the length from j-1 to i +1, calculating the length sum of d (i-1, i, i +1) + d (j-1, j, j +1) and d (i-1, j, i +1) + d (j-1, i, j +1), and comparing the length sum of the two.
The basis for judging whether the variation exists is to calculate and compare the total length of the loop before and after the variation, but the calculation of the length of the whole loop is complicated, so that the length of the whole loop before and after the variation is converted into the distance for calculating the variation operation, and the calculation time is greatly saved.
Further, the chromosome coding method adopts Grefenstette coding.
The GrefenStette code is the position of the selected team member in the unselected (non-eliminated) team members, and the cross variation of the GrefensStette code does not generate invalid chromosomes, so that the problem of chromosome definition in the TSP is well solved, and the TSP problem can be solved by using a genetic algorithm.
Further, the selection operation is specifically a roulette mode, and the individual fitness is definedThen the probability that the individual is selected isWherein, NumberOfCity in the formula refers to the total number of cities, TotalDistance refers to the total distance of the current individual walking for one circle according to the current loop, wherein k represents the current individual, and n represents the population size.
And calculating the probability of each individual appearing in the offspring according to the fitness of the individual, wherein the higher the fitness is, the higher the selected probability is, and the accuracy of the optimal solution is improved to a certain extent.
Further, the interleaving operation employs partial matching interleaving.
The partial matching and crossing mode is that two crossing points are randomly selected, the matching part is determined through the two crossing points, the two matching parts are exchanged to generate two sub-individuals, and the fact that the individuals generated by crossing operation meet the constraint that only one access can be performed in any city is achieved.
Compared with the prior art, the invention has the beneficial effects that:
1. the TSP optimization method based on the improved mutation operator genetic algorithm is characterized in that the optimal mutation result is selected by calculating the distance before and after mutation and judging whether to perform mutation according to the distance, so that the optimal solution is generated, the accuracy and the convergence speed of the traditional genetic algorithm are improved, and the TSP optimization method has better performance in a certain range.
2. The total length of the loop before and after mutation is converted into the distance of mutation operation for calculation and comparison, so that the calculation time is saved;
3. the Grefenstette codes are adopted for operation, so that each varied chromosome is meaningful, and the TSP problem can be solved by using a genetic algorithm;
4. the individual with higher fitness is selected by selecting a selection mode of roulette, so that the accuracy of the optimal solution is improved to a certain extent;
5. the partial match interleaving satisfies the constraint background that any city in the TSP problem must be accessed only once.
Drawings
Fig. 1 is a flowchart illustrating the detailed steps of a method for solving TSP by genetic algorithm.
FIG. 2 is a flowchart illustrating the steps of an optimization method for mutation operations.
Detailed Description
A TSP optimization method based on genetic algorithm of improved mutation operator comprises the following steps:
step 2, defining initial parameters: defining city number, population scale, cross probability, variation probability and maximum algebra;
step 3, selecting operation: defining individual fitness by rouletteThen the probability that the individual is selected isWherein, NumberOfCity refers to the number of cities, TotalDistance refers to the total distance of the current individual walking for one circle according to the current loop, k represents the current individual, and n represents the population scale;
step 4, cross operation: randomly selecting two cross points, determining a matching part through the two cross points, and exchanging the two matching parts to generate two sub-individuals;
step 5, mutation operation, wherein the mutation operation comprises the following steps:
s1, randomly giving each chromosome probability P, judging whether the chromosome probability P is greater than the variation probability Pm, and executing a step S2;
s2, if the chromosome probability P is less than the mutation probability Pm, ending the step, otherwise, calculating the total length of the circuits before and after mutation, comparing the total length of the circuits before and after mutation, and executing the step S3;
s3, if the total length after mutation is larger than the total length before mutation, carrying out exchange mutation, and ending the step, otherwise, advancing to the next position, and repeatedly executing the step S2 until a complete traversal sequence is generated;
and 6, if the iteration number is greater than or equal to the maximum iteration number, outputting the optimal solution, and otherwise, circulating the steps.
To test the performance of the method proposed by the present invention, two sets of experiments were designed:
experiment one aims to compare and improve the running performance before and after the genetic algorithm optimization of the mutation operator. Setting the number of cities as 30, the length of chromosomes is equal to the number of cities, the number of the cities is 30, the maximum algebra is 1000, the cross probability is 0.9 and the mutation probability is 0.1 in the first experiment, and performing 10 tests by using a traditional algorithm and the method of the invention respectively, wherein the traditional algorithm refers to the traditional genetic algorithm mentioned in the background art, and the mutation operation is performed in an insertion mutation mode; the results of the experiment are shown in table 1:
table 1 test results of experiment one
Traditional genetic algorithm | The optimized genetic algorithm of the invention | |
Optimal solution | 1960 | 1457 |
Sub-optimal solution | 2092 | 1516 |
Minimum algebra to obtain optimal solution | 790 | 365 |
The data in the table are analyzed, so that the optimal solution and the suboptimal solution are accurate compared with the traditional genetic algorithm, the minimum algebra for obtaining the optimal solution is small, the result shows that the accuracy of the optimal solution is improved after the genetic algorithm provided by the invention aiming at the problem of the TSP is optimized, and the optimized algorithm is far higher than the traditional algorithm in accuracy and is much faster than the traditional algorithm in convergence speed.
And the second experiment aims to test the change condition of the optimized genetic algorithm when the population scale is larger. The number of cities in the experiment II is 30, the population scale is 400, 900, 2000, 3000 and 4000, the length of the chromosome is equal to the number of the cities, the number of the chromosomes is 30, the maximum algebra is 1000, the cross probability is 0.9, and the mutation probability is 0.1, and the traditional algorithm and the method are respectively used for 5 times of tests. The results of the experiment are shown in table 2:
TABLE 2 test results of experiment two
As can be seen from the data analysis results in Table 2, when the population scale is large, the accuracy of the optimal solution of the method of the invention is improved to a certain extent, but the minimum algebra for obtaining the optimal solution does not have a certain variation trend along with the increase of the population scale, and the phenomenon shows that the method of the invention is relatively stable in a certain range.
The genetic algorithm after mutation operator optimization is smaller than the optimal solution of the traditional genetic algorithm and the minimum algebra for obtaining the optimal solution, and the method has the advantages that the TSP optimization is carried out by adopting the optimized genetic algorithm, the accuracy and the convergence speed are higher than those of the traditional genetic algorithm, and the trend can be ensured in a larger range.
Claims (6)
1. A TSP optimization method based on an improved mutation operator genetic algorithm comprises the following steps: chromosome coding, initial parameter definition, selection operation, crossover operation and mutation operation, wherein the mutation operation comprises the following steps:
s1, randomly giving each chromosome probability P, judging whether the chromosome probability P is greater than the variation probability Pm, and executing a step S2;
s2, if the chromosome probability P is less than the mutation probability Pm, ending the step, otherwise, calculating the total length of the circuits before and after mutation, comparing the total length of the circuits before and after mutation, and executing the step S3;
and S3, if the total length after mutation is larger than the total length before mutation, performing exchange mutation, and ending the mutation step, otherwise, stepping to the next position, and repeatedly executing S2 until a complete traversal sequence is generated.
2. The TSP optimization method based on the improved mutation operator genetic algorithm as claimed in claim 1, wherein the calculation of the total length of the pre-mutation loop and the post-mutation loop, the comparison of the total length of the pre-mutation loop and the post-mutation loop, and the specific conversion into the calculation of the distance between the pre-mutation loop and the post-mutation loop are as follows:
setting the current position of the mutation operation as i, the next position as j, the distance between chromosomes as d, d (i-1, i, i +1) represents the length from i-1 to i +1, d (j-1, j, j +1) represents the length from j-1 to j +1, d (i-1, j, i +1) represents the length from i-1 to j to i +1, d (j-1, i, j +1) represents the length from j-1 to i +1, calculating the length sum of d (i-1, i, i +1) + d (j-1, j, j +1) and d (i-1, j, i +1) + d (j-1, i, j +1), and comparing the length sum of the two.
3. The TSP optimization method based on the genetic algorithm of the improved mutation operator as claimed in claim 1, wherein the chromosome coding adopts a Grefenstette coding method.
4. The TSP optimization method based on the improved mutation operator genetic algorithm as claimed in claim 1, wherein the selecting operation is specifically: defining individual fitness by rouletteThen the probability that the individual is selected isWherein, NumberOfCity in the formula refers to the total number of cities, TotalDistance refers to the total distance of the current individual walking for one circle according to the current loop, k represents the current individual, and n represents the population size.
5. The method as recited in claim 1, wherein the interleaving operation uses partial match interleaving.
6. The TSP optimization method based on the genetic algorithm with improved mutation operators as claimed in claim 1, wherein the initial parameters include population size, crossover probability, mutation probability and maximum algebra.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910735655.6A CN110647994A (en) | 2019-08-09 | 2019-08-09 | TSP (Total suspended particulate) optimization method based on improved mutation operator genetic algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910735655.6A CN110647994A (en) | 2019-08-09 | 2019-08-09 | TSP (Total suspended particulate) optimization method based on improved mutation operator genetic algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110647994A true CN110647994A (en) | 2020-01-03 |
Family
ID=68990089
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910735655.6A Pending CN110647994A (en) | 2019-08-09 | 2019-08-09 | TSP (Total suspended particulate) optimization method based on improved mutation operator genetic algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110647994A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111931934A (en) * | 2020-08-24 | 2020-11-13 | 深圳市数字城市工程研究中心 | Affine transformation solving method under mass control points based on improved genetic algorithm |
CN113361753A (en) * | 2021-05-26 | 2021-09-07 | 中国电子技术标准化研究院 | Method, system, and medium for determining optimal path based on quantum genetic algorithm |
-
2019
- 2019-08-09 CN CN201910735655.6A patent/CN110647994A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111931934A (en) * | 2020-08-24 | 2020-11-13 | 深圳市数字城市工程研究中心 | Affine transformation solving method under mass control points based on improved genetic algorithm |
CN113361753A (en) * | 2021-05-26 | 2021-09-07 | 中国电子技术标准化研究院 | Method, system, and medium for determining optimal path based on quantum genetic algorithm |
CN113361753B (en) * | 2021-05-26 | 2023-07-04 | 中国电子技术标准化研究院 | Method, system and medium for determining optimal path based on quantum genetic algorithm |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108509335B (en) | Software test data generation method based on genetic algorithm optimization | |
Pattengale et al. | How many bootstrap replicates are necessary? | |
CN114186749B (en) | Flexible workshop scheduling method and model based on reinforcement learning and genetic algorithm | |
JP2008538429A (en) | Model optimization method and system using zeta statistics | |
CN110647994A (en) | TSP (Total suspended particulate) optimization method based on improved mutation operator genetic algorithm | |
CN113407185B (en) | Compiler optimization option recommendation method based on Bayesian optimization | |
CN113990405A (en) | Construction method of reagent compound prediction model, and method and device for automatic prediction and completion of chemical reaction reagent | |
CN115310664A (en) | RBF neural network training method and prediction system based on gene regulation genetic algorithm | |
CN106599610A (en) | Method and system for predicting association between long non-coding RNA and protein | |
CN104732067A (en) | Industrial process modeling forecasting method oriented at flow object | |
CN106919504B (en) | Test data evolution generation method based on GA algorithm | |
Du et al. | Species tree and reconciliation estimation under a duplication-loss-coalescence model | |
CN110633868A (en) | Method for predicting properties of oil and gas in exploration well oil testing layer by optimizing neural network through genetic algorithm | |
Gonzalez-Alvarez et al. | Predicting DNA motifs by using evolutionary multiobjective optimization | |
KR102559605B1 (en) | Method and apparatus for function optimization | |
Zhu et al. | An Efficient Hybrid Feature Selection Method Using the Artificial Immune Algorithm for High‐Dimensional Data | |
CN111813669B (en) | Adaptive random test case generation method based on multi-target group intelligence | |
Hardas et al. | Development of a genetic algorithm for component placement sequence optimization in printed circuit board assembly | |
Xiao et al. | A locating method for reliability-critical gates with a parallel-structured genetic algorithm | |
CN117314088A (en) | Task allocation method and device | |
CN112070200B (en) | Harmonic group optimization method and application thereof | |
CN107766887A (en) | A kind of local weighted deficiency of data mixes clustering method | |
Ecker et al. | A LASSO-based approach to sample sites for phylogenetic tree search | |
Santander-Jiménez et al. | Asynchronous non-generational model to parallelize metaheuristics: a bioinformatics case study | |
CN111898666A (en) | Random forest algorithm and module population combined data variable selection method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200103 |