A method for solving the design parameters of a tension / compression spring

By introducing individual communication operations into the cassia squirt algorithm, the design parameters of the stretching/compression spring are optimized, and the problem of low accuracy in the existing technology is solved, and a higher precision design parameter solution is achieved.

CN114936518BActive Publication Date: 2025-08-05WENZHOU UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210491595.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2025-08-05
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

The existing casket algorithm has low accuracy in solving the tensile/compression spring design parameters, making it difficult to find the global optimal solution.

Method used

The AC-type casket algorithm is used to increase the communication operations between individuals during the iteration process. By constructing the objective function and constraints, the tensile/compression spring design parameters are optimized to obtain the global optimal solution.

Benefits of technology

Improve the solution accuracy of the tensile/compression spring design parameters, find design parameters that are closer to ideal, and meet design requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114936518B_ABST
    Figure CN114936518B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for solving design parameters of a tension / compression spring. The method comprises the following steps: firstly determining the design parameters of the tension / compression spring to be solved; then constructing an objective function for solving the design parameters of the tension / compression spring based on the design purpose of the tension / compression spring, wherein the design purpose of the tension / compression spring is to minimize its weight; then determining the constraints of the design parameters of the tension / compression spring; finally, iteratively optimizing the design parameters of the tension / compression spring using an AC-type salp algorithm, and obtaining a global optimal solution as an output of the solved design parameters of the tension / compression spring, wherein the AC-type salp algorithm is obtained by adding communication operations between individuals in the iterative process of an existing salp algorithm; and the method has the advantage of high accuracy in solving the design parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for solving design parameters, in particular to a method for solving design parameters of a tension / compression spring. Background Art

[0002] Structural optimization is an important field related to both optimization and structural engineering. Tension / compression spring design, as a structural optimization process, involves many different design variables and highly nonlinear constraints. Finding the best possible design parameters based on the design objectives is crucial. The choice of design parameters for a tension / compression spring can impact the performance or objectives of the system in which it is applied.

[0003] Currently, the main methods for solving the design parameters of tension / compression springs include analytical methods, numerical calculation methods, and optimization algorithm estimation methods. Analytical methods are convenient for rapid solutions, but they rely on approximate solutions, which significantly reduces the accuracy of the solution. Numerical calculation methods primarily rely on randomly selecting initial values and observing their convergence. The accuracy of the solution not only depends on the choice of initial values but also decreases with the increase of design parameters. Optimization algorithm estimation methods are a new method for solving the design parameters of tension / compression springs. They are primarily iterative methods with parameter adjustment and have the advantages of simple operation, few constraints, strong robustness, and applicability to solving a variety of complex problems. However, most optimization algorithm estimation methods also have shortcomings such as slow convergence and susceptibility to local optimality. The Salp algorithm is a new evolutionary optimization algorithm for solving numerical optimization problems. After determining the optimization objective function and parameter range, the existing Salp algorithm uses a random trial-and-error method within a certain number of iterations to find the global optimal solution of the optimization objective, thereby obtaining the parameter-optimized solution. However, the existing Salp Intense algorithm still suffers from low accuracy in solving the design parameters of tension / compression springs. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a method for solving design parameters of a tension / compression spring with high design parameter solving accuracy.

[0005] The technical solution adopted by the present invention to solve the above technical problems is: a method for solving parameters in tension / compression spring design, comprising the following steps:

[0006] Step S1, determining the design parameters of the tension / compression spring to be solved;

[0007] Step S2: constructing an objective function for solving the design parameters of the tension / compression spring based on the design purpose of the tension / compression spring, wherein the design purpose of the tension / compression spring is to minimize its weight;

[0008] Step S3, determining the design parameter constraints of the tension / compression spring;

[0009] Step S4, using the AC-type salp algorithm to iteratively optimize the tension / compression spring design parameters to obtain a global optimal solution as the output of the solved tension / compression spring design parameters, wherein the AC-type salp algorithm is obtained by adding communication operations between individuals in the iterative process of the existing salp algorithm.

[0010] The design parameters of the tension / compression spring to be solved in step S1 are: the wire diameter d, the mean coil diameter D, and the number of active coils N.

[0011] The objective function constructed in step S2 is expressed as follows using formula (1):

