Ship molded line optimization method for calculating resistance based on dung beetle algorithm fused with random forest model
By introducing fitness sorting into the dung beetle algorithm and combining it with the random forest model to optimize the ship profile, the problems of contingency and high cost in the ship profile optimization results in the existing technology are solved, and a more efficient and accurate ship profile is achieved. optimization.
Patent Information
- Application Number
- CN202410690966.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-10-01
AI Technical Summary
Existing ship profile optimization methods rely on single-part profile changes and computational fluid dynamics technology, resulting in random results and high costs. Moreover, the calculation of resistance is cumbersome and time-consuming, making it difficult to effectively reduce the ship's navigation resistance.
Using a method based on the dung beetle algorithm fused with the random forest model, the dung beetle algorithm is optimized through the fitness ranking algorithm to optimize the ship resistance, improve calculation accuracy, reduce the amount of resistance calculation, and find the optimal shape line variation range.
It improves the calculation accuracy of the ship's minimum resistance, reduces the amount of resistance calculation, ensures the accuracy and efficiency of the ship profile optimization, avoids local optimal solutions, and achieves more efficient ship profile optimization.
Smart Images

Figure BDA0004868368610000051 
Figure BDA0004868368610000052 
Figure BDA0004868368610000101
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ship line optimization, and in particular to a ship line optimization method for calculating resistance based on a dung beetle algorithm combined with a random forest model. Background Art
[0002] Shipping is an essential component of global trade and economic development.
[0003] Ship speed refers to the ability of a ship to move at a higher speed given a power source. It is a key characteristic that directly affects the efficiency of a ship's operation. The performance of a ship is mainly determined by the type of ship and the effectiveness of its propulsion equipment, which directly affects the resistance to motion. There are two ways to increase a ship's speed: increasing propulsion efficiency and reducing ship resistance. With the same main engine power, propulsion efficiency and momentum, a ship with lower resistance will achieve a higher speed.
[0004] At the environmental level, shipping is also one of the main sources of global carbon emissions. With the growth of global trade and the widespread use of shipping, the scale of carbon emissions from shipping has increased year by year, which has an inevitable impact on climate change. Improving ship energy efficiency and reducing carbon emissions is imperative. It represents the energy efficiency of ships based on the ratio of CO2 emissions to cargo capacity. According to the EEXI conceptual formula and the research of relevant scholars, this index is closely related to the navigation resistance of ships. In summary, reducing the resistance of ships is the top priority of current ship optimization research.
[0005] Most of the current research is based on the change of a single part of the line, and only uses computational fluid dynamics (CFD) technology to calculate the resistance with specific changes in related parameters, which often leads to accidental and limited results. However, if all changes in parameters are considered, this will lead to a long design cycle and high calculation costs. A large number of ship samples will be generated during the ship optimization process, and the process of using CFD software to solve the hydrodynamic performance of the ship is cumbersome and time-consuming.
[0006] Based on this, the present invention designs a ship line optimization method for calculating resistance based on the dung beetle algorithm and the random forest model to solve the above problems. Summary of the invention
[0007] The technical problem to be solved by the present invention is to provide a method for optimizing the initial domain of the algorithm by introducing a fitness ranking method into the dung beetle algorithm, and using the improved algorithm to optimize the hyperparameters of the proxy model and the extreme value search of the entire model, thereby effectively improving the calculation accuracy of the minimum resistance of the ship, reducing the amount of resistance calculation, and clearly obtaining a ship line optimization method based on the calculation of resistance by combining the dung beetle algorithm with a random forest model.
[0008] The technical problem to be solved by the present invention is achieved through the following technical solution: a ship line optimization method for calculating resistance based on a dung beetle algorithm and a random forest model, collecting ship surface variable data, optimizing the random forest proxy model with the dung beetle algorithm to calculate the ship resistance, and finding the optimal line variation range under the minimum resistance, characterized in that the method comprises the following steps:
[0009] (1) Collect ship parameters, obtain deformation parameters of the ship’s profile and surface, and synthesize a data set;
[0010] (2) Introduce the fitness ranking algorithm, update and improve the dung beetle algorithm process, expand the search space, and quickly find the most suitable model value, so that the value found in each iteration process is close to the global optimal value;
[0011] (3) By updating the algorithm and using the collected data, the hyperparameters of the random forest proxy model are optimized to improve the accuracy of the model, so that the proxy model can replace the traditional hydrodynamic calculation of ship navigation resistance;
[0012] (4) By updating the algorithm, the proxy model is optimized and the minimum ship sailing resistance calculated by the model is continuously updated through iteration until the maximum number of iterations is reached, and then the update is stopped, and finally the minimum sailing resistance at time t is obtained;
[0013] (5) Based on the resistance calculated by the proxy model, reversely calculate the optimization parameters of the ship line, update the ship optimization variable parameters, and determine the optimization plan.
[0014] After collecting the variable data of ship surface, the fitness sorting algorithm is first introduced to improve the dung beetle algorithm. The maximum number of iterations is used as the initial sample number, and values are randomly selected from the feasible range, sorted and selected, and iterated from the initial optimal solution position to ensure that the initial solution is close to the global optimal solution. The sorting algorithm is inserted in the activity interval of each generation of dung beetles, so that each iteration result is the optimal solution under the current behavior; then the improved dung beetle algorithm is used to optimize the hyperparameters of the random forest proxy model, and the optimal hyperparameters under the data set are adapted to ensure that it can replace the traditional hydrodynamic calculation of ship resistance and further improve the resistance prediction accuracy of the model; finally, the algorithm is used to optimize the proxy model as a whole, find the optimal line variation range under the minimum resistance, determine the specific variation range of the ship line, and give a line optimization plan.
[0015] As a further solution of the present invention, the specific steps of step (1) are to pre-process the extracted information and extract relevant parameters.
[0016] As a further solution of the present invention, the specific steps of step (2) are as follows:
[0017] (1-1) In the initialization phase, the maximum number of iterations is taken as the initial sample number, and values are randomly selected from the feasible range, sorted, and then iterated from the initial optimal solution position to ensure that the initial solution is close to the global optimal solution. The sorting algorithm is inserted in each activity interval so that each iteration result is the optimal solution under the current behavior;
[0018] (1-2) Dung beetles need to use natural clues to navigate during the rolling process; the intensity of the light source will affect the path of the dung beetle. Δx is used to simulate the light intensity to control the search range of the dung beetle and update the position x of the dung beetle. i (t+1):
[0019] x i (t+1)=x i (t)+α*k*x i (t-1)+b*Δx
[0020] Δx=|x i (t)-X w |
[0021] In the above formula, t represents the current number of iterations, x i (t) represents the position information of the i-th dung beetle at the t-th iteration, k∈(0,0.2] represents a constant, which represents the deflection coefficient, b represents a constant belonging to (0,1), α is a natural coefficient, assigned to -1 or 1, X w represents the global worst position;
[0022] (1-3) When the dung beetle encounters an obstacle during the ball rolling process, it will adjust its direction by dancing, and propose a boundary selection strategy to simulate the egg-laying area B i (t), according to step (1-2), the current local optimal position x i (t), dynamically generate upper and lower limits [Lb * ,Ub * ], control the spawning area, update the location information of dung beetle eggs x i (t+1):
[0023] B i (t+1)=X * +b1*(B i (t)-Lb * )+b2*(B i (t)-Ub * )
[0024] In the above formula, B i (t) is the position information of the i-th egg at the n-th iteration, b1 and b2 represent two independent random vectors of size 1×D, and D represents the dimension of the optimization problem;
[0025] (1-4) According to the location of the eggs selected in step (1-3), as the eggs hatch, the second generation of dung beetles will drill out to find food. The optimal foraging area sampling boundary selection strategy uses the global optimal point to dynamically generate the area, generating upper and lower limits [Lb b ,Ub b ], update the second generation dung beetle location information x i (t+1):
[0026] x i (t+1)=x i (t)+C1*(x i (t)-Lb b )+C2*(x i (t)-Ub b )
[0027] In the above formula, x i (t) represents the position information of the second-generation dung beetle of the i-th generation at the n-th iteration, C1 represents a random number that obeys the normal distribution, and C2 represents a random vector belonging to (0,1);
[0028] (1-5) Select a small number of dung beetles as thieves and update the selected optimal value x in step (1-4) i (t) Further search for the best position x i (t+1);
[0029] x i (t+1)=X b +S*g*(|x i (t)-X * |+|x i (t)-X b |)
[0030] In the above formula, x i (t) represents the position information of the i-th thief dung beetle at the n-th iteration, g is a random vector of size 1×D, which obeys the normal distribution, and S represents a constant;
[0031] (1-6) Repeat steps (1-2)-(1-5), and perform step (1) at the end of each step to ensure that the overall algorithm can quickly find the most appropriate value.
[0032] Based on the initialization of the traditional random forest proxy model, an optimized dung beetle algorithm was introduced, and all dung beetles were divided into four groups: rolling balls, hatching, offspring, and thieves. The setting of natural light sources ensured sufficient search space and egg-laying areas. The dynamic update of the area promoted the expansion of the algorithm search area to avoid falling into the local optimum. The quick sorting algorithm was used to sort the rolling activities of each generation of dung beetles in the dung beetle algorithm to ensure the selection of the optimal value in each iteration process. The hyperparameters of the random forest model were optimally selected for the data set through the improved algorithm, especially the number of forests and the number of iteration layers in the random forest. The optimal model initialization was adaptively performed according to different data sets to ensure that the model could replace the traditional hydrodynamic calculation of the ship's navigation resistance. The algorithm was used to optimize the overall model to find the optimal change in the ship's line under the minimum resistance.
[0033] As a further solution of the present invention, the specific steps of step (3) are as follows:
[0034] (2-1) K-fold cross-dividing the data set, randomly selecting N samples, and independently building a decision tree based on each sub-data set as the sample at the root node of the decision tree;
[0035] (2-2) Select data samples where each sample has M attributes, take out m attributes through random extraction strategy, and select one of them as the splitting attribute of the node through information gain;
[0036] (2-3) Repeat (2-2) to continuously create decision trees until they cannot be split;
[0037] (2-4) Repeat (2-2)-(2-3) to build a large number of decision trees, construct a random forest, use the average method, regress the model prediction value, and calculate the relevant fitting accuracy;
[0038] (2-5) By improving the dung beetle algorithm, the hyperparameters of the random forest proxy model are set, that is, the number of random forests and the number of layers are used as optimization variables, and the MSE and R 2 To optimize the target, we optimize to meet the following requirements:
[0039] MSE=E(θ-μ) 2
[0040]
[0041] In the above formula, θ is the predicted value, μ is the true value, and α is the calculated average value;
[0042] (2-6) The hyperparameter variable values are continuously updated through iteration until the maximum number of iterations is reached, then the update is stopped to obtain the optimal hyperparameter value at time t to ensure the prediction accuracy of the model.
[0043] As a further solution of the present invention, the data set E satisfies:
[0044]
[0045] Divide the entire sample set into K sample subsets of equal size, traverse the K subsets, and each time use the current subset as the validation set and all other samples as the training set to train and evaluate the model.
[0046] As a further solution of the present invention, the specific steps of step (4) are as follows:
[0047] (3-1) The output value of the optimized random forest is used as the optimization target of the optimization function, the surface deformation of the ship line is used as the optimization parameter, and the ship displacement is used as the constraint condition to meet the following requirements:
[0048] F(x)=min f(x)
[0049] x∈A
[0050] In the above formula, f(x) is the predicted value of the random forest output, x is the set of deformation parameters of the ship surface, and A is the specific deformable range;
[0051] (3-2) embedding the improved dung beetle algorithm into the optimization function to search for the optimal target;
[0052] (3-3) The optimal value is continuously updated through iteration until the maximum number of iterations is reached, and the update is stopped to obtain the minimum resistance of the ship predicted by the random forest at time t.
[0053] As a further solution of the present invention, the specific steps of step (5) are as follows:
[0054] (4-1) According to the optimal prediction value of the proxy model obtained in step (3-3), the minimum resistance of the ship is R t , compared with traditional CFD calculations to verify accuracy;
[0055] (4-2) Based on the calculated minimum resistance, the ship line deformation parameters are reversely calculated, including the bulbous bow, the side outer plates of the inlet and outlet sections and the parallel center body, to determine the overall ship line optimization plan.
[0056] The beneficial effects of the present invention are:
[0057] The present invention provides a ship line optimization method for calculating resistance based on the dung beetle algorithm and the random forest model. As the latest swarm intelligence algorithm, the dung beetle algorithm can well expand the search space compared with the traditional intelligent optimization algorithm, and the fitness sorting algorithm introduced can ensure that in the initial stage, the local optimal solution is close to the global optimal solution, ensuring that the subsequent entire optimization process avoids falling into the local optimum. The improved algorithm is added to the prediction of the proxy model, which further improves the accuracy of the proxy model and greatly reduces the amount of calculation of the ship resistance. Through the integrated algorithm, the correctness of the ship resistance calculation is effectively guaranteed to a certain extent, and the foundation is laid for the optimization of the ship line. The improved intelligent algorithm can also be used to find the optimal value of the ship line, and can find the optimization scheme of the line under the minimum resistance of the ship's navigation.
[0058] Based on the initialization of the traditional random forest proxy model, an optimized dung beetle algorithm was introduced, and all dung beetles were divided into four groups: rolling balls, hatching, offspring, and thieves. The setting of natural light sources ensured sufficient search space and egg-laying areas. The dynamic update of the area promoted the expansion of the algorithm search area to avoid falling into the local optimum. The quick sorting algorithm was used to sort the rolling activities of each generation of dung beetles in the dung beetle algorithm to ensure the selection of the optimal value in each iteration process. The hyperparameters of the random forest model were optimally selected for the data set through the improved algorithm, especially the number of forests and the number of iteration layers in the random forest. The optimal model initialization was adaptively performed according to different data sets to ensure that the model could replace the traditional hydrodynamic calculation of the ship's navigation resistance. The algorithm was used to optimize the overall model to find the optimal change in the ship's line under the minimum resistance. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a flowchart of the program of the present invention;
[0060] Figure 2 The flowchart of the dung beetle algorithm improved by the fitness ranking algorithm of the present invention;
[0061] Figure 3 Predicting resistance map for the proxy model of the present invention;
[0062] Figure 4 It is the MSE and R2 three-dimensional mapping diagram of the present invention;
[0063] Figure 5 It is an algorithm optimization graph of the present invention;
[0064] Figure 6 This is a flow chart of the optimal solution of the present invention. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below through embodiments and in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0066] The serial numbers of the components herein, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings). In the description of the present invention, it should be understood that the orientation or positional relationship indicated by the terms "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", etc. are based on the orientation or positional relationship shown in the accompanying drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation to the present invention.
[0067] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0068] like Figures 1 to 6 As shown, a ship line optimization method for calculating resistance based on a dung beetle algorithm fused with a random forest model (DBO-RF) collects ship surface variable data, uses the dung beetle algorithm to optimize the random forest proxy model to calculate ship resistance, and finds the optimal line variation range under minimum resistance. The method includes the following steps:
[0069] (1) Collect ship parameters, obtain deformation parameters of the ship’s profile and surface, and synthesize a data set;
[0070] Specifically, the dung beetle algorithm model is used to sample and collect the surface deformation data of the ship and the relevant resistance conditions. The collected data is cleaned to remove duplicate values, missing values and outliers, and processed using relevant data cleaning tools or programming languages to ensure the integrity and accuracy of the data. According to relevant requirements, the data is converted and processed, and appropriate features are selected for analysis. Through standardization and normalization, the sampled data sets are integrated and processed according to the training requirements of the subsequent model.
[0071] (2) Introduce the fitness ranking algorithm, update and improve the dung beetle algorithm process, expand the search space, and quickly find the most suitable model value, so that the value found in each iteration process is close to the global optimal value;
[0072] Specifically, Figure 2 As shown, the dung beetle algorithm improved by the fitness sorting algorithm includes the following steps:
[0073] (1-1) In the initialization phase, the maximum number of iterations is taken as the initial sample number, and values are randomly selected from the feasible range, sorted, and then iterated from the initial optimal solution position to ensure that the initial solution is close to the global optimal solution. The sorting algorithm is inserted in each activity interval so that each iteration result is the optimal solution under the current behavior;
[0074] The sampling cross-validation method divides the data set into several small problems, recursively solves each small problem, and finally combines them to obtain a new data set.
[0075] (1-2) Dung beetles need to use natural clues to navigate during the rolling process; the intensity of the light source will affect the path of the dung beetle. Δx is used to simulate the light intensity to control the search range of the dung beetle and update the position x of the dung beetle. i (t+1):
[0076] x i (t+1)=x i (t)+α*k*x i (t-1)+b*Δx
[0077] Δx=|x i (t)-X w |
[0078] In the above formula, t represents the current number of iterations, x i (t) represents the position information of the i-th dung beetle at the t-th iteration, k∈(0,0.2] represents a constant, which represents the deflection coefficient, b represents a constant belonging to (0,1), a is a natural coefficient, assigned to -1 or 1, X w represents the global worst position;
[0079] Specifically, the search range of the dung beetle controls the calculation process of the overall algorithm. In this example, according to the actual movement of the dung beetle, simulated light Δx is used for control. Using the sklearn.metrics library in Python, k is set to a random number to ensure the sufficiency of the dung beetle in each search process. b is set to 0.3, and a is a dynamically updated value. When the fitness calculated by the overall algorithm is less than 0.1, the value of a is set to 1, otherwise it is -1. By dynamically setting the control range, the search space can be further expanded.
[0080] (1-3) When the dung beetle encounters an obstacle during the ball rolling process, it will adjust its direction by dancing, and propose a boundary selection strategy to simulate the egg-laying area B i (t), according to step (1-2), the current local optimal position x i (t), dynamically generate upper and lower limits [Lb * ,Ub * ], control the spawning area, update the location information of dung beetle eggs x i (t+1):
[0081] B i (t+1)=X * +b1*(B i (t)-Lb * )+b2*(B i (t)-Ub * )
[0082] In the above formula, B i (t) is the position information of the i-th egg at the n-th iteration, b1 and b2 represent two independent random vectors of size 1×D, and D represents the dimension of the optimization problem;
[0083] Specifically, there are a total of 7 ship line characteristic parameters collected in this example, so b1 and b2 are represented as independent random vectors of 1*7. By calling numpy and sklearn databases, the division of random numbers can meet the requirements, ensuring the continuous updating of individual positions in the population. The number of dung beetles performing rolling ball march is set to 30% of the total population.
[0084] (1-4) According to the location of the eggs selected in step (1-3), as the eggs hatch, the second generation of dung beetles will drill out to find food. The optimal foraging area sampling boundary selection strategy uses the global optimal point to dynamically generate the area, generating upper and lower limits [Lb b ,Ub b ], update the second generation dung beetle location information x i (t+1):
[0085] x i (t+1)=x i(t)+C1*(x i (t)-Lb b )+C2*(x i (t)-Ub b )
[0086] In the above formula, x i (t) represents the position information of the second-generation dung beetle of the i-th generation at the n-th iteration, C1 represents a random number that obeys the normal distribution, and C2 represents a random vector belonging to (0,1);
[0087] Specifically, Lb b and Lb b The two upper and lower bounds represent the adjusted values of the lower and upper bounds of each optimization parameter in the reproduction behavior of dung beetles. A "disturbance" range is determined based on the current global optimal solution and a dynamically adjusted ratio, and then a new solution is generated. In this example, R is introduced as the disturbance:
[0088]
[0089] In the above formula, MAX_Ite is the maximum number of iterations.
[0090] By introducing disturbances, the boundary values are the current optimal fitness solution position multiplied by 1 plus or minus the disturbance. In this way, the upper and lower bounds of each iteration can be dynamically updated. At the same time, in order to ensure that the extreme values jump out of the range during the calculation process, the restrictions on dynamic boundaries are also applied synchronously. For the parameter values of the 7 dimensions of the calculation process, the calculated boundaries are called by the sklearn.metrics library, and the clip function is used to limit the activity range of the boundaries, ensuring that the overall algorithm avoids falling into local optimality.
[0091] The number of dung beetles used for reproduction and foraging is set to 30% of the total population.
[0092] (1-5) Select a small number of dung beetles as thieves and update the selected optimal value x in step (1-4) i (t) Further search for the best position x i (t+1);
[0093] x i (t+1)X b +S*g*(|x i (t)-X * |+|x i (t)-X b |)
[0094] In the above formula, x i(t) represents the position information of the i-th thief dung beetle at the n-th iteration, g is a random vector of size 1×D, which obeys the normal distribution, and S represents a constant;
[0095] Specifically, when dung beetles find the current best position according to (1-2)-(1-4), a small group will split out from the population to engage in "stealing" behavior. The dung beetle individual that finds the extreme position will have its extreme value stolen by the nearby dung beetle population, and further in-depth search will be carried out, avoiding the possibility of falling into the extreme value.
[0096] The number of dung beetles that engage in theft is set to 10% of the total population.
[0097] (1-6) Repeat steps (1-2)-(1-5), and perform step (1) at the end of each step to ensure that the overall algorithm can quickly find the most suitable value;
[0098] Specifically, inserting the fitness sorting algorithm into the four behaviors of dung beetles, namely, ball rolling, reproduction, foraging, and stealing, can quickly find the global best position and ensure that the extreme value point found each time is the optimal value of the current iteration.
[0099] (3) By updating the algorithm and using the collected data, the hyperparameters of the random forest proxy model are optimized to improve the accuracy of the model, so that the proxy model can replace the traditional hydrodynamic calculation of the ship's navigation resistance. The specific steps are as follows:
[0100] (2-1) K-fold cross-dividing the data set, randomly selecting N samples, and independently building a decision tree based on each sub-data set as the sample at the root node of the decision tree;
[0101] Specifically, the entire sample set is divided into 10 sample subsets of equal size, and the 10 subsets are traversed. Each time, the current subset is used as the validation set, and all other samples are used as the training set to train and evaluate the model.
[0102] (2-2) Select data samples where each sample has M attributes, take out m attributes through random extraction strategy, and select one of them as the splitting attribute of the node through information gain;
[0103] (2-3) Repeat (2-2) to continuously create decision trees until they cannot be split;
[0104] (2-4) Repeat (2-2)-(2-3) to build a large number of decision trees, construct a random forest, use the average method, regress the model prediction value, and calculate the relevant fitting accuracy;
[0105] Specifically, the model accuracy is expressed as MSE and R 2To indicate that these two parameters can well represent the current model's ability to generalize the entire data set. By using Python code and the RandomForestRegressor library in PyChram's sklearn.ensemble, the idea of random forest can be well coded.
[0106] The simulation score of the model is recorded using the r2_score of sklearn.metrics, which will be used for subsequent hyperparameter optimization of the dung beetle algorithm.
[0107] (2-5) By improving the dung beetle algorithm, the hyperparameters of the random forest proxy model are set, that is, the number of random forests and the number of layers are used as optimization variables, and the MSE and R 2 To optimize the target, we optimize to meet the following requirements:
[0108] MSE=E(θ-μ) 2
[0109]
[0110] In the above formula, θ is the predicted value, μ is the true value, and α is the calculated average value;
[0111] The data set E satisfies:
[0112]
[0113] Divide the entire sample set into K sample subsets of equal size, traverse the K subsets, and each time use the current subset as the validation set and all other samples as the training set to train and evaluate the model.
[0114] Specifically, by setting the total dung beetle population to 30, setting the number of optimized parameters to 2, that is, the number of forests and layers of the random forest, and setting their respective upper and lower bounds to [1,200], [1,30]. To obtain the optimal MSE and R 2 For the specific goal, we search for the random forest hyperparameters that give the best model accuracy.
[0115] (2-6) The hyperparameter variable values are continuously updated through iteration until the maximum number of iterations is reached, then the update is stopped to obtain the optimal hyperparameter value at time t to ensure the prediction accuracy of the model.
[0116] Specifically, the maximum number of iterations of the algorithm is set to 100, and the optimal parameters are searched. After the maximum number of iterations, the optimal number of forests is 89, the number of layers is 11, and the overall fitting accuracy is good. At this time, MSE and R 2 The values are 0.1573 and 0.9461, and the model predicts Figure 3 As shown, the MSE and R of the overall model are2 like Figure 4 shown.
[0117] (4) By updating the algorithm, the proxy model is optimized, and the minimum ship navigation resistance calculated by the model is continuously updated through iteration until the maximum number of iterations is reached, and the update is stopped, and finally the minimum navigation resistance at time t is obtained; the specific steps are as follows:
[0118] (3-1) The output value of the optimized random forest is used as the optimization target of the optimization function, the surface deformation of the ship line is used as the optimization parameter, and the ship displacement is used as the constraint condition to meet the following requirements:
[0119] F(x)=min f(x)
[0120] x∈A
[0121] In the above formula, f(x) is the predicted value of the random forest output, x is the set of deformation parameters of the ship surface, and A is the specific deformable range;
[0122] Specifically, the ship resistance is divided into wave resistance and viscous resistance, and the output prediction value of the random forest is the total resistance, which satisfies:
[0123] R t =R w +R v
[0124] In the above formula, R t is the total resistance, R w is the wave resistance, R v is the viscous resistance.
[0125] There are 7 parameters for ship surface deformation, which respectively control the height, length and convexity of the bulbous bow; the change of the side outer plate line of the inlet section; the length of the parallel midbody; and the fullness of the tail line.
[0126] The respective deformation ranges are set according to the shipbuilding manual issued by the shipowner and the shipbuilding association's ship variable range table.
[0127] (3-2) embedding the improved dung beetle algorithm into the optimization function to search for the optimal target;
[0128] (3-3) The optimal value is continuously updated through iteration until the maximum number of iterations is reached, and the update is stopped to obtain the minimum resistance of the ship predicted by the random forest at time t.
[0129] Specifically, for optimal accuracy and speed, the population of dung beetles was set to 100, the maximum number of iterations was 600, and the optimal position was found in 246 iterations, as shown in Figure 5 shown.
[0130] (5) According to the resistance calculated by the proxy model, reversely calculate the optimization parameters of the ship line, update the ship optimization variable parameters, and determine the optimization plan. The specific steps are as follows:
[0131] (4-1) According to the optimal prediction value of the proxy model obtained in step (3-3), the minimum resistance of the ship is R t , compared with traditional CFD calculations to verify accuracy;
[0132] Specifically, the resistance of the ship model calculated by the proxy model is 33.7341N, while the resistance calculated by the CFD software is 33.4153N, with a calculation error rate of 0.95%, verifying the high accuracy of the random forest proxy model.
[0133] (4-2) Based on the calculated minimum resistance, the ship line deformation parameters are reversely calculated, including the bulbous bow, the side outer plates of the inlet and outlet sections and the parallel center body, to determine the overall ship line optimization plan.
[0134] Specifically, the ship line optimization parameter scheme deduced from the optimal minimum resistance has been verified to have significantly reduced resistance, providing a new solution for improving the speed of ships.
[0135] In summary, with the help of the above-mentioned technical solution of the present invention, the proxy model is trained by the data set after data processing, and is improved according to the swarm intelligence algorithm to find the values of the hyperparameters of the proxy model, so as to ensure that the accuracy of the model is further improved, and the improved optimization algorithm is used to optimize the minimum ship resistance, which greatly improves the rapidity of ship optimization and ensures the refinement of optimization. The ship line optimization scheme obtained by the present invention also proves the accuracy of the invention of this method.
[0136] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0137] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A ship line optimization method for calculating resistance based on dung beetle algorithm and random forest model, collecting ship surface variable data, optimizing the random forest proxy model with dung beetle algorithm to calculate ship resistance, and finding the optimal line variation range under minimum resistance, characterized in that: The method comprises the following steps: (1) Collect ship parameters, obtain deformation parameters of the ship’s profile and surface, and synthesize a data set; (2) Introduce the fitness ranking algorithm, update and improve the dung beetle algorithm process, expand the search space, and quickly find the most suitable model value, so that the value found in each iteration process is close to the global optimal value; (3) By updating the algorithm and using the collected data, the hyperparameters of the random forest proxy model are optimized to improve the accuracy of the model, so that the proxy model can replace the traditional hydrodynamic calculation of ship navigation resistance; (4) By updating the algorithm, the proxy model is optimized and the minimum ship sailing resistance calculated by the model is continuously updated through iteration until the maximum number of iterations is reached, and then the update is stopped, and finally the minimum sailing resistance at time t is obtained; (5) Based on the resistance calculated by the proxy model, reversely calculate the optimization parameters of the ship line, update the ship optimization variable parameters, and determine the optimization plan.
2. A ship line optimization method for calculating resistance based on dung beetle algorithm and random forest model, characterized in that: The specific steps of step (1) are to preprocess the extracted information and extract relevant parameters.
3. The ship line optimization method based on dung beetle algorithm and random forest model for calculating resistance according to claim 1, characterized in that: The specific steps of step (2) are as follows: (1-1) In the initialization phase, the maximum number of iterations is taken as the initial sample number, and values are randomly selected from the feasible range, sorted, and then iterated from the initial optimal solution position to ensure that the initial solution is close to the global optimal solution. The sorting algorithm is inserted in each activity interval so that each iteration result is the optimal solution under the current behavior; (1-2) Dung beetles need to use natural clues to navigate during the rolling process; the intensity of the light source will affect the path of the dung beetle. Δx is used to simulate the light intensity to control the search range of the dung beetle and update the position x of the dung beetle. i (t+1): x i (t+1)=x i (t)+α*k*x i (t-1)+b*Δx Δx=|x i (t)-X w | In the above formula, t represents the current number of iterations, x i (t) represents the position information of the i-th dung beetle at the t-th iteration, k∈(0, 0.2] represents a constant, which represents the deflection coefficient, b represents a constant belonging to (0, 1), a is a natural coefficient, assigned to -1 or 1, X w represents the global worst position; (1-3) When the dung beetle encounters an obstacle during the ball rolling process, it will adjust its direction by dancing, and proposes a boundary selection strategy to simulate the egg-laying area B i (t), according to step (1-2), the current local optimal position x i (t), dynamically generate upper and lower limits [Lb * , Ub * ], control the spawning area, update the location information of dung beetle eggs x i (t+1): B i (t+1)=X * +b1*(B i (t)-Lb * )+b2*(B i (t)-Ub * ) In the above formula, B i (t) is the position information of the i-th egg at the n-th iteration, b1 and b2 represent two independent random vectors of size 1×D, and D represents the dimension of the optimization problem; (1-4) According to the location of the eggs selected in step (1-3), as the eggs hatch, the second generation of dung beetles will drill out to find food. The optimal foraging area sampling boundary selection strategy uses the global optimal point to dynamically generate the area, generating upper and lower limits [Lb b , Ub b ], update the second generation dung beetle location information x i (t+1): x i (t+1)=x i (t)+C1*(x i (t)-Lb b )+C2*(x i (t)-Ub b ) In the above formula, x i (t) represents the position information of the second-generation dung beetle of the i-th generation at the n-th iteration, C1 represents a random number that obeys the normal distribution, and C2 represents a random vector belonging to (0, 1); (1-5) Select a small number of dung beetles as thieves and update the selected optimal value x in step (1-4) i (t) Further search for the best position x i (t+1); x i (t+1)=X b +S*g*(|x i (t)-X * |+|x i (t)-X b |) In the above formula, x i (t) represents the position information of the i-th thief dung beetle at the n-th iteration, g is a random vector of size 1×D, which obeys the normal distribution, and S represents a constant; (1-6) Repeat steps (1-2)-(1-5), and perform step (1) at the end of each step to ensure that the overall algorithm can quickly find the most appropriate value.
