Applied Science and Innovative Research ISSN 2474-4972 (Print) ISSN 2474-4980 (Online) Vol. 7, No. 4, 2023 www.scholink.org/ojs/index.php/asir 21 Original Paper A Quantum Particle Swarm Optimization Algorithm Based on Aggregation Perturbation H. D. Wang1, C. N. Zhang1, H. Zhang1, Y. C. Wei1 & X. L. Guan2 1 University of Science and Technology Liaoning, School of Computer Science and Software Engineering, Anshan Liaoning, China 2 Anshan Information Engineering School, Anshan Liaoning, China Received: August 16, 2023 Accepted: September 8, 2023 Online Published: September 13, 2023 doi:10.22158/asir.v7n4p21 URL: http://doi.org/10.22158/asir.v7n4p21 Abstract A quantum particle swarm hybrid optimization algorithm based on aggregation disturbance is proposed for inventory cost control. This algorithm integrates the K-means algorithm on the basis of traditional particle swarm optimization, recalculates the clustering center, initializes stagnant particles, and solves the problem of particle aggregation. Introducing chaos mechanism into the algorithm, changing the position of particles, enhancing their activity, and improving the algorithm's global optimization ability. At the same time, define the aggregation disturbance factor, determine the current state of particles, optimize speed and position to accelerate escape, and solve the problem of particles falling into local optima. Experiments show that M-IKPSO algorithm has strong stability, fast Rate of convergence and high accuracy compared with other algorithms, and the improvement effect is significant. Keywords Particle Swarm Optimization; Aggregation disturbance; K-means algorithm 1. Introduction Inventory cost often occupies an important position in the cost accounting of an enterprise, especially for iron and steel enterprises, which accounts for more than 60%. Changes in market supply and demand determine the necessity of steel mill inventory. How to measure the size of inventory and Market trend is an important way for enterprises to reduce costs. The traditional inventory analysis methods include three types: using year-on-year changes to measure the size of inventory; Using month on month changes to measure inventory consumption speed; Use the data from China Steel Association to estimate the actual consumption in the market. Enterprises can comprehensively consider inventory https://scholar.cnki.net/home/search?sw=6&sw-input=C.%20N.%20ZHANG www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 7, No. 4, 2023 22 Published by SCHOLINK INC. influencing factors based on the above three analysis methods, determine the true level of inventory, price cycle changes, and seasonal effects, and then calculate reasonable inventory holding and destocking speed to determine the market supply and demand situation and arrange production based on the inventory of steel. Establishing a mathematical model that meets the requirements of inventory optimization and designing an efficient algorithm to solve the optimal procurement quantity is of great practical significance for the cost reduction of enterprises (Kamal, Bakar, & Zainudin, 2022). Particle swarm optimization (PSO) algorithm was proposed by J. Kennedy and R.C. Eberhart in 1995. The algorithm is a simulation of birds' predatory behavior, iterative in an evolutionary way, and is a global optimization algorithm. The advantages of PSO algorithm lie in its fast search speed, fewer adjustable parameters, and high stability. Once the algorithm is introduced, it is widely praised by scholars and can quickly find the optimal solution, which has been widely applied in multi-objective optimization and constraint problem optimization (Nafiseh & Sodeif, 2020). Although the PSO algorithm has certain advantages in terms of global optimization ability and convergence, its tendency to fall into local optima is also evident. In algorithm iteration, when particles gather in a certain local area, the usual approach is to enhance the inertia coefficient and give the particles an acceleration to break free from local constraints. However, since the historical global optimal position has been verified in the local range, if the acceleration is not large during the particle's journey, it is easy to quickly return to the original gathering point. In order to solve the above problems, a quantum particle swarm optimization algorithm based on aggregation disturbance is proposed in the paper. The algorithm works when particles fall into local optima (Ramesh, Sundararaman, Sabareeswaran, & Srinivasan, 2022; Ahmed, Osman, & Korovkin, 2021). 2. Particle Swarm Related Issues 2.1 Fundamentals of Particle Swarm Optimization The PSO algorithm is a simulated evolutionary process that obtains the optimal solution through communication and collaboration between individuals, where each particle has two attributes: velocity and position. The solution of the problem corresponds to the current position of the particle, and its performance depends on the fitness value of the optimization function. In the Q -dimensional space, the particle is initialized as 1 2{ , , , }nx x x , the velocity of the i -th particle in the space is defined as 1 1={ , , , }i i i iQv v v v , the position is defined as 1 1={ , , , }, 1,2, ,i i i iQx x x x i n , and the direction of travel follows the trajectory of the optimal particle. Among them, the current optimal position searched by a particle is Pb , and the optimal position obtained by the entire population is Gb . As the algorithm iterates, the particle positions are repeatedly stacked until the termination condition is met, obtaining the optimal solution. For k+1 iterations, each particle updates its own velocity and position according to the following equation: 1 0 1( ) ( )k k k k iq iq Pb iq Gb iqv v x x x x        (1) www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 7, No. 4, 2023 23 Published by SCHOLINK INC. 1 1k k k iq iq iqx x v   (2) Among them,  is the inertia weight coefficient used to balance the relationship between the current particle's travel speed; 0 1, [0,1]   , Random distribution; 1,2, ,q Q . In the clustering problem, for vectors in the Q -dimensional space, it ultimately boils down to obtaining a class partition. The partition class is defined as C , and the following formula needs to be met: 1 i i j k i C C C U X             (3) Among them, i jC C C, , , [1, ]i j k , based on this, the inter class dispersion is obtained, 1 ( , ) i k i i j X C J D X Z    (4) In the formula, k is the number of clusters, iZ is the i -th cluster center, and ( , )i iD X Z represents the distance from the sample to the corresponding cluster center. For the precocity problem of algorithms, it is mainly reflected in the convergence of the algorithm and the diversity of particles. The trajectory of particles is not random, and it is inevitable that some poorly performing particles will appear during iteration, with a significant decrease in speed or oscillation in a certain dimension of space. This can easily lead to local optima and premature phenomena. Based on this, this article proposes several improvement schemes for particle performance. Firstly, introduce chaos mechanism into the algorithm to enhance particle ergodicity; Furthermore, utilizing quantum theory to enhance particle vitality and enhance particle optimization ability; Meanwhile, an attempt was made to update the particle state using the K-means algorithm in order to achieve better particle performance (Badhera, Verma, & Nahar, 2022; Shrifan, Akbar, & Isa, 2022). 2.2 Chaotic Sequence Chaos widely exists in nature and is a nonlinear phenomenon. Because of its sensitivity to Initial condition and its characteristics of randomness, ergodicity and regularity, it can search all internal states in a given area according to its own laws without repetition. Based on this, chaos mechanism is used to optimize the particle optimization process, and the search steps are as follows: (1) Define the initial region. The N -dimensional initial state vector is 0 01 02 0( , , , )NR R R R , and the values in 0R are adjacent and have little difference. (2) The Initialization vector 0R is calculated by using the logistics equation to generate the chaotic sequence 1 2, , , nc c c . Here, after several iterations, the system will be completely in a chaotic state. The vector layer can be expressed as: 1 1(1 )i i ic c c    (5) Among them,  is the iterative control parameter. www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 7, No. 4, 2023 24 Published by SCHOLINK INC. (3) Assuming the spatial particle iX , use formula (3) to obtain a better position for iX , denote ' iX . ' i j iX r rnd c X    (6) Among them, r is the active radius of particle iX , [ 1,1]rnd   , [0, ]j n . The main idea of particle swarm optimization algorithm based on chaotic mechanism is as follows: on the one hand, using chaotic sequences to initialize the position and velocity of particles, due to its ergodic characteristics, it not only maintains the diversity of particles but also enhances their search ability; Furthermore, chaotic states can make the motion of particles persistent. Particle chaos initialization: Assign initial values to iX in formula (6) and re-correct the velocity in particle swarm iteration: , ' '' 0 , 1 , ( 1) ( ) ( )( ( ) ( )) ( )( ( ) ( )) i j lb i j gb i j v t v t t x t x t t x t x t (7) Among them, is the constant of (0,1] , is the random number of Normal distribution [0,1]N , [1, ]i n , [1, ]j m , n is the particle number, and m is the spatial dimension. About '' ( )v t ,'' ( ) 0 ( ) [0,1] 1 i jv t v t N v   (8) 0 ( ( 1)) ( ( )) 1 ( ( )) ( ( 1)) ( ( 5)) gb gb gb gb gb f x t f x t f x t f x t f x t     (9) Among them, max /1.1iv v c , ( ) ( )gb Tf x f x , ic is a new chaotic sequence, ( )gbf x is the satisfactory solution, and ( )Tf x is the target solution. The introduction of chaotic mechanisms will have a positive impact on the search process. In this paper propose to replace the weight coefficients of random distributions in PSO with chaotic sequences to complete particle velocity updates. 2.3 Inertia Weight The improvement of algorithm accuracy introduces chaos mechanism in the article, and for the problem of early maturity and slow evolution in the later stage, it is advisable to improve the inertia weight value in speed update. The ultimate goal of particle evolution is to find the global optimal solution, and the position and velocity change during each iteration. The position is determined by velocity, so velocity is the key to guiding particle flight and optimizing algorithm design. Here, the magnitude of inertia weight directly affects the velocity and direction of particles. Based on the above analysis, the article intends to adjust the inertia weight values that affect speed to make them change according to the cosine law with evolutionary algebra. In this way, in the initial stage of the algorithm, the inertia weight is maintained at a large value to improve the particle's local search ability. The relevant expression is as follows: www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 7, No. 4, 2023 25 Published by SCHOLINK INC. 0 0 1 0 1 ( ) cos( ) 2 i i         (10) Among them, 0 1 、 respectively represent the minimum and maximum weight values of inertia, 0 1[ ]   、 , 0 1i i、 respectively represent the current iteration number and the maximum allowed iteration number. The use of inertia weights to adjust particle travel speed has significant advantages in global search, but in the later stages of the algorithm, due to the decrease in particle speed, this weight control suppresses particle activity and makes it difficult to avoid falling back into local optima after escaping. The use of decreasing weight can improve the search efficiency of the algorithm to a certain extent, but the motion of particles has a certain degree of randomness and is susceptible to the influence of previous local optima. This strategy has significant hidden dangers. Based on the above reasons, the article intends to further improve the inertia weight value by using an adaptive weight setting strategy to enhance both global search ability and local search ability to improve algorithm performance. The relevant expression is as follows: 1 1 0 1 0 0 1 0 ( )( ) ' cos i i i                (11) Among them, ' is the current inertia weight value in the iteration; 0 1 、 respectively is the minimum and maximum weights of inertia, and 0 1i i、 respectively is the current iteration number and the maximum allowed iteration number. 3. Improved Particle Swarm Optimization Hybrid Algorithm 3.1 Quantum Particle Swarm Quantum particle swarm embodies the superposition state and probability expression characteristics in quantum theory (Ramesh & Haider, 2020). The combined effect of the two can make particles present more states, thereby improving the diversity of the population. Among them, probability expressions can express particles with a certain probability. This article sets the two fundamental states ^ 0 and ^ 1 of particles based on the probability of selection. In quantum particle swarm, particle quantization is the representation of each bit of a particle using quantum bits, which are represented as a and b. At the same time, this state can also be manifested as a mixed state, which is a linear combination of basic states, as follows: ^ ^ 1 20 1    (12) Among them, 1 2 、 is a complex number, that is, when the quantum state is ^ 0 , the probability is www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 7, No. 4, 2023 26 Published by SCHOLINK INC. 1|  2| ; When the state is ^ 1 , the probability is 2|  2| . The spatial expression of quantum states can evolve as follows: ^ ^ cos 0 sin 1    (13) Among them,  is the phase of the quantum state, which satisfies the equation: 2 1 arctan     . In this way, the quantized particles are placed in a quantum space represented by a wave function, where they can freely search for the optimal solution, and their state is not limited by velocity and position vectors. The corresponding wave function representing the particle state is as follows: 1pL dxdydz    (14) The iterative formula for particles obtained by converting quantum states using Monte Carlo algorithm: 1 1 l mb i i P P l    (15) (1 )mk ik gkP P P    (16) 1 ( 1) | ( ) | lnp ik mk pL t P a P L t     (17) In the above formula, iP is the current position of the particle, gbP is the global extreme value, mbP is the median optimal, l is the number of particles, mkP is the random point between ikP and gkP , a is the expansion and contraction factor, and is a quantitative index used to control the Rate of convergence of the algorithm. The random number between (0,1) is taken during iteration. If 0.5a  , the positive value is taken, otherwise the negative value is taken. 3.2 Aggregation Disturbance During the iteration process, due to the reduced speed of particles in the later stage and being constrained by local optima, the accuracy and convergence ability of the algorithm will significantly decrease when a certain local area is too clustered, making it easy to obtain local extremum (Yang, 2022). Therefore, a concept of particle aggregation perturbation is proposed in the article to regulate the phenomenon of local particles being too clustered. During iteration, particle perturbation is performed in areas with high crowding, increasing the activity of particles and breaking free from the constraints of local optima. Set a disturbance factor in the text, and the value of this factor should not be in static mode. When the weight value is small, it is beneficial for particles to escape from the aggregation region, and the search ability increases while the convergence ability decreases; When the weight value is large, the particle activity increases, the Rate of convergence is accelerated, and it is easy to quickly approach the local extreme value and fall into the local optimum. Therefore, this factor needs to be dynamic, and the www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 7, No. 4, 2023 27 Published by SCHOLINK INC. relevant expression is as follows: 0 0 2 1 1 1 1 log (1 )                          i i                 (18) Among them,  is the disturbance factor, 0 is the current disturbance factor value, and 1 is the maximum disturbance factor value. During the algorithm iteration process, the perturbation factor value gradually increases. When the aggregation degree of particles in a certain area reaches the threshold, the perturbation factor takes effect, and particles move within that area. At this time, the particle position needs to be recalculated, and the relevant expression is as follows: ' i iX r rnd X    (19) Among them, r is the activity radius of particle iX , [ 1,1]rnd   , and  is the disturbance factor. 3.3 Algorithm Analysis Introducing the K-means algorithm into the PSO algorithm, the basic idea is to use the K-means algorithm to calculate the clustering centers of each generation of particles to form a new particle swarm and obtain global extremum until the algorithm reaches the termination condition. This can effectively increase the activity of particles and avoid falling into local optima. At the same time, the introduction of K-means algorithm improves the overall convergence of the algorithm for fast convergence. The specific steps are as follows: Step 1: Initialize the particle swarm, set the total number of particles to n, and randomly select k particles as the clustering center, where k