[0012] f(d,D,N)=d 2 D(N+2) (1)

[0013] In formula (1), the value range of d is 0.05≤d≤2, the value range of D is 0.25≤D≤1.3, and the value range of N is 2≤N≤15.

[0014] The design parameter constraints of the tension / compression spring determined in step S3 are expressed using equations (2) to (5) as follows:

[0015]

[0016]

[0017]

[0018]

[0019] Among them, C1 represents the minimum deflection constraint of the tension / compression spring, C2 represents the shear constraint of the tension / compression spring, C3 represents the impact frequency constraint of the tension / compression spring, and C4 represents the outer diameter constraint of the tension / compression spring.

[0020] In step S4, the AC salp algorithm is used to iteratively optimize the design parameters of the tension / compression spring to obtain the global optimal solution as the output of the solved tension / compression spring design parameters. The specific process is:

[0021] Step S4.1: Initialize the parameters of the AC salp algorithm: set the population size popsize = 50, set the population dimension dim = 3, set the number of iterations variable t, set the maximum number of iterations max_t = 2000, set the variable p, set the variable count, set the lower bound lb = [lb1, lb2, lb3] = [0.05, 0.25, 2], lb1 is the lower limit (minimum value) of d, lb2 is the lower limit (minimum value) of D, lb3 is the lower limit (minimum value) of N, set the upper bound ub = [ub1, ub2, ub3] = [2, 1.3, 15], ub1 is the upper limit (maximum value) of d, ub2 is the upper limit (maximum value) of D, ub3 is the upper limit (maximum value) of N; initialize t, p and count respectively, and let p = 0, count = 0, and t = 0;

[0022] Step S4.2: Initialize the population using formula (6) to obtain the 0th generation population, which is denoted as X 0 , X 0 is a matrix of popsize rows and dim columns, X 0 The first column of data represents the parameters of d, the second column of data represents the parameters of D, and the third column of data represents the parameters of N. Each row of data is a solution to the design parameters of the tension / compression spring, also known as an individual. The i-th row of data is the i-th individual. 0 Substitute the three columns of data of each individual into formula (1) to obtain the objective function value of the corresponding individual, and then convert the obtained population X 0 The objective function value of each individual in XFitness is stored in XFitness, and the i-th objective function value in XFitness is recorded as XFitness i , XFitness i Corresponding to the 0th generation population X 0 The objective function value of the i-th individual, i = 1, 2, ..., popsize; determine the minimum objective function value in XFitness, record it as bestFitness, and take the individual corresponding to the minimum objective function value as the minimum individual, record it as bestSolution, and X 0 Copy to SaveX, XFitness to SaveXFitness:

[0023]

[0024] In formula (6), j = 1, 2, dim, represents the population X of generation 0 0The value of the jth column of the i-th individual in , rand represents a random number between 0 and 1 that obeys a uniform distribution. Before each calculation using formula (6), rand is first generated by a random function;

[0025] Step 4.3: First, update the value of t by adding 1 to the current value of t, and then perform the t-th iteration on the population to obtain the t-th generation population X t , the specific iterative process is:

[0026] Step S4.3.1: Substitute the current value of t into formula (7) to obtain c1, set the traversal variable current, and initialize current to 1;

[0027] Step S4.3.2: For the t-1 generation population X t-1 The current individual in the tth generation is traversed. At this time, two different integers are randomly selected from 1 to popsize, and these two integers are not equal to current. These two integers are randomly recorded as a and b. Then, whether current is less than or equal to popsize / 2 is determined first. If it is less than or equal to popsize / 2, a random number between 0 and 1 is randomly generated. Then, whether the random number is less than the current value of p is determined. If it is less than the current value of p, the tth generation population X is obtained using formula (8). t The current individual in the tth generation, otherwise use formula (9) to get the tth generation population X t The value of the current individual in the population; if the condition that current is less than or equal to popsize / 2 is not satisfied, then the formula (10) is used to obtain the t-th generation population X t The current individual in the

[0028]

[0029]

[0030]

[0031]

