Population individual initialization method and device in genetic algorithm
1. A method for initializing population individuals in a genetic algorithm is characterized by comprising the following steps:
processing the boundary of the function based on uniform design to generate a uniformly covered initial individual;
optimizing the generated initial individuals based on local search to generate optimized initial individuals;
performing polymerization treatment on the optimized initial individuals;
and clustering the initial individuals after the polymerization treatment to construct an initial population.
2. The method of population individual initialization in genetic algorithm of claim 1, wherein said processing the boundaries of the function based on uniform design to generate uniformly covered initial individuals comprises:
dividing the plane space of the boundary of the solved function into m by m in an orthogonal equal way to obtain m by m orthogonal uniform coverage solutions, wherein m is a positive integer;
uniformly setting initialized population individual settingsMeter, uniformly design the table as Um (m)n) Wherein x is the initialized population individual, n ═ int (x) 2+ 1;
and dividing the whole search space into m × n subspaces according to a uniform design table, and taking orthogonal initialized individuals close to the centers of the subspaces as data of the initial population individuals.
3. The method of population individual initialization in genetic algorithm as claimed in claim 1, wherein said optimizing the generated initial individuals based on local search to generate optimized initial individuals comprises:
calculating the objective function value f (x) of each initial populationi) Then calculating values f (j) of other points in the adjacent cross direction, wherein j belongs to (1, 2, 3, 4);
if the function value of one point is more optimal, the search is successful, then xiThe point coordinate is changed to be more optimal, the latest point coordinate is taken as the center in the next search, the new step length is the old step length, the acceleration variable alpha is used for expanding the search range, alpha is more than or equal to 1, if no such point is found, the search is failed, and x is still usediAs a center, the new step size is the old step size, the reduction rate β reduces the search range, 0<β<1;
The above search operation is repeated until the step size is smaller than the search precision epsilon.
4. The method for population individual initialization in genetic algorithm according to claim 1, wherein the aggregating process for the optimized initial individuals comprises:
determining two distances T1And T2,T1>T2(ii) a Randomly picking one individual x out of the optimized initial individualsiAs a sphere center, calculating the distance d from other individuals in the individual set to the sphere center, and calculating d<T2Is removed from the individual set, T2<d<T1Is drawn into canty, the operation is repeated until the collection of individuals is empty.
5. The method for initializing population individuals in genetic algorithm according to claim 4, wherein the clustering the aggregated initial individuals to construct the initial population comprises:
determining the center of the K-means method according to the canty center;
calculating the distance from each sample individual to each centroid;
determining cluster markers of the sample according to the closest centroids;
configuring all samples into each cluster;
updating the centroid of each cluster, wherein the centroid is the mean of all samples contained in the cluster;
circularly iterating the above process until the centers of all the subsections are not changed; or otherwise set stop conditions.
6. An apparatus for initializing population individuals in a genetic algorithm, comprising:
the uniform design module is used for processing the boundary of the function based on uniform design to generate a uniformly covered initial individual;
the optimization module is used for optimizing the generated initial individuals based on local search to generate optimized initial individuals;
the aggregation module is used for carrying out aggregation treatment on the optimized initial individuals;
and the clustering module is used for clustering the initial individuals after the aggregation processing to construct an initial population.
7. The apparatus for population individual initialization in genetic algorithm according to claim 6, wherein said uniform design module comprises:
the space orthogonal module is used for dividing the plane space orthogonality of the boundary of the solved function into m to obtain m orthogonal uniform coverage solutions, wherein m is a positive integer;
a design table setting module for setting a uniform design table for initialized population individuals, wherein the uniform design table is Um (m)n) Wherein x is the initialized population individual, n ═ int (x) 2+ 1;
and the space dividing module is used for dividing the whole search space into m × n subspaces according to a uniform design table, and the orthogonal initialization individuals close to the centers of the subspaces are used as the data of the initial population individuals.
8. The apparatus for population individual initialization in a genetic algorithm of claim 6, wherein the optimization module is specifically configured to:
calculating the objective function value f (x) of each initial populationi) Then calculating values f (j) of other points in the adjacent cross direction, wherein j belongs to (1, 2, 3, 4);
if the function value of one point is more optimal, the search is successful, then xiThe point coordinate is changed to be more optimal, the latest point coordinate is taken as the center in the next search, the new step length is the old step length, the acceleration variable alpha is used for expanding the search range, alpha is more than or equal to 1, if no such point is found, the search is failed, and x is still usediAs a center, the new step size is the old step size, the reduction rate β reduces the search range, 0<β<1;
The above search operation is repeated until the step size is smaller than the search precision epsilon.
9. The apparatus for population individual initialization in a genetic algorithm of claim 6, wherein the aggregation module is specifically configured to:
determining two distances T1And T2,T1>T2(ii) a Randomly picking one individual x out of the optimized initial individualsiAs a sphere center, calculating the distance d from other individuals in the individual set to the sphere center, and calculating d<T2Is removed from the individual set, T2<d<T1Is drawn into canty, the operation is repeated until the collection of individuals is empty.
10. The apparatus for population individual initialization in a genetic algorithm of claim 9, wherein the clustering module is specifically configured to:
determining the center of the K-means method according to the canty center;
calculating the distance from each sample individual to each centroid;
determining cluster markers of the sample according to the closest centroids;
configuring all samples into each cluster;
updating the centroid of each cluster, wherein the centroid is the mean of all samples contained in the cluster;
circularly iterating the above process until the centers of all the subsections are not changed; or otherwise set stop conditions.
Background
Genetic algorithm is a search algorithm for solving optimization in computational mathematics, and is one of evolutionary algorithms. Evolutionary algorithms were originally developed by using some phenomena in evolutionary biology, including inheritance, mutation, natural selection, and hybridization. Genetic algorithms are typically implemented as a computer simulation, where for an optimization problem a population of abstract representations (called chromosomes) of a certain number of candidate solutions (called individuals) evolves towards better solutions.
The initialization of the population is crucial to the convergence of the genetic algorithm and also influences the speed of searching for excellent population individuals, the initial population individuals with high quality have a good help to solve the problem of poor searching capability of the genetic algorithm, and a large number of population initialization methods are randomly generated, such as a method based on Pseudo Random Numbers (PRNGs) obtained through 'seed values' and a method based on a chaotic generator. The random strategy can make the initial population individual quality difficult to be kept at a high level, and meanwhile, all population individuals cannot be guaranteed to cover all search areas, so that the algorithm usually needs more iteration times and more time to find the foreground space.
Aiming at the problem of low-quality population individuals caused by random initialization, a plurality of new population initialization methods are created by introducing a local search correlation algorithm, a professional sampling method of statistical discipline and the like in the population initialization process. Through clustering and Cauchy variation, Bajer, Brest and the like view-recognize a part with better prospect in a near search area, and generate a relatively better solution scheme near the part, so that the method has certain reference significance for a high-dimensional population initialization method and can provide a relatively good initial position; poikolainen, Neri and the like provide an intelligent population initialization differential evolution framework, namely, the population initialization based on clusters uses the technologies of random generation, local search, clustering and the like, and the algorithm performance is improved; elsayed Saber and Sarker Ruhul et al propose a sequence-based initialization method, which improves the coverage of initial individuals in a search space and can relatively improve the chance of obtaining an optimal solution.
However, the existing population initialization algorithm has the following disadvantages: 1) the algorithm has high complexity, for example, a population initialization method of reverse learning needs the support of fitness function values of all individuals to select the optimal initial population individuals, which of course needs extra large amount of calculation; 2) although the random method is simple to operate and low in algorithm complexity, the quality of the initial population individuals obtained randomly influences the performance of the genetic algorithm in the subsequent iteration process; 3) although initial population individuals generated by sequence-based population initialization ensure the coverage of the whole search space, the quality of the initial population individuals is very different, and high-quality individuals and poor-quality individuals are not screened, so that search resources occupied by independent poor-quality individuals in the population are likely to be wasted.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method and an apparatus for initializing population individuals in a genetic algorithm, which can further improve the performance of the genetic algorithm.
The technical scheme adopted for solving the technical problems is as follows:
in a first aspect, an embodiment of the present invention provides a method for initializing population individuals in a genetic algorithm, including the following steps:
processing the boundary of the function based on uniform design to generate a uniformly covered initial individual;
optimizing the generated initial individuals based on local search to generate optimized initial individuals;
performing polymerization treatment on the optimized initial individuals;
and clustering the initial individuals after the polymerization treatment to construct an initial population.
As a possible implementation manner of this embodiment, the processing the boundary of the function based on the uniform design to generate the uniform coverage initial individual includes:
dividing the plane space of the boundary of the solved function into m by m in an orthogonal equal way to obtain m by m orthogonal uniform coverage solutions, wherein m is a positive integer;
setting a uniform design table for initialized population individuals, wherein the uniform design table is Um (m)n) Wherein x is the initialized population individual, n ═ int (x) 2+ 1;
and dividing the whole search space into m × n subspaces according to a uniform design table, and taking orthogonal initialized individuals close to the centers of the subspaces as data of the initial population individuals.
As a possible implementation manner of this embodiment, the optimizing the generated initial individual based on the local search, and the generating the optimized initial individual includes:
calculating the objective function value f (x) of each initial populationi) Then calculating values f (j) of other points in the adjacent cross direction, wherein j belongs to (1, 2, 3, 4);
if the function value of one point is more optimal, the search is successful, then xiThe point coordinate is changed to be more optimal, the latest point coordinate is taken as the center in the next search, the new step length is the old step length, the acceleration variable alpha is used for expanding the search range, alpha is more than or equal to 1, if no such point is found, the search is failed, and x is still usediAs a center, the new step size is the old step size, the reduction rate β reduces the search range, 0<β<1;
The above search operation is repeated until the step size is smaller than the search precision epsilon.
As a possible implementation manner of this embodiment, the performing aggregation processing on the optimized initial individuals includes:
determining two distances T1And T2,T1>T2(ii) a Randomly picking one individual x out of the optimized initial individualsiAs a sphere center, calculating the distance d from other individuals in the individual set to the sphere center, and calculating d<T2Is removed from the individual set, T2<d<T1Is drawn into canty, the operation is repeated until the collection of individuals is empty.
As a possible implementation manner of this embodiment, the clustering the initial individuals after the aggregation to construct the initial population includes:
determining the center of the K-means method according to the canty center;
calculating the distance from each sample individual to each centroid;
determining cluster markers of the sample according to the closest centroids;
configuring all samples into each cluster;
updating the centroid of each cluster, wherein the centroid is the mean of all samples contained in the cluster;
circularly iterating the above process until the centers of all the subsections are not changed; or otherwise set stop conditions.
In a second aspect, an embodiment of the present invention provides an apparatus for initializing population individuals in a genetic algorithm, including:
the uniform design module is used for processing the boundary of the function based on uniform design to generate a uniformly covered initial individual;
the optimization module is used for optimizing the generated initial individuals based on local search to generate optimized initial individuals;
the aggregation module is used for carrying out aggregation treatment on the optimized initial individuals;
and the clustering module is used for clustering the initial individuals after the aggregation processing to construct an initial population.
As a possible implementation manner of this embodiment, the uniformly designing module includes:
the space orthogonal module is used for dividing the plane space orthogonality of the boundary of the solved function into m to obtain m orthogonal uniform coverage solutions, wherein m is a positive integer;
a design table setting module for setting a uniform design table for initialized population individuals, wherein the uniform design table is Um (m)n) Wherein x is the initialized population individual, n ═ int (x) 2+ 1;
and the space dividing module is used for dividing the whole search space into m × n subspaces according to a uniform design table, and the orthogonal initialization individuals close to the centers of the subspaces are used as the data of the initial population individuals.
As a possible implementation manner of this embodiment, the optimization module is specifically configured to:
calculating the objective function value f (x) of each initial populationi) Then calculating values f (j) of other points in the adjacent cross direction, wherein j belongs to (1, 2, 3, 4);
if the function value of one point is more optimal, the search is successful, then xiChange to more optimal point coordinates and update the point coordinates the next timeThe point coordinate is used as the center, the new step length is the old step length, the acceleration variable alpha enlarges the searching range, alpha is more than or equal to 1, if no such point is found, the searching is failed, and the point still uses xiAs a center, the new step size is the old step size, the reduction rate β reduces the search range, 0<β<1;
The above search operation is repeated until the step size is smaller than the search precision epsilon.
As a possible implementation manner of this embodiment, the aggregation module is specifically configured to:
determining two distances T1And T2,T1>T2(ii) a Randomly picking one individual x out of the optimized initial individualsiAs a sphere center, calculating the distance d from other individuals in the individual set to the sphere center, and calculating d<T2Is removed from the individual set, T2<d<T1Is drawn into canty, the operation is repeated until the collection of individuals is empty.
As a possible implementation manner of this embodiment, the clustering module is specifically configured to:
determining the center of the K-means method according to the canty center;
calculating the distance from each sample individual to each centroid;
determining cluster markers of the sample according to the closest centroids;
configuring all samples into each cluster;
updating the centroid of each cluster, wherein the centroid is the mean of all samples contained in the cluster;
circularly iterating the above process until the centers of all the subsections are not changed; or otherwise set stop conditions.
The technical scheme of the embodiment of the invention has the following beneficial effects:
the technical scheme of the embodiment of the invention combines the establishment, optimization and combination of the initial population individuals, so that the new population individuals are at the cost of only increasing the initialization time before iteration, the time consumption, fitness function, convergence and other aspects of the iteration process are more advantageous compared with the existing initialization method, and the performance of the genetic algorithm is further improved.
According to the technical scheme of the embodiment of the invention, the uniform design method in the test design method is introduced into population initialization, so that population individuals are ensured not to decrease in granularity of a search space and the number of the population individuals can still be controlled not to increase rapidly under the condition of ensuring full coverage of the search space, highly similar population individuals are clustered and combined, and the burden of space search is reduced, so that the time in the iterative process of a genetic algorithm is shorter; the local search in the initialization process improves the efficiency of space search in the subsequent genetic iteration process, so that the algorithm can be more effectively and stably converged to the function optimal value.
Description of the drawings:
FIG. 1 is a flow diagram illustrating a method for population individual initialization in a genetic algorithm in accordance with an exemplary embodiment;
FIG. 2 is a block diagram illustrating an apparatus for population individual initialization in a genetic algorithm in accordance with an exemplary embodiment;
FIG. 3 is a diagram illustrating convergence at an initial stage of iteration of various trial functions, according to an exemplary embodiment;
FIG. 4 is a diagram illustrating convergence in the middle of an iteration of various trial functions, according to an exemplary embodiment;
FIG. 5 is a diagram illustrating convergence at a later stage of an iteration of various trial functions, according to an example embodiment.
Detailed Description
The invention is further illustrated by the following examples in conjunction with the accompanying drawings:
in order to clearly explain the technical features of the present invention, the following detailed description of the present invention is provided with reference to the accompanying drawings. The following disclosure provides many different embodiments, or examples, for implementing different features of the invention. To simplify the disclosure of the present invention, the components and arrangements of specific examples are described below. Furthermore, the present invention may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed. It should be noted that the components illustrated in the figures are not necessarily drawn to scale. Descriptions of well-known components and processing techniques and procedures are omitted so as to not unnecessarily limit the invention.
Example 1
FIG. 1 is a flow chart illustrating a method of population individual initialization in a genetic algorithm according to an exemplary embodiment. As shown in fig. 1, an embodiment of the present invention provides a method for initializing population individuals in a genetic algorithm, including the following steps:
processing the boundary of the function based on uniform design to generate a uniformly covered initial individual;
optimizing the generated initial individuals based on local search to generate optimized initial individuals;
performing polymerization treatment on the optimized initial individuals;
and clustering the initial individuals after the polymerization treatment to construct an initial population.
In the embodiment, the uniform design method in the test design method is introduced into the population initialization, so that the population individuals are ensured not to decrease the granularity of the search space and the number of the population individuals can still be controlled not to increase rapidly under the condition of ensuring the full coverage of the search space; then, optimizing the initial population individuals through local search (such as step search), changing the low-quality individuals and accelerating the convergence speed; then, the calculation amount of the genetic algorithm is reduced under the condition of not influencing the performance of the genetic algorithm through a coarse clustering (canty) algorithm and a fine clustering (K-means) algorithm.
As a possible implementation manner of this embodiment, the processing the boundary of the function based on the uniform design to generate the uniform coverage initial individual includes:
dividing the plane space of the boundary of the solved function into m by m in an orthogonal equal way to obtain m by m orthogonal uniform coverage solutions, wherein m is a positive integer;
setting a uniform design table for initialized population individuals, wherein the uniform design table is Um (m)n) Wherein x is the initialized population individual, n ═ int (x) 2+ 1;
and dividing the whole search space into m × n subspaces according to a uniform design table, and taking orthogonal initialized individuals close to the centers of the subspaces as data of the initial population individuals.
The coverage of the population initial individuals on the whole search space is similar to the idea of uniform dispersion of the test points in the test design method, so the uniform design method for ensuring the uniformity of the test points in the test design method can be referred. When a multi-level test is used for meeting the condition with a large range, the uniform design can still enable the test times to be slowly increased, and the sampling requirement can be basically met only by the test times being equal to the condition number of factors. Therefore, the process of selecting the uniform design method to guide population initialization can control the number of initialized populations as much as possible under the condition of ensuring uniform coverage of the search space, and the operation burden of subsequent operation is reduced.
As a possible implementation manner of this embodiment, the optimizing the generated initial individual based on the local search, and the generating the optimized initial individual includes:
calculating the objective function value f (x) of each initial populationi) Then calculating values f (j) of other points in the adjacent cross direction, wherein j belongs to (1, 2, 3, 4);
if the function value of one point is more optimal, the search is successful, then xiChanging the point coordinate into a more optimal point coordinate, taking the latest point coordinate as the center when searching next time, expanding the searching range by using the new step length as the old step length and the acceleration variable alpha, wherein the alpha is more than or equal to 1; if no such point is found, it indicates a search failure, still by xiAs the center, the new step length is the old step length, the reduction rate beta is reduced, the search range is reduced, 0 < beta < 1, namely when no more optimal point coordinate exists in the periphery, x isiMaintaining an original coordinate, namely the coordinate before the search;
the above search operation is repeated until the step size is smaller than the search precision epsilon.
After the search space is divided equally by the initial population individuals generated in the previous section, local search is carried out by using a Hookee-like algorithm from the initial individuals at the center of each sub-search space, and the initial individuals generated by the uniform design method are replaced by the individuals with better local.
Taking a local search process of one of the initial individuals as an example, a specific local search process is roughly as follows:
[1]setting initial population individual x1D, the initial step length is δ, the acceleration variable of the step is α (α ≧ 1), the reduction ratio β (0 < β < 1), the step search precision is ∈ (≧ 0), ej ═ T (0, …, 0,1, 0, …, 0), j ═ 1, 2, …, n1=x1,k=1,j=1.
[2]And (4) axial searching. Reference point from the initial point yjInitially, the individuals better than the individuals of the current population are found along the direction of the component of x with a set step length δ, so that
[4]After the step search in each direction of the x-axis is completed, let f (y)n+1)<f(xk) If not, the step distance is readjusted and then the search is carried out.
[5]And (4) searching modes. With yn+1=xk+1Is a condition of, let y1=xk+1+α(xk+1-xk) The population individuals under establishment serve as new reference individuals, and k: k +1, j 1. And after the obtained new reference individual is determined, turning to 2) to continue searching.
[6]The step distance is adjusted. If delta is ≦ ε, the search is ended, xkThe population individuals after optimization are obtained; otherwise, let δ: β δ, y1=xk,xk=xk+1While letting k: k +1, j 1, continue to rotate [2 ]]A search is conducted.
And carrying out local search on the population individuals obtained by uniform design in the sub-search space corresponding to the population individuals to obtain better individuals, replacing the initial uniformly designed individuals, and preparing for population aggregation in the same foreground space.
As a possible implementation manner of this embodiment, the performing aggregation processing on the optimized initial individuals includes:
determining two distances T1And T2,T1>T2(ii) a Randomly picking one individual x out of the optimized initial individualsiAs a sphere center, calculating the distance d from other individuals in the individual set to the sphere center, and calculating d<T2Is removed from the individual set, T2<d<T1Until the individual set is empty, that is, all the divisions are completed.
When the clustering is performed by the method of the class K-means, the speed and the effect of clustering are affected by the selection of the clustering center, so that the preliminary clustering needs to be performed to make a reference for selecting the clustering center for the next section of clustering.
Canopy belongs to a rough clustering method, data are divided into a plurality of sub-Canopy through calculation and comparison of distances between points, the algorithm is low in precision, and the algorithm can be used as a preposition method of a next section. Two distances T1And T2The choice of (c) can be determined approximately by cross-validation. The similarity of genes can be used as a distance index in the canty method in the population initialization process of the genetic algorithm.
As a possible implementation manner of this embodiment, the clustering the initial individuals after the aggregation to construct the initial population includes:
determining the center of the K-means method according to the canty center;
calculating the distance from each sample individual to each centroid
Determining cluster labels for samples from nearest centroids
Configuring all samples into respective clusters
Updating the centroid of each cluster, which is the mean of all samples contained in that cluster
Circularly iterating the above process until the centers of all the subsections are not changed; or other set stop conditions are reached, such as the number of iterations reaching a maximum value, the squared difference being less than a desired value, etc.
The K-means algorithm cluster is a method cluster for finding a given data set, and can be used for clustering the data set so as to obtain a desired foreground space, combining similar population initial individuals and reducing the calculation amount of each iteration of a subsequent genetic algorithm. Distances can be specifically quantified in genetic algorithms by the similarity between genes. Because the K value of the standard K-means algorithm needs to be adjusted and parameters, the standard K-means algorithm is sensitive to the initial centroid and the like, the improved K-means-like algorithm is generally used, and the centroid problem is solved in the previous sections, so that a good result can be obtained by using the standard K-means method.
As shown in fig. 2, an apparatus for initializing population individuals in a genetic algorithm according to an embodiment of the present invention includes:
the uniform design module is used for processing the boundary of the function based on uniform design to generate a uniformly covered initial individual;
the optimization module is used for optimizing the generated initial individuals based on local search to generate optimized initial individuals;
the aggregation module is used for carrying out aggregation treatment on the optimized initial individuals;
and the clustering module is used for clustering the initial individuals after the aggregation processing to construct an initial population.
As a possible implementation manner of this embodiment, the uniformly designing module includes:
the space orthogonal module is used for dividing the plane space orthogonality of the boundary of the solved function into m to obtain m orthogonal uniform coverage solutions, wherein m is a positive integer;
a design table setting module for setting a uniform design table for initialized population individuals, wherein the uniform design table is Um (m)n) Wherein x is the initialized population individual, n ═ int (x) 2+ 1;
and the space dividing module is used for dividing the whole search space into m × n subspaces according to a uniform design table, and the orthogonal initialization individuals close to the centers of the subspaces are used as the data of the initial population individuals.
As a possible implementation manner of this embodiment, the optimization module is specifically configured to:
calculating the objective function value f (x) of each initial populationi) Then calculate its neighborsThe values f (j) of the other points in the cross direction, j epsilon (1, 2, 3, 4);
if the function value of one point is more optimal, the search is successful, then xiThe point coordinate is changed to be more optimal, the latest point coordinate is taken as the center in the next search, the new step length is the old step length, the acceleration variable alpha is used for expanding the search range, alpha is more than or equal to 1, if no such point is found, the search is failed, and x is still usediAs a center, the new step size is the old step size, the reduction rate β reduces the search range, 0<β<1;
The above search operation is repeated until the step size is smaller than the search precision epsilon.
As a possible implementation manner of this embodiment, the aggregation module is specifically configured to:
determining two distances T1And T2,T1>T2(ii) a Randomly picking one individual x out of the optimized initial individualsiAs a synopy center, calculating the distance d from other individuals in the individual set to the synopy center, and making d < T2Is removed from the individual set, T2<d<T1Is drawn into canty, the operation is repeated until the collection of individuals is empty.
As a possible implementation manner of this embodiment, the clustering module is specifically configured to:
determining the center of the K-means method according to the canty center;
calculating the distance from each sample individual to each centroid
Determining cluster labels for samples from nearest centroids
Configuring all samples into respective clusters
Updating the centroid of each cluster, which is the mean of all samples contained in that cluster
Circularly iterating the above process until the centers of all the subsections are not changed; or otherwise set stop conditions.
The device of the invention is used for initializing population individuals in genetic algorithm, and the population individuals are initialized according to a unimodal function Zakharoy in CEC2017 function set: y is x1 2+x2 2+(0.5(x1+x2))2+(0.5(x1+ x2)4, the minimum value of the function is 0.
1. Uniform design method
First, from the boundary x of the function sought1∈[-5,10]、x2∈[-5,10]The planar space of the solution is divided into 100 x 100 in an orthogonal way, and the obtained orthogonal uniform coverage solution (10000) parts are as follows:
[ -4.92500000, -4.92500000] [ -4.92500000, -4.77500000] [ -4.92500000, -4.62500000] [ -4.92500000, -4.47500000] [ -4.92500000, -4.32500000] [ -4.92500000, -4.17500000] [ -4.92500000, 4.02500000] [4.92500000, 3.87500000] [4.92500000, 1.22500000]. para … [9.92500000, 8.12500000] [9.92500000, 8.27500000] [9.92500000, 8.42500000] [9.92500000, 8.57500000] [9.92500000, 8.72500000] [9.92500000, 8.87500000] [9.92500000, 9.02500000] [9.92500000, 9.17500000] [9.92500000, 9.32500000] [9.92500000, 9.47500000] [9.92500000,9.62500000] [9.92500000,9.77500000] [9.92500000,9.92500000]
Since the data amount of the orthogonal equal division is too large, it is set here that 50 individuals are used as the initialized population individuals, it is possible to use the U17 × 175 table (table 1) as the uniform design table by referring to the relevant data of the uniform design table, and in the case of using s equal to 3 in cooperation with the corresponding use table (table 2), that is, 1, 2, and 4 columns for 3 columns in total, and 3 × 17 equal to 51 division spaces, that is, 51 initial population individuals, which is the closest to the number of 50 initial population individuals planned to be used. The whole search space is divided into 17 x 5 subspaces according to a uniform design table, and orthogonal initialization individuals close to the centers of the subspaces can be used as data of the initial population individuals.
TABLE 1.U17 *(175) Uniform design table
TABLE 2.U17 *(175) Use the table
The following initial population individual (51) coordinates were obtained from the results of columns 1, 2, and 4 of the uniform design taking the orthogonal results:
[-4.92500000,-4.92500000][-4.92500000,-4.04300000][-4.92500000,-3.16100000][-4.92500000,-2.27900000][-4.92500000,-1.39700000][-4.92500000,-0.51500000][-4.92500000,0.36700000][-4.92500000,1.24900000][-4.92500000,2.13100000][-4.92500000,3.01300000][-4.92500000,3.89500000][-4.92500000,4.77700000][-4.92500000,5.65900000][-4.92500000,6.54100000][-4.92500000,7.42300000][-4.92500000,8.30500000][-4.92500000,9.18700000][-4.92500000,10.06900000][-1.92500000,-4.92500000][-1.92500000,-4.04300000][-1.92500000,-3.16100000][-1.92500000,-2.27900000][-1.92500000,-1.39700000][-1.92500000,-0.51500000][-1.92500000,0.36700000][-1.92500000,1.24900000][-1.92500000,2.13100000][-1.92500000,3.01300000][-1.92500000,3.89500000][-1.92500000,4.77700000][-1.92500000,5.65900000][-1.92500000,6.54100000][-1.92500000,7.42300000][-1.92500000,8.30500000][-1.92500000,9.18700000][-1.92500000,10.06900000][4.07500000,-4.92500000][4.07500000,-4.04300000][4.07500000,-3.16100000][4.07500000,-2.27900000][4.07500000,-1.39700000][4.07500000,-0.51500000][4.07500000,0.36700000][4.07500000,1.24900000][4.07500000,2.13100000][4.07500000,3.01300000][4.07500000,3.89500000][4.07500000,4.77700000][4.07500000,5.65900000][4.07500000,6.54100000][4.07500000,7.42300000]。
2. local search (the embodiment uses step search)
The step search is to let each point in the direction of the independent variable, select a point with a better result than the current point in the adjacent range as the current point to be searched next time, and use the step length L < the step precision ∈ 0.0005 as the end condition of the local optimization iteration process.
All initial points have been determined, i.e. the 51 population individuals obtained by the uniform design method in the previous step, and then since there are two independent variables, the search direction is to proceed along the directions of the two independent variables with the currently set step length L being 0.0075, i.e. to search in the cross direction on the solution plane.
The method comprises the following specific steps:
calculating an objective function value f (x) of each initial population (51 points)i) Then, the values f (j), j e (1, 2, 3, 4) of other points in the adjacent cross direction are calculated.
If the function value of one point is more optimal, the search is successful, and then xiThe search range is expanded by changing to the more optimal point coordinate, centering on the latest point coordinate in the next search, and taking the old step as the new step and the acceleration variable alpha as 1.5 (alpha is more than or equal to 1), and if such a point is not found, the search is failed, and the search still takes xiAs a center, the new step size is equal to the old step size, and the reduction rate β is equal to 0.5 (0)<β<1) And the search range is narrowed.
And thirdly, repeating the operation of the second step until the end condition (step length < epsilon) is reached.
For example, one population is [ -4.925, -4.925]Its adjacent cross direction point values are 659.20, 663.00, 659.20 and 663.00, and one of the optimal values is the current value [ x ]1,x2](ii) a Then (new) L is (old) L0.5, the first step is repeated, the cycle is repeated, if each point in the adjacent cross direction is better than the center point, then (new) L is (old) L1.5, until L is reached<Stop at 0.0005.
Each population initial point obtains the following data through the step searching steps, wherein the first value is a function value, the second value is a third value, and the third value is x1、x2。
[627.52439578,-4.85750000,-4.85750000][439.36882645,-4.85750000,-3.97550000][297.73775423,-4.85750000,-3.08600000][196.32514961,-4.85750000,-2.20400000][126.51258548,-4.85750000,-1.32950000][80.02730675,-4.85750000,-0.44000000][52.59409069,-4.85750000,0.43450000][38.28930633,-4.85750000,1.31650000][33.30855899,-4.85750000,2.20600000][33.99673248,-4.85750000,2.93800000][38.52922346,-4.85750000,3.82000000][45.71019186,-4.85750000,4.70200000][54.92572376,-4.85750000,5.58400000][66.46965392,-4.85750000,6.46600000][81.54356568,-4.85750000,7.34800000][102.14396265,-5.00000000,8.23000000][130.12435876,-5.00000000,9.11200000][169.99038223,-5.00000000,9.99400000][165.39457950,-1.85750000,-4.85750000][100.11244267,-1.85750000,-3.97550000][56.40982784,-1.85750000,-3.08600000][29.43879481,-1.85750000,-2.20400000][14.20486995,-1.85750000,-1.32950000][6.70494708,-1.85750000,-0.44000000][4.40159984,-1.85750000,0.43450000][4.95901593,-1.85750000,1.17400000][7.68738985,-1.85750000,2.05600000][12.45920845,-1.85750000,2.93800000][19.93264094,-1.85750000,3.82000000][31.26536369,-2.00000000,4.70200000][48.70453648,-2.00000000,5.58400000][75.65852299,-2.00000000,6.46600000][116.26982688,-2.00000000,7.34800000][175.58870040,-2.00000000,8.23000000][259.57314446,-2.00000000,9.11200000][375.08890857,-2.00000000,9.99400000][39.81292502,4.00000000,-4.85750000][31.80475034,4.00000000,-3.97550000][25.77586290,4.00000000,-3.08600000][22.31430741,4.00000000,-2.20400000][22.31711251,4.00000000,-1.47200000][27.70591935,4.00000000,-0.59000000][41.89951546,4.00000000,0.29200000][68.86132482,4.00000000,1.17400000][113.46252004,4.00000000,2.05600000][181.48202235,4.00000000,2.93800000][279.60650161,4.00000000,3.82000000][415.43037630,4.00000000,4.70200000][597.45581353,4.00000000,5.58400000][835.09272904,4.00000000,6.46600000][1138.65878716,4.00000000,7.34800000][1519.37940090,4.00000000,8.23000000][1989.38773185,4.00000000,9.11200000][2561.72469024,4.00000000,9.99400000]。
3. Coarse clustering
Coarse clustering uses the canty algorithm:
first, two distances T are set1、T26 and 3, respectively, and then randomly selecting an initial individual such as [627.52439578, -4.85750000, -4.85750000 ] from the results of the second step]As the centroid of the first crop and deleted from the individual set; and then follow the results setSelecting an individual [116.26982688, -2.00000000,7.34800000 ]]Calculating the distances from the center of mass to all the center of mass, wherein only one center of mass exists, and the distance between the center of mass and the center of mass exceeds T1Thus, the second individual forms a new centroid and is deleted from the set of individuals; taking another individual, if the minimum distance is less than T2Adding the cluster of the centroid and deleting from the individual set if the cluster is larger than T2Then form a new centroid and delete it from the individual set if the distance is at T1T2And only adding the clusters without deleting the clusters, and circulating until the cluster of the population individuals is empty.
The individual set of the second step can be divided into 11 clusters by the above steps:
[196.32514961,-4.85750000,-2.20400000][297.73775423,-4.85750000,-3.08600000][627.52439578,-4.85750000,-4.85750000][52.59409069,-4.85750000,0.43450000][80.02730675,-4.85750000,-0.44000000][439.36882645,-4.85750000,-3.97550000][126.51258548,-4.85750000,-1.32950000];
[4.95901593,-1.85750000,1.17400000][12.45920845,-1.85750000,2.93800000][6.70494708,-1.85750000,-0.44000000][14.20486995,-1.85750000,-1.32950000][19.93264094,-1.85750000,3.82000000][7.68738985,-1.85750000,2.05600000][4.40159984,-1.85750000,0.43450000];
[1519.37940090,4.00000000,8.23000000][1989.38773185,4.00000000,9.11200000][1138.65878716,4.00000000,7.34800000][2561.72469024,4.00000000,9.99400000];
[68.86132482,4.00000000,1.17400000][41.89951546,4.00000000,0.29200000][113.46252004,4.00000000,2.05600000];
[45.71019186,-4.85750000,4.70200000][54.92572376,-4.85750000,5.58400000][81.54356568,-4.85750000,7.34800000][31.26536369,-2.00000000,4.70200000][48.70453648,-2.00000000,5.58400000][38.52922346,-4.85750000,3.82000000][33.99673248,-4.85750000,2.93800000][33.30855899,-4.85750000,2.20600000][66.46965392,-4.85750000,6.46600000];
[22.31430741,4.00000000,-2.20400000][31.80475034,4.00000000,-3.97550000][25.77586290,4.00000000,-3.08600000][27.70591935,4.00000000,-0.59000000][22.31711251,4.00000000,-1.47200000][39.81292502,4.00000000,-4.85750000];
[259.57314446,-2.00000000,9.11200000][75.65852299,-2.00000000,6.46600000][116.26982688,-2.00000000,7.34800000][175.58870040,-2.00000000,8.23000000][375.08890857,-2.00000000,9.99400000];
[415.43037630,4.00000000,4.70200000][597.45581353,4.00000000,5.58400000][181.48202235,4.00000000,2.93800000][279.60650161,4.00000000,3.82000000][835.09272904,4.00000000,6.46600000];
[169.99038223,-5.00000000,9.99400000][102.14396265,-5.00000000,8.23000000][130.12435876,-5.00000000,9.11200000];
[100.11244267,-1.85750000,-3.97550000][165.39457950,-1.85750000,-4.85750000][56.40982784,-1.85750000,-3.08600000][29.43879481,-1.85750000,-2.20400000];
[38.28930633,-4.85750000,1.31650000]。
the 11 clusters are the basis of the fourth step of fine clustering.
4. Fine clustering (K-Means algorithm)
a) Determining the center of the K-means method according to the center (sphere center) obtained in the previous section of preliminary polymerization;
b) calculating the distance from each sample individual to each centroid
c) Determining cluster labels for samples from nearest centroids
d) Configuring all samples into respective clusters
e) Updating the centroid of each cluster, which is the mean of all samples contained in that cluster
f) Circularly iterating the above process until the centers of all the subsections are not changed; or otherwise set stop conditions are reached (e.g., the number of iterations reaches a maximum value, the squared difference is less than a desired value, etc.).
Determining the initial center of the K-means method through 11 clustering clusters of the results in the previous step as follows:
[196.32514961,-4.85750000,-2.20400000],
[4.95901593,-1.85750000,1.17400000],
[1519.37940090,4.00000000,8.23000000],
[68.86132482,4.00000000,1.17400000],
[45.71019186,-4.85750000,4.70200000],
[22.31430741,4.00000000,-2.20400000],
[259.57314446,-2.00000000,9.11200000],
[415.43037630,4.00000000,4.70200000],
[169.99038223,-5.00000000,9.99400000],
[100.11244267,-1.85750000,-3.97550000],
[38.28930633, -4.85750000,1.31650000], configure other individuals to the cluster where the closest centroid is located, change the centroid to mean data of the individuals in the cluster, and loop iteration until the centroid does not change, the final centroid can be:
[196.73681098,-4.85750000,-2.20828571][5.08419293,-1.85750000,1.23614286][1742.42882019,4.00000000,8.67100000][68.86132482,4.00000000,1.17400000][41.12583210,-4.22250000,4.81666667][23.88051615,4.00000000,-2.69750000][175.58870040,-2.00000000,8.23000000][415.43037630,4.00000000,4.70200000][130.12435876,-5.00000000,9.11200000][75.85786835,-1.85750000,-3.53075000][38.28930633,-4.85750000,1.31650000]。
the above is the population individuals when the initialization is completed.
The embodiment can be applied to chromosome generation of initial population individuals mapped by a process of conventional workshop scheduling of a genetic algorithm in workshop scheduling. According to the reality, the independent variable value can be changed into discrete (such as process number and workpiece number); in the local search, in order to ensure the contraction and expansion of the step length, the step length can be fixed to be 2, and the minimum step length is set to be 1; in coarse clustering T2Can be set to the value of the maximum difference of the process numbers 0.2 result, T1Is set to T2To double, the distance between chromosomes of various groups of individuals can be quantified using the degree of similarity of the genes (e.g., the number of corresponding genes between two chromosomes)Sum of word difference values, etc.); the fine clustering is similar to the coarse clustering, and the operation process and the result are rounded according to the actual situation.
In order to verify the effectiveness of the genetic algorithm initial individual generation method provided by the invention, the initial method is compared with the existing initial individual generation method in the aspects of running time, fitness function, convergence and the like, the experiment is carried out to control variables, the same cross mutation probability, the maximum genetic algebra, the population size and the number of genes of individuals are set, and each algorithm runs for multiple times to eliminate errors.
The experiment is tested by using a CEC2017 function set, and in order to improve the efficiency, 10 functions are selected for testing in the experiment, wherein the 10 functions comprise 3 unipolar value functions, 2 multiextremum functions and 5 mixing and combining functions.
PICCM, CBPI and SBDI are selected as reference initialization methods through the research of the prior literature on the comparison of common initialization methods of genetic algorithms.
Table 3 shows the mean and standard deviation of the fitness function of the genetic algorithm under different population initialization methods, and table 4 shows the average convergence condition of each test function at each stage.
Table 3: mean and standard deviation of fitness function
Table 4: average convergence of each test function at each stage
3-5, the population initialization method of the genetic algorithm using the algorithm of the present invention has a better fitness function than other algorithms in the initial stage of iteration.
Table 5: mean and standard deviation of iterative process time
Table 5 shows the iterative process times for the algorithm of the present invention and the CBPI, PICCM, SBDI initialization algorithms. Analysis shows that the initialization algorithm provided by the invention effectively reduces the time consumption of the genetic algorithm in the iterative process, and the standard deviation is better.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting the same, and although the present invention is described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications and equivalents may be made to the embodiments of the invention without departing from the spirit and scope of the invention, which is to be covered by the claims.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种DNA计算的数据处理方法