Optimization of one-dimensional wire cutting with variable length based on genetic ant colony algorithm

This paper presents an algorithm of one-dimensional wire cutting based on genetic algorithm and ant colony algorithm. Firstly, the dominant solution is screened out by genetic algorithm and transformed into the initial accumulation of pheromone in ant colony algorithm, and then the ant colony algorithm is used to adjust the dominant solution of genetic algorithm to obtain the approximate optimal solution. The experimental results show that the convergence rate of the fusion algorithm is faster than that of the ant colony algorithm, and the utilization rate of raw materials is higher than that of genetic algorithm. In addition, the optimal parameters are obtained by adjusting the experimental parameters of the fusion algorithm.


Introduction
Wire cutting problem has a long history, it is a linear programming problem of operational research, which affects the production cost of industry, so the research of this problem has practical significance. The problem of wire cutting was first put forward by Soviet scientists and solved by linear programming, then the simplex method and the delay column method were produced [1][2][3][4].With the development of artificial intelligence algorithm, more heuristic algorithm and swarm algorithm are used to solve problems, such as genetic algorithm [5,6,9] simulated annealing [7][8], particle swarm algorithm [7], ant colony algorithm [10][11][12].
One dimensional wire cutting problem can be divided into two types according to the situation of raw materials: the cutting of fixed length raw materials, i.e. all raw materials are equal in length, and the cutting of variable length raw materials, i.e. most of the raw materials are different in length. In this paper, we mainly cut one-dimensional raw materials with different length, so that the utilization rate of the selected raw materials is the highest under the condition of meeting the cutting demand. In this paper, genetic algorithm and ant colony algorithm are integrated to achieve the cutting of materials, and compared with ant colony algorithm and genetic algorithm to verify the effectiveness of the fusion algorithm. It is concluded that the cutting effect of the fusion algorithm is faster than that of ant colony algorithm because of genetic algorithm.

One dimensional wire cutting problem
There are I kinds of raw materials, and the corresponding length of raw materials is li. Now, it is necessary to cut J kinds of parts with length of KJ, and the demand of each length of parts is kj. Define L as the total length of parts required for cutting; y as the total length of raw materials used for cutting; then the utilization ratio of raw materials: Max(ω) = (1) It is defined that the length of waste material generated by cutting is f; the length of surplus material after cutting is y; the loss caused by cutting is s, then there are: Y = L + f + s (2) In formula 2, the part length L is a fixed value (assuming that the current inventory can meet the cutting demand of all parts). The number of raw materials starts from 0, and the quantity of all raw materials is Xi, then the number range of raw materials is [0, XI-1], similarly, all parts are numbered, and the range is [0, NJ-1], NJ is the total number of all parts.
It is defined as the number of parts with the length of KJ cut on the raw material with the number of X, then the number of parts to be cut needs to meet the demand of parts kJ, with the formula: (3) In addition, the total length of each selected raw material is greater than or equal to the length of the parts cut from the original parts, the loss of cutting and the length of surplus materials, so the following constraints need to be met: (4) σ is the cutting loss of each time, and the value is 5mm. Is the length of the original corresponding to the number x, the total length of the raw material used: where fx is a column vector with the length of Xi, the x element represents the selection of the original with the number of x, the value of 0 represents no selection, and the value of 1 represents selection. Total length of parts: ∑ ( * ) =0 = L (6) Formula 1 is the objective function, which is composed of formula 5 and 6, and formula 3and 4 constitute the cutting constraints.

Optimization of one-dimensional wire cutting algorithms
This paper studies the optimization algorithm based on genetic algorithm and ant colony algorithm. Both the genetic algorithm and the ant colony algorithm have their own advantages and disadvantages, the genetic algorithm iterates fast, there is a lot of redundant calculation in the later stage and the precision of solving is not high. The positive feedback mechanism of ant colony algorithm enables the algorithm to find the optimal solution with higher precision, but because the accumulation of pheromones in the early stage of the algorithm is less, the ants need to repeat a large number of solutions unrelated to the optimal solution, which makes the initial search efficiency of the algorithm low. The Fig.1 is an efficiency diagram of the genetic algorithm and the ant colony algorithm.
As shown in the figure above, before tb and after td, the efficiency of one algorithm is very low. The efficiency difference between tb and td is the smallest, and even the efficiency of the two algorithms at tc time point is the same. According to the efficiency of the algorithm, the following strategies are adopted to capture tc time points: The time point tc can not be accurately grasped, and the time point of exiting the genetic algorithm is controlled between [tb, td]. The exit time of genetic algorithm is controlled by setting the maximum number of iterations Tmax and the minimum number of iterations Tmin.
When the number of iterations of the algorithm is within [Tmin, Tmax], the minimum evolution rate Nmin is set, and when the population evolution rate is less than the minimum evolution rate, the genetic algorithm exits.  In this paper, the utilization rate of raw materials of the population is taken as the convergence goal and exit condition of ants. When the difference between the utilization rate of the optimal solution and the average utilization rate of the population is less than 0.5%, it is considered that the utilization rate of raw materials of the population reaches the convergence state, and the exit algorithm takes out the optimal solution. 3.5 Algorithm idea and flow chart:

A optimization algorithm based on genetic algorithm and ant colony algorithm
The idea of the algorithm is to fuse ant colony algorithm and genetic algorithm in the way of flow chart above, to give full play to their respective advantages, to use genetic algorithm to carry out evolution and genetic operation on the initial random population, and to use fitness function to calculate the corresponding function value of each individual, to find the average utilization rate, and to carry out genetic operator operation on each individual, to get the optimal solution for ant colony To initialize the pheromone. Using ant colony to search, when the ant colony algorithm reaches the exit condition, the calculation process is finished and the result is output.

Experiment
Experiment 1, experiment 2 and Experiment 3 are set up to cut the above inventory information and parts demand using genetic algorithm, ant colony algorithm and genetic ant colony algorithm respectively. The specific parameters of the experiment are as follows: The population number of genetic algorithm is 100; the maximum and minimum evolution times Tmin is 5 and Tmax is 10; the minimum population evolution rate is defined as the difference between the average raw material utilization rate of two adjacent evolutions is less than 1%.
The raw material utilization of the three groups of experiments can be seen from the figure that the average raw material utilization of Experiment 1 is the lowest when the population reaches convergence, while the average raw material utilization of Experiment 2 and Experiment 3 is very small when they converge. Therefore, it can be concluded that the cutting efficiency of genetic ant colony algorithm for one-dimensional indefinite length wire is higher than that of genetic algorithm. See Figure 3, Figure 4 and Figure 5 for details:    The algorithm time of three groups of experiments is shown in the figure below. It can be concluded that the convergence time of genetic ant colony algorithm is faster than that of ant colony algorithm, and the cutting efficiency is very small. Although it takes longer than genetic algorithm, it gets better results than genetic algorithm. The specific form of each group of experiments is shown in Figure 6.

Conclusion
By comparison with experiments, it is proved that the fusion algorithm is nearly twice as fast in solving as the single ant colony algorithm, and the quality of the solution is better than that of using the genetic algorithm alone, which is similar to the solution obtained by using the ant colony algorithm alone. This study can be used to cut raw materials left in factory warehouses or to do secondary cutting of acquired plant waste to control production costs and maximize the benefits.