[0032] Among them, c2 and c3 are random numbers between 0 and 1. Before each calculation using formula (8), c2 and c3 are first generated using a random function. represents the t-th generation population X t The value of the jth column of the current individual in , represents the t-1 generation population X t-1 The value of the jth column of the current individual in bestSolution jRepresents the value of the jth column of the current minimum individual bestSolution; represents the t-1 generation population X t-1 The value of the jth column of the ath individual in , represents the t-1 generation population X t-1 The value of the jth column of the bth individual in , represents the t-1 generation population X t-1 The value of the jth column of the current-1th individual in ;

[0033] Step S4.3.3: Generate a random number between 0 and 1, and determine whether it is less than or equal to 1-t / max_t. If so, use Update SaveX current,j If not satisfied, keep SaveX current,j Unchanged, among which, SaveX current,j It is represented by the value of the jth column of the current individual in SaveX;

[0034] Step S4.3.4: Determine the t-th generation population X obtained in step S4.3.1 t Whether the value of each column in the current individual is within the range of its corresponding upper and lower limits, if it is within the range, it remains unchanged, if it is out of the range, then the absolute value of the difference between the value of the column and its upper limit and the absolute value of the difference between the value of the column and its lower limit are judged, if the absolute value of the difference between the value of the column and its upper limit is greater than the absolute value of the difference between the value of the column and its lower limit, then the value of the column is modified to be equal to its lower limit, otherwise, it is modified to be equal to its upper limit;

[0035] Step S4.3.5: Substitute the t-th generation population X obtained in step S4.3.4 t The three columns of data of the current individual are correspondingly brought into the four constraints of formula (2), formula (3), formula (4) and formula (5). If all four constraints are satisfied, the t-th generation population X t The three columns of data of the current individual are correspondingly brought into formula (1) to calculate its objective function value, and the calculated objective function value is used to update XFitness current If all four constraints cannot be met, then the current value of bestFitness is used to update XFitness. current ;

[0036] Step S4.3.6: XFitness current Make the following judgments and take corresponding actions based on the judgment results:

[0037] If XFitness currentThe current value of is less than SaveXFitness current The current value of XFitness current Update SaveXFitness with the current value of current , and adopt Update SaveX with the current value cuurrent Otherwise, use SaveX cuurrent The current value of

[0038] If XFitness current If the current value of is less than the current value of bestFitness, then Update the bestSolution using the current value of XFitness current Update bestFitness with the current value of count and update count with the quotient of the current value of count divided by 2. Otherwise, update count with the sum of the current value of count plus 1.

[0039] Step S4.3.7: Determine whether the current value of current is less than popsize. If so, update current by adding 1 to the current value of current, and return to step S4.3.2 to traverse the next individual. Otherwise, proceed to step S4.4.

[0040] Step S4.4: If the current value of count is greater than or equal to 10*popsize, set p to 0.8; otherwise, set it to 0. Determine whether the current value of t is equal to max_t. If not, return to step S4.3 for the next iteration. If it is, the current value of bestFitness is the global optimal solution, which is the solved design parameters of the tension / compression spring.

[0041] Compared to the prior art, the present invention has the advantage of improving the existing salp algorithm by adding an interoperation operation between individuals during its iteration process to obtain an interoperation-type salp algorithm. The interoperation-type salp algorithm is used to iteratively optimize the tension / compression spring design parameters, obtaining a global optimal solution as the output of the tension / compression spring design parameters. Because tension / compression spring design involves three parameters (the average coil diameter D, the wire diameter d, and the number of active coils N), each with its own range, the real number solution space involving these three parameters is very large. The addition of this interoperation operation allows promising solutions to be combined from existing solutions, thereby gradually finding the ideal parameter solution for the tension / compression spring design. Compared to the existing salp algorithm that relies entirely on random trial-and-error, the interoperation operation used in the interoperation-type salp algorithm is more likely to find a better solution, thereby achieving high accuracy in the final design parameter solution. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 This is a schematic diagram of the marking of three parameters involved in the tension / compression spring design parameter solution method of the present invention in the tension / compression spring. DETAILED DESCRIPTION

[0043] The present invention will be described in further detail below with reference to the accompanying drawings and embodiments.

[0044] Embodiment: A method for solving parameters in tension / compression spring design includes the following steps:

[0045] Step S1, determining the design parameters of the tension / compression spring to be solved;

[0046] Step S2: constructing an objective function for solving the design parameters of the tension / compression spring based on the design purpose of the tension / compression spring, wherein the design purpose of the tension / compression spring is to minimize its weight;

[0047] Step S3, determining the design parameter constraints of the tension / compression spring;

[0048] Step S4, using the AC-type salp algorithm to iteratively optimize the tension / compression spring design parameters to obtain a global optimal solution as the output of the solved tension / compression spring design parameters, wherein the AC-type salp algorithm is obtained by adding communication operations between individuals in the iterative process of the existing salp algorithm.

[0049] In this embodiment, Figure 1 As shown, the design parameters of the tension / compression spring to be solved in step S1 are: the wire diameter d, the mean coil diameter D, and the number of active coils N.

[0050] In this embodiment, the objective function constructed in step S2 is expressed using formula (1):

[0051] f(d,D,N)=d 2 D(N+2) (1)

[0052] In formula (1), the value range of d is 0.05≤d≤2, the value range of D is 0.25≤D≤1.3, and the value range of N is 2≤N≤15.

[0053] In this embodiment, the tension / compression spring design parameter constraints determined in step S3 are expressed using equations (2) to (5) as follows:

[0054]

[0055]

[0056]

[0057]

[0058] Among them, C1 represents the minimum deflection constraint of the tension / compression spring, C2 represents the shear constraint of the tension / compression spring, C3 represents the impact frequency constraint of the tension / compression spring, and C4 represents the outer diameter constraint of the tension / compression spring.

[0059] In this embodiment, the specific process of iteratively optimizing the design parameters of the tension / compression spring using the AC salp algorithm in step S4 to obtain the global optimal solution as the output of the solved tension / compression spring design parameters is as follows:

[0060] Step S4.1: Initialize the parameters of the AC salp algorithm: set the population size popsize = 50, set the population dimension dim = 3, set the number of iterations variable t, set the maximum number of iterations max_t = 2000, set the variable p, set the variable count, set the lower bound lb = [lb1, lb2, lb3] = [0.05, 0.25, 2], lb1 is the lower limit (minimum value) of d, lb2 is the lower limit (minimum value) of D, lb3 is the lower limit (minimum value) of N, set the upper bound ub = [ub1, ub2, ub3] = [2, 1.3, 15], ub1 is the upper limit (maximum value) of d, ub2 is the upper limit (maximum value) of D, ub3 is the upper limit (maximum value) of N; initialize t, p and count respectively, and let p = 0, count = 0, and t = 0;

[0061] Step S4.2: Initialize the population using formula (6) to obtain the 0th generation population, which is denoted as X 0 , X 0 is a matrix of popsize rows and dim columns, X 0 The first column of data represents the parameters of d, the second column of data represents the parameters of D, and the third column of data represents the parameters of N. Each row of data is a solution to the design parameters of the tension / compression spring, also known as an individual. The i-th row of data is the i-th individual. 0 Substitute the three columns of data of each individual into formula (1) to obtain the objective function value of the corresponding individual, and then convert the obtained population X 0 The objective function value of each individual in XFitness is stored in XFitness, and the i-th objective function value in XFitness is recorded as XFitness i , XFitness i Corresponding to the 0th generation population X0 The objective function value of the i-th individual, i = 1, 2, ..., popsize; determine the minimum objective function value in XFitness, record it as bestFitness, and take the individual corresponding to the minimum objective function value as the minimum individual, record it as bestSolution, and X 0 Copy to SaveX, XFitness to SaveXFitness:

[0062]

[0063] In formula (6), j = 1, 2, dim, represents the population X of generation 0 0 The value of the jth column of the i-th individual in , rand represents a random number between 0 and 1 that obeys a uniform distribution. Before each calculation using formula (6), rand is first generated by a random function;

[0064] Step 4.3: First, update the value of t by adding 1 to the current value of t, and then perform the t-th iteration on the population to obtain the t-th generation population X t , the specific iterative process is:

[0065] Step S4.3.1: Substitute the current value of t into formula (7) to obtain c1, set the traversal variable current, and initialize current to 1;

[0066] Step S4.3.2: For the t-1 generation population X t-1 The current individual in the tth generation is traversed. At this time, two different integers are randomly selected from 1 to popsize, and these two integers are not equal to current. These two integers are randomly recorded as a and b. Then, whether current is less than or equal to popsize / 2 is determined first. If it is less than or equal to popsize / 2, a random number between 0 and 1 is randomly generated. Then, whether the random number is less than the current value of p is determined. If it is less than the current value of p, the tth generation population X is obtained using formula (8). t The current individual in the tth generation, otherwise use formula (9) to get the tth generation population X t The value of the current individual in the population; if the condition that current is less than or equal to popsize / 2 is not satisfied, then the formula (10) is used to obtain the t-th generation population X t The current individual in the

[0067]

[0068]

[0069]

[0070]

[0071] Among them, c2 and c3 are random numbers between 0 and 1. Before each calculation using formula (8), c2 and c3 are first generated using a random function. represents the t-th generation population X t The value of the jth column of the current individual in , represents the t-1 generation population X t-1 The value of the jth column of the current individual in bestSolution j Represents the value of the jth column of the current minimum individual bestSolution; represents the t-1 generation population X t-1 The value of the jth column of the ath individual in , represents the t-1 generation population X t-1 The value of the jth column of the bth individual in , represents the t-1 generation population X t-1 The value of the jth column of the current-1th individual in ;

[0072] Step S4.3.3: Generate a random number between 0 and 1, and determine whether it is less than or equal to 1-t / max_t. If so, use Update SaveX current,j If not satisfied, keep SaveX current,j Unchanged, among which, SaveX current,j It is represented by the value of the jth column of the current individual in SaveX;

[0073] Step S4.3.4: Determine the t-th generation population X obtained in step S4.3.1 t Whether the value of each column in the current individual is within the range of its corresponding upper and lower limits, if it is within the range, it remains unchanged, if it is out of the range, then the absolute value of the difference between the value of the column and its upper limit and the absolute value of the difference between the value of the column and its lower limit are judged, if the absolute value of the difference between the value of the column and its upper limit is greater than the absolute value of the difference between the value of the column and its lower limit, then the value of the column is modified to be equal to its lower limit, otherwise, it is modified to be equal to its upper limit;

[0074] Step S4.3.5: Substitute the t-th generation population X obtained in step S4.3.4 tThe three columns of data of the current individual are correspondingly brought into the four constraints of formula (2), formula (3), formula (4) and formula (5). If all four constraints are satisfied, the t-th generation population X t The three columns of data of the current individual are correspondingly brought into formula (1) to calculate its objective function value, and the calculated objective function value is used to update XFitness current If all four constraints cannot be met, then the current value of bestFitness is used to update XFitness. current ;

[0075] Step S4.3.6: XFitness current Make the following judgments and take corresponding actions based on the judgment results:

[0076] If XFitness current The current value of is less than SaveXFitness current The current value of XFitness current Update SaveXFitness with the current value of current , and adopt Update SaveX with the current value current Otherwise, use SaveX current The current value of

[0077] If XFitness current If the current value of is less than the current value of bestFitness, then Update the bestSolution using the current value of XFitness current Update bestFitness with the current value of count and update count with the quotient of the current value of count divided by 2. Otherwise, update count with the sum of the current value of count plus 1.

[0078] Step S4.3.7: Determine whether the current value of current is less than popsize. If so, update current by adding 1 to the current value of current, and return to step S4.3.2 to traverse the next individual. Otherwise, proceed to step S4.4.

[0079] Step S4.4: If the current value of count is greater than or equal to 10*popsize, set p to 0.8; otherwise, set it to 0. Determine whether the current value of t is equal to max_t. If not, return to step S4.3 for the next iteration. If it is, the current value of bestFitness is the global optimal solution, which is the solved design parameters of the tension / compression spring.

[0080] The tension / compression spring design parameter solution method of the present invention was implemented using a Windows 10 operating system, 8GB of RAM, an Intel(R) Core(TM) i7-9700 CPU, and MATLAB R2018b software. The tension / compression spring design parameter solution method of the present invention and the existing Salp Intestine algorithm were then used to solve the tension / compression spring design parameters. The specific solution data are shown in Table 1:

[0081] Table 1.

[0082] method d D N Objective function value The present invention 0.051766599 0.358585825 11.18028561 0.01266535 Existing Salp Algorithms 0.051207 0.345215 12.004032 0.0126763

[0083] The first line in Table 1 shows the three parameters involved in the design of tension / compression springs (average coil diameter D, wire diameter d and number of effective coils N) and the weight of the tension / compression springs. The second line shows the solution and objective function value obtained by the method of the present invention. The third line shows the solution and objective function value obtained by the existing Salmonella algorithm. Analysis of the data in Table 1 shows that both methods can meet the value range of d, the value range of D, the value range of N and the four constraints involved in tension / compression springs. However, the objective function value of 0.01266535 obtained by the present invention is smaller than the objective function value of 0.0126763 obtained by the existing Salmonella algorithm. It can be seen that the accuracy of the present invention in solving the parameters involved in tension / compression springs is higher than that of the existing Salmonella algorithm.

Claims

1. A method for solving parameters in tension / compression spring design, characterized in that The following steps are involved: Step S1, determining the design parameters of the tension / compression spring to be solved; Step S2: constructing an objective function for solving the design parameters of the tension / compression spring based on the design purpose of the tension / compression spring, wherein the design purpose of the tension / compression spring is to minimize its weight; Step S3, determining the design parameter constraints of the tension / compression spring; Step S4, using an AC-type salp algorithm to iteratively optimize the tension / compression spring design parameters to obtain a global optimal solution as the output of the solved tension / compression spring design parameters, wherein the AC-type salp algorithm is obtained by adding a communication operation between individuals in the iterative process of the existing salp algorithm; The design parameters of the tension / compression spring to be solved in step S1 are: wire diameter d, average coil diameter D and number of effective coils N; The objective function constructed in step S2 is expressed as follows using formula (1): f(d,D,N)=d 2 D(N+2) (1) In formula (1), the value range of d is 0.05≤d≤2, the value range of D is 0.25≤D≤1.3, and the value range of N is 2≤N≤15; The design parameter constraints of the tension / compression spring determined in step S3 are expressed using equations (2) to (5) as follows: Wherein, C1 represents the minimum deflection constraint of the tension / compression spring, C2 represents the shear constraint of the tension / compression spring, C3 represents the impact frequency constraint of the tension / compression spring, and C4 represents the outer diameter constraint of the tension / compression spring. In step S4, the AC salp algorithm is used to iteratively optimize the design parameters of the tension / compression spring to obtain the global optimal solution as the output of the solved tension / compression spring design parameters. The specific process is: Step S4.1: Initialize the parameters of the AC-type salp algorithm: set the population size popsize = 50, set the population dimension dim = 3, set the number of iterations variable t, set the maximum number of iterations max_t = 2000, set the variable p, set the variable count, set the lower bound lb = [lb1, lb2, lb3] = [0.05, 0.25, 2], lb1 is the lower limit of d, lb2 is the lower limit of D, lb3 is the lower limit of N, set the upper bound ub = [ub1, ub2, ub3] = [2, 1.3, 15], ub1 is the upper limit of d, ub2 is the upper limit of D, and ub3 is the upper limit of N; initialize t, p, and count respectively, and set p = 0, count = 0, and t = 0; Step S4.2: Initialize the population using formula (6) to obtain the 0th generation population, which is denoted as X 0 , X 0 is a matrix of popsize rows and dim columns, X 0 The first column of data represents the parameters of d, the second column of data represents the parameters of D, and the third column of data represents the parameters of N. Each row of data is a solution to the design parameters of the tension / compression spring, also known as an individual. The i-th row of data is the i-th individual. 0 Substitute the three columns of data of each individual into formula (1) to obtain the objective function value of the corresponding individual, and then convert the obtained population X 0 The objective function value of each individual in XFitness is stored in XFitness, and the i-th objective function value in XFitness is recorded as XFitness i , XFitness i Corresponding to the 0th generation population X 0 The objective function value of the i-th individual, i = 1, 2, ..., popsize; determine the minimum objective function value in XFitness, record it as bestFitness, and take the individual corresponding to the minimum objective function value as the minimum individual, record it as bestSolution, and X 0 Copy to SaveX, XFitness to SaveXFitness: In formula (6), j = 1, 2, dim, represents the population X of generation 0 0 The value of the jth column of the i-th individual in , rand represents a random number between 0 and 1 that obeys a uniform distribution. Before each calculation using formula (6), rand is first generated by a random function; Step 4.3: First, update the value of t by adding 1 to the current value of t, and then perform the t-th iteration on the population to obtain the t-th generation population X t , the specific iterative process is: Step S4.3.1: Substitute the current value of t into formula (7) to obtain c1, set the traversal variable current, and initialize current to 1; Step S4.3.2: For the t-1 generation population X t-1 The current individual in the tth generation is traversed. At this time, two different integers are randomly selected from 1 to popsize, and these two integers are not equal to current. These two integers are randomly recorded as a and b. Then, whether current is less than or equal to popsize / 2 is determined first. If it is less than or equal to popsize / 2, a random number between 0 and 1 is randomly generated. Then, whether the random number is less than the current value of p is determined. If it is less than the current value of p, the tth generation population X is obtained using formula (8). t The current individual in the tth generation, otherwise use formula (9) to get the tth generation population X t The value of the current individual in the population; if the condition that current is less than or equal to popsize / 2 is not satisfied, then the formula (10) is used to obtain the t-th generation population X t The current individual in the Among them, c2 and c3 are random numbers between 0 and 1. Before each calculation using formula (8), c2 and c3 are first generated using a random function. represents the t-th generation population X t The value of the jth column of the current individual in , represents the t-1 generation population X t-1 The value of the jth column of the current individual in bestSolution j Represents the value of the jth column of the current minimum individual bestSolution; represents the t-1 generation population X t-1 The value of the jth column of the ath individual in , represents the t-1 generation population X t-1 The value of the jth column of the bth individual in , represents the t-1 generation population X t-1 The value of the jth column of the current-1th individual in ; Step S4.3.3: Generate a random number between 0 and 1, and determine whether it is less than or equal to 1-t / max_t. If so, use Update SaveX current,j If not satisfied, keep SaveX current,j Unchanged, among which, SaveX current,j It is represented by the value of the jth column of the current individual in SaveX; Step S4.3.4: Determine the t-th generation population X obtained in step S4.3.1 t Whether the value of each column in the current individual is within the range of its corresponding upper and lower limits, if it is within the range, it remains unchanged, if it is out of the range, then the absolute value of the difference between the value of the column and its upper limit and the absolute value of the difference between the value of the column and its lower limit are judged, if the absolute value of the difference between the value of the column and its upper limit is greater than the absolute value of the difference between the value of the column and its lower limit, then the value of the column is modified to be equal to its lower limit, otherwise, it is modified to be equal to its upper limit; Step S4.3.5: Substitute the t-th generation population X obtained in step S4.3.4 t The three columns of data of the current individual are correspondingly brought into the four constraints of formula (2), formula (3), formula (4) and formula (5). If all four constraints are satisfied, the t-th generation population X t The three columns of data of the current individual are correspondingly brought into formula (1) to calculate its objective function value, and the calculated objective function value is used to update XFitness current If all four constraints cannot be met, then the current value of bestFitness is used to update XFitness. current ; Step S4.3.6: XFitness current Make the following judgments and take corresponding actions based on the judgment results: If XFitness current The current value of is less than SaveXFitness current The current value of XFitness current Update SaveXFitness with the current value of current , and adopt Update SaveX with the current value current Otherwise, use SaveX current The current value of If XFitness current If the current value of is less than the current value of bestFitness, then Update the bestSolution using the current value of XFitness current Update bestFitness with the current value of count and update count with the quotient of the current value of count divided by 2. Otherwise, update count with the sum of the current value of count plus 1. Step S4.3.7: Determine whether the current value of current is less than popsize. If so, update current by adding 1 to the current value of current, and return to step S4.3.2 to traverse the next individual. Otherwise, proceed to step S4.

4. Step S4.4: If the current value of count is greater than or equal to 10*popsize, set p to 0.8; otherwise, set it to 0. Determine whether the current value of t is equal to max_t. If not, return to step S4.3 for the next iteration. If it is, the current value of bestFitness is the global optimal solution, which is the solved design parameters of the tension / compression spring.

Citation Information

Patent Citations

  • Stretching / compressing spring design method based on improved salp optimization algorithm

    CN113255146A