Method for predicting mechanical properties of composite material based on improved sparrow algorithm-random forest
By improving the CFSSA-RF model combining sparrow algorithm with random forests, the difficulty in detecting mechanical properties caused by void defects in the manufacturing process of carbon fiber composites is solved, efficient and accurate mechanical properties prediction is achieved, cost and time is reduced, and it is suitable for process production and thermal coupling analysis of composite materials.
Patent Information
- Application Number
- CN202510163741.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-07-11
AI Technical Summary
In the prior art, carbon fiber composite materials are prone to void defects during the manufacturing process, resulting in high cost of detection of mechanical properties and long time, and a long time for finite element simulation analysis, making it difficult to effectively predict its mechanical properties under different porosities, pore positions, temperatures and mechanical types.
Using a CFSSA-RF model combining improved sparrow algorithm with random forests, the number of decision trees and minimum leaf points is optimized through multi-scale finite element modeling, and a prediction model is constructed to predict the mechanical properties of carbon fiber composites.
It improves the accuracy and efficiency of mechanical properties prediction, reduces detection costs, shortens analysis time, has good data processing capabilities and overfitting resistance, and is highly adaptable. It is suitable for process production and thermal coupling analysis of carbon fiber composite materials.
Smart Images

Figure CN120297015A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of composite material performance prediction, and particularly to a method for predicting the mechanical properties of composite materials based on an improved sparrow algorithm - random forest. Background Technique
[0002] Due to the advantages of lightweight, high strength, corrosion resistance, and design flexibility, carbon fiber composites are widely used in technical fields such as aerospace, construction, and electronics. However, the void defects generated during the manufacturing process of composite materials will directly affect the basic mechanical properties of carbon fiber reinforced polymers (CFRPs), resulting in weakened impact resistance. The voids in composite materials, also known as pores, are caused by the incomplete expulsion of air when resin materials and fiber materials are mixed. They can be regarded as the third component of composite materials in addition to fibers and the matrix, which will reduce the load-bearing capacity and fatigue performance of the materials, increase the brittleness and fracture risk of carbon fiber composites.
[0003] Resin transfer molding (RTM) is a closed-mold composite manufacturing process. It mainly places fiber-reinforced materials in the cavity of a closed mold in advance, and then injects liquid resin into the mold under pressure to fully impregnate the fiber materials. Finally, a composite product is obtained through curing. The automated fiber placement (AFP) technology precisely places continuous fiber bundles (such as carbon fibers, etc.) on the mold surface or mandrel according to a predetermined path and angle through automated equipment; if prepreg fibers are used, a composite component is formed after processes such as curing after placement; if dry fibers are used, subsequent processes such as resin impregnation and curing are required after placement. These two methods are common CFRP manufacturing methods. However, if resin entraps air when injected into the mold with pre-placed fibers, and insufficient pressure is not applied in time during resin heating and curing, void defects will inevitably occur in most cases during the preparation of composite materials. In the RTM processing technology, due to factors such as the complexity of mold structure design, the non-uniformity of fiber preforms, and the difficulty of process parameter control, it is impossible to ensure the resin flow path, resulting in incomplete resin penetration; at the same time, if process conditions such as temperature and time are not properly controlled, the resin may solidify during the flow process, resulting in voids during the flow process. In addition, during the curing process, the volume of the resin expands and contracts due to the alternation of hot and cold, resulting in void defects. During the implementation of the AFP technology, the gaps between fiber tows may cause void defects.
[0004] The above preparation processes may all lead to the generation of voids. Therefore, before carbon fiber composites are applied to structural components in the aerospace field, multiple rounds of material property tests are required, such as mechanical properties, thermal stability, corrosion resistance, and even comprehensive tests of multiple factors. Due to the existence of voids in carbon fiber composites, there is a certain gap between the manufacturing properties and theoretical properties of CFRP. In addition, temperature (high temperature or low temperature) will also affect the microstructural changes in the matrix phase of the composite material, and then affect the mechanical properties of the overall composite material. If the combined effect of temperature and pores is further considered, these effects may be further aggravated.
[0005] Due to the high cost and long time consumption of testing the properties of carbon fiber composites, a multi-scale finite element simulation method that can judge the damage of fibers and matrix at the microscale has been proposed for the mechanical property simulation of carbon fiber composites in domestic and foreign research. According to this multi-scale method, the representative volume element (RVE) of CFRP has been studied, and the relationships between the six elastic properties of CFRP, void defects, and fiber volume fraction have been obtained. By using the six elastic properties of CFRP as the material properties of the overall composite material, the tensile and compressive characteristics of the CFRP macroscale model containing void defects can be further analyzed, as well as the relationships between each characteristic parameter and the void defect content. Although the finite element method based on numerical simulation has greatly reduced the testing cost and research time, the finite element simulation analysis process still takes a long time. Summary of the Invention
[0006] Technical problems to be solved: Aiming at the technical problems existing in the finite element simulation analysis process in the background technology, the present invention provides a method for predicting the mechanical properties of composites based on an improved sparrow algorithm - random forest. The finite element method is used to carry out multi-scale modeling, and the improved sparrow algorithm is combined with the random forest to construct a fusion CFSSA-RF prediction model, so as to effectively predict the mechanical properties of carbon fiber composites under different porosities (0-10%), pore positions (matrix / carbon fiber), temperatures (25°C / 150°C / -150°C), and mechanical types (tensile / compressive).
[0007] Technical solution: A method for predicting the mechanical properties of composites based on an improved sparrow algorithm - random forest according to the present invention, the prediction method includes the following steps: Step 1: Perform scale simulation in the finite element multi-scale simulation of carbon fiber composites, construct RVE models containing carbon fiber defects and matrix defects respectively, and obtain the elastic constant matrix of the RVE models. Step 2: Connect the elastic constant matrix material to the macroscopic model for macroscopic simulation to obtain the simulation data of the carbon fiber composite material as sample data; the sample data consists of several groups of data composed of porosity, void position, working temperature, mechanical type, mechanical strength, and mechanical modulus; shuffle the sample data and divide it into a training set and a test set at a ratio of 75%:25%, using the porosity, void position, working temperature, and mechanical type of the carbon fiber composite material as inputs, and the mechanical strength and mechanical modulus as outputs; Step 3: Use the TreeBagger function in Matlab software to construct a random forest RF model; Step 4: Improve the sparrow search algorithm and introduce the random forest RF model. Use the sparrow search algorithm to optimize and update the number of decision trees and the minimum number of leaf nodes parameters in the random forest RF model. The position of each sparrow is regarded as a combination encoding of the number of decision trees and the number of minimum leaves in the random forest RF model, and construct a CFSSA-SF prediction model with high accuracy; Step 5: Use the training set data in Step 2 to train the CFSSA-SF prediction model, repeat the update rule in Step 4, update the position of each sparrow, obtain the number of decision trees and the minimum number of leaves in the random forest RF model, and determine whether the set maximum number of iterations is reached; if so, select the number of decision trees and the minimum number of leaves in the random forest RF model corresponding to the sparrow position with the highest fitness value as the final optimization result; if not, repeat the update rule in Step 4 until the final optimization result is obtained; Step 6: Input the test set data in Step 2 into the CFSSA-SF prediction model trained in Step 5 to obtain the predicted data result.
[0008] Preferably, the specific construction method of the RVE model in Step 1: Step 11: Observe the unidirectional carbon fiber composite material under a microscope and analyze the microstructure of the carbon fiber composite material. In this microstructure, the columnar carbon fiber materials are arranged in the same direction, and the epoxy resin material is filled in the gaps between the carbon fiber materials, and then construct an RVE unit cell model with a representative volume element; Step 12: Use the built-in programming module of the finite element software COMSOL to write an algorithm for the random distribution of porosity of the composite material, introduce porosity into the RVE unit cell model, and set the volume of a single small pore to 0.000125mm 3 , and construct RVE models containing carbon fiber defects and matrix defects respectively; Step 13: Set the material parameters and boundary conditions of carbon fiber and epoxy resin for the RVE model, including unit periodic analysis and different temperature environment settings.
[0009] Preferably, the specific steps of the macroscopic simulation in Step 2 are as follows: Step 21: Reconstruct a three-dimensional model as the macroscopic model of the carbon fiber composite material, link the elastic constant matrix material in Step 1 to the macroscopic model material settings, and set the boundary conditions for the macroscopic model; Step 22: Set the macroscopic simulation steady-state solver, add parametric scans of tensile and compressive loads, and use the maximum tensile and compressive failure loads obtained from the mechanical experiments as the simulation parameter scan data. Simulate the Von mises stress under the failure load, and the Von mises stress under this failure load can be regarded as the strength limit.
[0010] Preferably, in Step 22, add a probe for the maximum value of the Von mises stress and a first principal strain probe to the gauge section of the macroscopic model, and set parametric scans in the simulation model to calculate the modulus of the carbon fiber composite material. The calculation formula is as follows: (1); Formula (1) represents the relationship between the corresponding stress change Δσ / MPa, the dimensionless unit strain change Δε, and the modulus Et / GPa, and their ratio is within the longitudinal strain range of 0.001 - 0.003.
[0011] Preferably, in Step 22, according to the maximum tensile or compressive failure load obtained from the mechanical experiments, set parametric scans in the simulation model to calculate the Von mises stress of the carbon fiber composite material. The calculation formula is: (2); Formula (2) represents the relationship between the maximum failure load, the specimen thickness, the specimen width, and the stress σ t / MPa; P max is the magnitude of the maximum failure load applied during tension or compression / N; W is the width of the specimen gauge section / mm; h is the thickness of the specimen gauge section / mm.
[0012] Preferably, the specific construction method of the random forest RF model in Step 3 is as follows: Step 31: Import data from the.xlsx file through the readmatrix function, divide the data into feature variables X n and target variable Y and perform normalization processing, while retaining the relevant normalization parameters; Step 32: Use the rng() function to fix the random number seed and shuffle the sample group. The random number sequence generated by the RF model each time the program runs is the same, facilitating the repetition and comparison of prediction results. Set the number of decision trees and the minimum number of leaves, and use the TreeBagger function to construct the random forest model net. Use the reverse function to perform inverse normalization processing on the prediction results.
[0013] Preferably, the sparrow search algorithm in step 4 is proposed inspired by the foraging behavior and anti-predation behavior of sparrows. Virtual sparrows are used to search for food in the prediction model. The population X composed of n sparrows is shown in the following formula: (3); In formula (3), d is the dimension of the variable of the problem to be optimized; n is the number of sparrows, and each sparrow represents a set of sample data; Step 41: The Cubic chaotic mapping formula is as follows: (4); In formula (4), p is the set control parameter; i = 1, 2, 3, …, pop - 1, pop is the population size, and j = 1, 2, …, d; In the population initialization stage, abandon the completely random initialization method. First, randomly generate the position of the first sparrow in each dimension, that is, x 1,j is the position information of the first sparrow in the j-th dimension, and then the remaining sparrows i = 2, 3, …, pop use the Cubic chaotic mapping formula to generate the initial position x i,j , j = 1, 2, …, d: (5); Then map the positions obtained by the chaotic mapping into the set search space [lb, ub] to obtain the initial state of the population X , ensuring that the positions of the initialized population are within a reasonable range; (6); In formula (6), i = 1, 2, 3, …, pop, j = 1, 2, …, d; lb is the lower limit parameter of the space, and ub is the upper limit parameter of the space; In addition, the fitness values of all sparrows are shown in the following formula: (7); In formula (7), f is the fitness value of a single sparrow, and the fitness value is the mean square error MSE of the training set and the test set; is the root mean square error of the training set, is the mean square error of the test set; it is shown in the following formula: (8); Step 42: The position of the discoverer is updated as shown in the following formula: (9); In formula (9), t is the current number of iterations; j = 1, 2, 3, …, d ; item max is the maximum iteration coefficient, and is a constant; x i,j represents the position information of the i th sparrow in the j th dimension; a ∈ (0, 1] is a random number; R2 and ST are the early warning value and the safety value respectively, R2 ∈ [0, 1], ST ∈ [0.5, 1]; Q is a random number subject to a normal distribution; L is a 1*d matrix, and each element in this matrix is 1; When , an update method including exponential decay is adopted to make the position update have a spiral convergence trend; When , the position is updated by adding a term related to the random number Q and the all-1 matrix L to increase the randomness and exploration of the position update; Step 43: The position update of the joiner is described as shown in the following formula: (10); In formula (10), x p is the optimal position occupied by the current discoverer, x worst is the current global worst position; A is a 1*d matrix, and each element is randomly assigned 1 or -1, and A + = A T (AA T ) -1 ; Step 44: The position update of the vigilant is as shown in the following formula: (11); In formula (11), is the current global optimal position; is used as the step size control parameter, is a random number subject to a normal distribution with a mean of 0 and a variance of 1; K is a random number, K ∈ [-1, 1]; f i is the fitness value of the current sparrow individual, f g , f w are the current global best and worst fitness values respectively; is a constant and avoids a zero denominator.
[0014] Preferably, after the finite element simulation in step 2 is completed, the training set in the simulation data is used as sample data and input into the CFSSA-RF prediction model obtained in step 5. Each set of data includes the porosity, pore location, temperature, mechanical type, mechanical strength, and mechanical modulus of the carbon fiber composite material. The porosity, pore location, temperature, and mechanical type are used as inputs, and the mechanical strength and mechanical modulus are used as outputs.
[0015] Preferably, the total number of sample data obtained in step 2 is 84 groups, and the ratio of the training set to the test set is divided into 75%:25%; The divided training set data is input into the CFSSA-RF model constructed in step 4 for training, and the improved sparrow optimization algorithm in step 4 is used for automatic iteration to search for the optimal number of decision trees and the minimum number of leaves obtained, and the CFSSA-RF model for subsequent prediction is obtained.
[0016] Preferably, the RMSE, R 2 and MAE evaluation indexes of the training set and the test set calculated in steps 5 and 6 are used, and a comparison chart of the prediction results of the training set and the test set is drawn.
[0017] Compared with the prior art, the present invention has at least the following beneficial effects.
[0018] 1. The present invention innovatively proposes a random forest model (CFSSA-RF) based on an improved sparrow optimization algorithm for predicting the mechanical properties of carbon fiber composite materials. To improve the regression prediction accuracy of random forest data, the sparrow search algorithm inspired by the foraging behavior and anti-predation behavior of sparrows is introduced into the random forest model to optimize the parameters of the number of decision trees and the minimum number of leaf points in the random forest. The position of each sparrow can actually be regarded as a combination encoding of the number of decision trees and the minimum number of leaves in the random forest model. The sparrow optimization algorithm is improved. First, Cubic chaotic mapping is used in the population initialization stage to improve the diversity of the population and enhance the global search ability; second, an adaptive spiral change strategy for updating the position of the discoverer is added; third, an anti-predation behavior mechanism is added during the iteration process to optimize the convergence of the algorithm and the ability to jump out of the local optimum; finally, the optimization result is combined with the random forest model. The CFSSA-RF prediction model has the advantages of convenient operation, high prediction accuracy and efficiency, accurate prediction results, and low economic cost, providing a technical basis for the reliability prediction research of carbon fiber composite materials in the process of process manufacturing, finite element modeling, and thermal-mechanical coupling analysis, saving a large amount of experimental time and economic cost.
[0019] 2. As an ensemble model, the random forest makes predictions by constructing multiple decision trees and integrating their results. It has good data processing capabilities, strong anti-overfitting capabilities, and stable prediction capabilities for small sample group data. The number of decision trees and the minimum number of leaf nodes are two important parameters. The number of decision trees refers to the quantity of decision trees included when constructing the random forest. A larger number of decision trees is beneficial for improving the accuracy of the model, but it will also increase the computational cost and training time. Too few decision trees may lead to insufficient generalization ability of the model. The minimum number of leaf nodes is a parameter used to control the growth of decision trees. It stipulates the minimum number of samples contained in the leaf nodes during the splitting process of decision trees. Setting this parameter can prevent decision trees from overgrowing and avoid overfitting.
[0020] 3. The sparrow search algorithm is proposed inspired by the foraging behavior and anti-predation behavior of sparrows. Three roles of virtual sparrows, namely discoverers, joiners, and guards, are defined in the prediction model to achieve effective search in the problem space. That is, the sparrow search algorithm is used to optimize the number of decision trees and the minimum number of leaf nodes parameters in the random forest. The position of each sparrow can actually be regarded as a combined coding of the number of decision trees and the number of minimum leaf nodes in the random forest model. Combining the sparrow algorithm with the random forest organically can enhance the adaptability and generalization ability of the model and improve the anti-overfitting ability of the model.
[0021] 4. The present invention uses the finite element method to carry out multi-scale modeling, improves the sparrow algorithm and combines it with the random forest to construct a fusion CFSSA-RF prediction model, and then effectively predicts the mechanical properties of carbon fiber composite materials under different porosities (0~10%), pore positions (matrix / carbon fiber), temperatures (25°C / 150°C / -150°C), and mechanical types (tension / compression). BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a schematic diagram of the construction process of the CFSSA-RF prediction model of the present invention; Figure 2 It is a schematic diagram of the comparison process of the prediction results between the CFSSA-RF prediction model of the present invention and the random forest RF model and the double-hidden layer BP neural network model; Figure 3 It is the RVE model constructed by the present invention ((a) Simplified RVE model without pores; (b) Algorithm for randomly distributing porosities). Figure 4 It is the RVE model constructed by the present invention containing carbon fiber defects and matrix defects respectively ((a) Void distribution in the matrix; (b) Void distribution in the carbon fiber). Figure 5The material parameters of carbon fiber and epoxy resin are set in the RVE model of the present invention ((a) unit periodic condition setting; (b) external thermal field environment setting); Figure 6 The elastic constant matrix material of the present invention is connected to the macro model for macro simulation; Figure 7 For the present invention, mechanical boundary conditions are set and simulated for the macro model ((a) tension; (b) compression); Figure 8 The macroscopic simulation results of the present invention ((a) modulus calculated according to the strain-stress curve data (slope value); (b) tensile stress Von Mises cloud diagram of the tensile model under the failure load; (c) tensile stress of the compression model under the failure load Von mises Cloud Atlas); Figure 9 The flowchart of the improved sparrow optimization algorithm of the present invention; Figure 10 It is a schematic diagram of the CFSSA-RF prediction model of the present invention; Figure 11 This is a comparison chart of the prediction results of the tensile modulus training set and the test set of the RF model; Figure 12 This is a comparison chart of the prediction results of the tensile modulus training set and the test set of the BP-ANN model; Figure 13 This is a comparison chart of the prediction results of the tensile modulus training set and the test set of the CFSSA-RF model; Figure 14 This is a comparison chart of the prediction results of the tensile stress training set and the test set of the RF model; Figure 15 This is a comparison chart of the prediction results of the tensile stress training set and the test set of the BP-ANN model; Figure 16 Comparison of the prediction results of the tensile stress training set and test set of the CFSSA-RF model. DETAILED DESCRIPTION
[0023] To make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the following will be combined with the attached Figures 1 to 16 The technical solutions of the embodiments of the present invention are described clearly and completely. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the described embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0024] like Figures 1 to 2 As shown, the present invention discloses a method for predicting the mechanical properties of composite materials based on an improved sparrow algorithm-random forest, and the prediction method comprises the following steps: (1) Perform scale simulations in the finite element multi-scale simulation of carbon fiber composites, construct RVE models containing carbon fiber defects and matrix defects respectively, and obtain the elastic constant matrix of the RVE models. The specific construction method of the RVE models is as follows: (I) Observe the unidirectional carbon fiber composite under a microscope, analyze the microstructure of the carbon fiber composite. In this microstructure, the columnar carbon fiber materials are arranged in the same direction, and the epoxy resin material is filled in the gaps between the carbon fiber materials. Then construct the RVE unit cell model with a representative volume element. Figure 3 (a) is the simplified RVE ideal model of this composite material, which is a unit cell structure of the carbon fiber composite and is called the representative volume element. Among them, the carbon fiber is composed of a middle cylinder and a quarter cylinder around it, and the epoxy resin is filled in other areas.
[0025] (II) Use the built-in programming module of the finite element software COMSOL to write the random distribution algorithm of the porosity of the composite material, introduce the porosity into the RVE unit cell model, and set the volume of a single small pore to 0.000125mm 3 , and construct RVE models containing carbon fiber defects and matrix defects respectively. Figure 3 (b) is the JAVE algorithm for the random distribution of pores in the RVE position, presented to Figure 4 (a) shows the case where the pores are distributed in the matrix, Figure 4 (b) shows the case where the pores are distributed in the carbon fiber.
[0026] (III) Set the material parameters and boundary conditions of the carbon fiber and epoxy resin for the RVE models, including unit periodic analysis and different temperature environment settings (as Figure 5 shown).
[0027] (2) Connect the elastic constant matrix material to the macroscopic model for macroscopic simulation, and obtain the simulation data of the carbon fiber composite as sample data. The sample data consists of several groups of data composed of porosity, void position, working temperature, mechanical type, mechanical strength, and mechanical modulus. Shuffle the sample data and divide it into a training set and a test set at a ratio of 75%:25%. Use the porosity, void position, working temperature, and mechanical type of the carbon fiber composite as inputs, and use the mechanical strength and mechanical modulus as outputs. The specific steps of the macroscopic simulation are as follows: (I) Reconstruct a three-dimensional model as the macroscopic model of the carbon fiber composite. The size of this model refers to relevant national standards, as Figure 6 shown. Connect the obtained elastic constant matrix material to the material settings of the macroscopic model, and set the boundary conditions for the macroscopic model (as Figure 7 shown).
[0028] (II) Set up a macroscopic simulation steady-state solver, add parametric scans for tensile and compressive load parameters, and use the maximum tensile and compressive failure loads obtained from mechanical experiments as the simulation parameter scan data. Simulate the Von mises stress under the failure load, and the Von mises stress under this failure load can be regarded as the strength limit.
[0029] (III) Add a maximum probe for Von mises stress and a first principal strain probe in the gauge section of the macroscopic model, and set parametric scans in the simulation model to calculate the modulus of the carbon fiber composite material. The calculation formula is as follows: (1); Equation (1) represents the relationship between the corresponding stress change Δσ / MPa, the dimensionless strain change Δε, and the modulus Et / GPa (as shown in Figure 8 (a)), and the ratio is within the longitudinal strain range of 0.001 - 0.003.
[0030] (IV) According to the maximum tensile or compressive failure load obtained from mechanical experiments, set parametric scans in the simulation model to calculate the Von mises stress nephogram of the carbon fiber composite material. The Von mises stress under the failure load can be approximately regarded as the strength limit (as shown in Figure 8 (b) and Figure 8 (c)), and its calculation formula is: (2); Equation (2) represents the relationship between the maximum failure load, the specimen thickness, the specimen width, and the stress σ t / MPa; P max is the magnitude of the maximum failure load applied during tensile or compressive loading / N; W is the width of the specimen gauge section / mm; h is the thickness of the specimen gauge section / mm.
[0031] (III) Use the TreeBagger function in Matlab software to construct a random forest RF model. The specific construction method of the random forest RF model is as follows: (I) Import data from the.xlsx file through the readmatrix function, divide the data into feature variables X n and target variable Y and perform normalization processing, while retaining the relevant normalization parameters.
[0032] (II) Use the rng() function to fix the random number seed and shuffle the sample group. The random number sequence generated by the RF model each time the program runs is the same to facilitate the repetition and comparison of prediction results; set the number of decision trees and the minimum number of leaves, use the TreeBagger function to construct the random forest model net, and perform anti-normalization processing on the prediction results through the reverse function.
[0033] (4) Improve the sparrow search algorithm and introduce the random forest RF model. Use the sparrow search algorithm to optimize and update the number of decision trees and the minimum number of leaf nodes in the random forest RF model. The position of each sparrow is regarded as a combination encoding of the number of decision trees and the minimum number of leaves in the random forest RF model, and a CFSSA-SF prediction model with high accuracy is constructed.
[0034] Figure 9 This is the flowchart of the improved sparrow optimization algorithm of the present invention. First, perform population initialization settings. Calculate the fitness values and sort them according to the numerical size. Update the positions of the three types of sparrow roles, and then sort the fitness values after the position update. After iterative determination, output the position of the sparrow with the highest fitness. Figure 10 This is the schematic diagram of the CFSSA-RF prediction model. The working method is that the random forest model determines the optimal number of decision trees and the minimum number of leaves through the sparrow optimization algorithm. Finally, run the model, count the prediction results of all decision trees for the same group of samples, and take the average of all results as the final prediction value.
[0035] The improved sparrow search algorithm of the present invention is proposed inspired by the foraging behavior and anti-predation behavior of sparrows. Virtual sparrows are used to search for food in the prediction model. The population X composed of n sparrows is shown in the following formula: (3); In formula (3), d is the dimension of the variable to be optimized; n is the number of sparrows, and each sparrow represents a set of sample data.
[0036] (I) The Cubic chaotic mapping formula is as follows: (4); In formula (4), p is the set control parameter; i = 1, 2, 3,..., pop - 1, pop is the population size, and j = 1, 2,..., d.
[0037] In the population initialization stage, abandon the completely random initialization method. First, randomly generate the position of the first sparrow in each dimension, that is, x 1,j is the position information of the first sparrow in the j-th dimension. Then, for the remaining sparrows i = 2, 3,..., pop, use the Cubic chaotic mapping formula to generate the initial position x i,j , j = 1, 2,..., d: (5).
[0038] Then map the positions obtained through chaotic mapping into the set search space [lb, ub] to obtain the initial state of the population X , to ensure that the positions of the initialized population are within a reasonable range; (6); In formula (6), i = 1, 2, 3, …, pop, j = 1, 2, …, d; lb is the lower bound parameter of the space, and ub is the upper bound parameter of the space.
[0039] In addition, the fitness values of all sparrows are shown as follows: (7); In formula (7), f is the fitness value of a single sparrow, and the fitness value is the mean square error MSE of the training set and the test set; is the root mean square error of the training set, is the mean square error of the test set; it is shown as follows: (8).
[0040] (II) The position update of the discoverer is shown as follows: (9); In formula (9), t is the current iteration number; j = 1, 2, 3, …, d ; item max is the maximum iteration coefficient, and is a constant; x i,j represents the i th sparrow at the j th dimension of the position information; a ∈ (0, 1] is a random number; R2 and ST are the early warning value and the safety value respectively, R2 ∈ [0, 1], ST ∈ [0.5, 1]; Q is a random number subject to a normal distribution; L is a 1*d matrix, and each element in this matrix is 1. This formula (9) describes the update rule of the discoverer's position under different conditions, reflecting the adaptive spiral change strategy. When , an update method including exponential decay is adopted, so that the position update has a spiral convergence trend; when , the position is updated by adding a term related to the random number Q and the all-1 matrix L to increase the randomness and exploratory nature of the position update.
[0041] (III) The position update of the joiner is described as follows: (10); In formula (10), x p is the optimal position occupied by the current discoverer, x worst is the current global worst position; A is a 1*d matrix, and each element in it is randomly assigned 1 or -1, and A += A T (AA T ) -1 。
[0042] (IV) The position of the vigilant is updated as shown in the following formula: (11); In formula (11), is the current global optimal position; As a step size control parameter, is a random number obeying a normal distribution with a mean of 0 and a variance of 1; K is a random number, K ∈ [-1, 1]; f i is the fitness value of the current sparrow individual, f g , f w are the current global best and worst fitness values respectively; is a constant and avoids a zero denominator. This formula (11) demonstrates the improvement of the overall anti-predation behavior mechanism through the fitness-based position update rule and the parameters involved, which helps the algorithm better balance exploration and exploitation during the search process, improve the search efficiency and avoid falling into local optima.
[0043] (V) Use the training set data to train the CFSSA-SF prediction model, repeat the update rule of the improved sparrow search algorithm to update the position of each sparrow, obtain the number of decision trees and the minimum number of leaves in the random forest RF model (where i in the sparrow position is the number of decision trees and j is the minimum number of leaves), and determine whether the set maximum number of iterations is reached; if so, select the number of decision trees and the minimum number of leaves in the random forest RF model corresponding to the sparrow position with the highest fitness value as the final optimization result; if not, repeat the update rule of the improved sparrow search algorithm until the final optimization result is obtained.
[0044] (6) After the finite element simulation is completed, the test set data in the simulation data (partially shown) in Table 1 is input into the trained CFSSA-SF prediction model. Each group of data includes the porosity of the carbon fiber composite material, the pore position (1 for pores in the matrix, 2 for pores in the carbon fiber), the temperature (25°C / 150°C / -150°C), the mechanical type (1 for tension, 2 for compression), the mechanical strength (including compression and tension), and the mechanical modulus (including compression and tension). The porosity, pore position, temperature, and mechanical type are used as inputs, and the mechanical strength and mechanical modulus are used as outputs to obtain the predicted data results. In a specific embodiment, a total of 84 groups of sample data are obtained from the simulation, and the ratio of the training set to the test set is 75%:25%; the divided training set data is input into the constructed CFSSA-RF model for training, and the improved sparrow optimization algorithm is used to automatically iterate to search for the optimal number of decision trees and the minimum number of leaves obtained, and the CFSSA-RF model for subsequent prediction is obtained.
[0045] Table 1 Finite element simulation sample data (partially shown) used by three prediction models RF / BP-ANN / CFSSA-RF:
[0046] 。
[0047] (7) In order to evaluate the prediction effect of the CFSSA-RF prediction model on the mechanical properties of the composite material, compare it with the prediction effects of the traditional random forest model RF and the BP neural network model, and calculate and compare the goodness of fit R 2 in different models, the mean absolute error MAE, and the root mean square error RMSE. Their calculation formulas are as follows: (12); (13); (14); (15); In formulas (12) to (15), is the predicted value of the training set or the test set; is the true value of the training set or the test set; is the average true value of the training set or the test set; m is the number of sample groups corresponding to the training set or the test set. Among them, the closer R 2 is to 1, and the smaller the MAE and RMSE, the better the prediction effect.
[0048] Figures 11 to 13 is the comparison chart of the prediction results of the RF / BP-ANN / CFSSA-RF prediction model for the tensile modulus training set and the test set of the same shuffled group, Figures 14 to 16Figure for the comparison of the prediction results of the RF / BP-ANN / CFSSA-RF prediction model for the tensile stress training set and test set of the same shuffled group; from Figures 11 to 16 it can be seen that the CFSSA-RF prediction model shows better prediction accuracy than the RF model and the BP neural network.
[0049] Table 2 shows the comparison of R 2 , MAE, and RMSE of the RF / BP-ANN / CFSSA-RF prediction model for the tensile modulus training set and test set of the same shuffled group. Among them, the training set R 2 and the test set R 2 of the CFSSA-RF prediction model are 0.94867 and 0.94517 respectively, showing better fitting than the RF / BP-ANN prediction model; the training set MAE and RMSE of the CFSSA-RF prediction model are 0.0473 and 0.0734 respectively, and the test set MAE and RMSE are 0.0431 and 0.0658 respectively, both of which are smaller than the RF / BP-ANN prediction model.
[0050] Table 2 Comparison of R 2 , MAE, and RMSE of the RF / BP-ANN / CFSSA-RF prediction model for the tensile modulus training set and test set of the same shuffled group: .
[0051] Table 3 shows the comparison of R2, MAE, and RMSE of the RF / BP-ANN / CFSSA-RF prediction model for the tensile stress training set and test set of the same shuffled group. Among them, the training set R 2 and the test set R 2 of the CFSSA-RF prediction model are 0.98039 and 0.97694 respectively, showing better fitting than the RF / BP-ANN prediction model; the training set MAE and RMSE of the CFSSA-RF prediction model are 47.965 and 8.394, and the test set MAE and RMSE are 59.258 and 30.174 respectively, both of which are smaller than the RF / BP-ANN prediction model. The above data show that the CFSSA-RF prediction model shows good prediction results for the mechanical property prediction of composite materials.
[0052] Table 3 Comparison of R 2 , MAE, and RMSE of the RF / BP-ANN / CFSSA-RF prediction model for the tensile stress training set and test set of the same shuffled group: .
[0053] The above are the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A mechanical property prediction method for composite materials based on an improved sparrow algorithm - random forest, characterized in that, The prediction method includes the following steps: Step 1: Conduct scale simulation in the finite element multi-scale simulation of carbon fiber composite materials, construct RVE models containing carbon fiber defects and matrix defects respectively, and obtain the elastic constant matrix of the RVE models; Step 2: Connect the elastic constant matrix material to the macroscopic model for macroscopic simulation, and obtain the simulation data of the carbon fiber composite material as sample data; the sample data consists of several groups of data composed of porosity, void position, working temperature, mechanical type, mechanical strength, and mechanical modulus; shuffle the sample data and divide it into a training set and a test set at a ratio of 75%:25%. Take the porosity, void position, working temperature, and mechanical type of the carbon fiber composite material as inputs, and take the mechanical strength and mechanical modulus as outputs; Step 3: Use the TreeBagger function in Matlab software to construct a random forest RF model; Step 4: Improve the sparrow search algorithm and introduce the random forest RF model. Use the sparrow search algorithm to optimize and update the number of decision trees and the minimum number of leaf nodes parameters in the random forest RF model. The position of each sparrow is regarded as a combination encoding of the number of decision trees and the number of minimum leaves in the random forest RF model, and construct a CFSSA-SF prediction model with high accuracy; Step 5: Use the training set data in Step 2 to train the CFSSA-SF prediction model, repeat the update rule in Step 4, update the position of each sparrow, obtain the number of decision trees and the number of minimum leaves in the random forest RF model, and determine whether the set maximum number of iterations is reached; if it is reached, select the number of decision trees and the number of minimum leaves in the random forest RF model corresponding to the sparrow position with the highest fitness value as the final optimization result; if it is not reached, repeat the update rule in Step 4 until the final optimization result is obtained; Step 6: Input the test set data in Step 2 into the CFSSA-SF prediction model trained in Step 5 to obtain the predicted data result.
2. The mechanical property prediction method of the composite material based on the improved sparrow algorithm - random forest according to claim 1, wherein The specific construction method of the RVE model in Step 1: Step 11: Observe the unidirectional carbon fiber composite material under a microscope, analyze the microstructure of the carbon fiber composite material. In this microstructure, the columnar carbon fiber materials are arranged in the same direction, and the epoxy resin material is filled in the gaps between the carbon fiber materials, and then construct an RVE unit cell model with a representative volume element; Step 12: Write the algorithm for the random distribution of porosity of the composite material using the built-in programming module of the finite element software COMSOL. Introduce porosity into the RVE unit cell model and set the volume of a single small pore to 0.000125 mm 3 , and construct RVE models containing carbon fiber defects and matrix defects respectively; Step 13: Set the material parameters and boundary conditions of carbon fiber and epoxy resin for the RVE model, including unit periodic analysis and different temperature environment settings.
3. The mechanical property prediction method of the composite material based on the improved sparrow algorithm - random forest according to claim 1, characterized in that, The specific steps of the macroscopic simulation in Step 2 are as follows: Step 21: Reconstruct a three-dimensional model as the macroscopic model of the carbon fiber composite material, connect the elastic constant matrix material in Step 1 to the macroscopic model material settings, and set the boundary conditions for the macroscopic model; Step 22: Set the macroscopic simulation steady-state solver, add parametric scans of tensile and compressive load parameters, and use the maximum tensile and compressive failure loads obtained from the mechanical experiments as the simulation parameter scan data to simulate the Vonmises stress under the failure load. The Von mises stress under this failure load can be regarded as the strength limit.
4. The mechanical property prediction method of the composite material based on the improved sparrow algorithm - random forest according to claim 3, characterized in that, In step 22, add the maximum value probe of Von mises stress and the first principal strain probe in the gauge section of the macroscopic model. Set the parametric scan in the simulation model to calculate the modulus of the carbon fiber composite material. The calculation formula is as follows: (1); Formula (1) represents the relationship between the corresponding stress change Δσ / MPa, the dimensionless strain change Δε, and the modulus Et / GPa, and their ratio is within the longitudinal strain range of 0.001 - 0.
003.
5. The mechanical property prediction method of the composite material based on the improved sparrow algorithm-random forest according to claim 4, characterized in that In step 22, according to the maximum tensile or compressive failure load obtained from the mechanical experiments, set the parametric scan in the simulation model to calculate the Von mises stress of the carbon fiber composite material. The calculation formula is: (2); Formula (2) is the relationship among the maximum failure load, the specimen thickness, the specimen width, and the stress σ t / MPa; P max is the magnitude of the maximum failure load / N when applying tension or compression; W is the width / mm of the specimen gauge section; h is the thickness / mm of the specimen gauge section.
6. The mechanical property prediction method of the composite material based on the improved sparrow algorithm - random forest according to claim 1, characterized in that The specific construction method of the random forest RF model in step 3 is: Step 31: Import data from the.xlsx file using the readmatrix function, divide the data into feature variable X n and target variable Y and perform normalization, while retaining relevant normalization parameters; Step 32: Use the rng() function to fix the random number seed and shuffle the sample group. The random number sequence generated by the RF model each time the program runs is the same to facilitate the repetition and comparison of prediction results. Set the number of decision trees and the minimum number of leaves, and use the TreeBagger function to construct the random forest model net. Reverse-normalize the prediction results using the reverse function.
7. The mechanical property prediction method of the composite material based on the improved sparrow algorithm-random forest according to claim 1, characterized in that, In step 4, the sparrow search algorithm is proposed inspired by the foraging behavior and anti-predation behavior of sparrows. Use virtual sparrows to search for food in the prediction model. The population X composed of n sparrows is shown in the following formula: (3); In formula (3), d is the dimension of the variables of the problem to be optimized; n is the number of sparrows, and each sparrow represents a set of sample data; Step 41: The Cubic chaos mapping formula is as follows: (4); In formula (4), p is the set control parameter; i = 1, 2, 3, …, pop - 1, pop is the population size, j = 1, 2, …, d; In the population initialization stage, the completely random initialization method is abandoned. First, the position of the first sparrow in each dimension is randomly generated, that is, x 1,j is the position information of the first sparrow in the j-th dimension. Then, the remaining sparrows i = 2, 3, …, pop use the Cubic chaotic mapping formula to generate the initial position x i,j , j = 1, 2, …, d: (5); Then, map the positions obtained through the chaotic mapping into the set search space [lb, ub] to obtain the initial state of the population X , to ensure that the positions of the initialized population are within a reasonable range; (6); In formula (6), i = 1, 2, 3, …, pop, j = 1, 2, …, d; lb is the lower limit parameter of the space, and ub is the upper limit parameter of the space; In addition, the fitness values of all sparrows are shown in the following formula: (7); In formula (7), f is the fitness value of a single sparrow, and the fitness value is the mean square error MSE of the training set and the test set; is the root mean square error of the training set, is the mean square error of the test set; it is shown as follows: (8); Step 42: The position update of the discoverer is shown in the following formula: (9); In formula (9), t is the current iteration number; j = 1, 2, 3, …, d ; item max is the maximum iteration coefficient and is a constant; x i,j represents the position information of the i th sparrow in the j th dimension; a ∈ (0, 1] is a random number; R2 and ST are the warning value and the safety value respectively, R2 ∈ [0, 1], ST ∈ [0.5, 1]; Q is a random number subject to a normal distribution; L is a 1*d matrix, and each element in this matrix is 1; When it is, an update method including exponential decay is adopted to make the position update have a spiral convergence trend; At that time, by adding a term related to the random number and the all-ones matrix L to update the position, the randomness and exploratory nature of position updates were increased; Step 43: The position update of the joiner is described as follows in the following formula: (10); In formula (10), x p is the optimal position occupied by the current discoverer, x worst is the current globally worst position; A is a 1*d matrix, where each element is randomly assigned 1 or -1, and A + = A T (AA T ) -1 ; Step 44: The position update of the vigilant is shown in the following formula: (11); In formula (11), is the current global optimal position; As the step size control parameter, it is a random number obeying the normal distribution with a mean of 0 and a variance of 1; K is a random number, K ∈ [-1, 1]; f i is the fitness value of the current sparrow individual, f g , f w are the current global best and worst fitness values respectively; is a constant, and to avoid a zero denominator.
8. The mechanical property prediction method of the composite material based on the improved sparrow algorithm - random forest according to claim 1, characterized in that After the finite element simulation in step 2, use the training set in the simulation data as the sample data and input it into the CFSSA-RF prediction model obtained in step 5. Each group of data includes the porosity, pore position, temperature, mechanical type, mechanical strength, and mechanical modulus of the carbon fiber composite material. Use the porosity, pore position, temperature, and mechanical type as inputs, and use the mechanical strength and mechanical modulus as outputs.
9. The mechanical property prediction method of the composite material based on the improved sparrow algorithm-random forest according to claim 8, wherein, A total of 84 groups of sample data are obtained in step 2, and the ratio of the training set to the test set is divided into 75%:25%; Input the divided training set data into the CFSSA-RF model constructed in step 4 for training, and use the improved sparrow optimization algorithm in step 4 to automatically iterate, search for the obtained optimal number of decision trees and the minimum number of leaves, and obtain the CFSSA-RF model for subsequent prediction.
10. The mechanical property prediction method of the composite material based on the improved sparrow algorithm - random forest according to claim 9, and calculate the RMSE, R 2 and MAE evaluation indexes of the training set and the test set in steps 5 and 6, and draw a comparison chart of the prediction results of the training set and the test set.
Citation Information
Cited By
Performance test analysis method for inorganic material surface modification
CN121141444A
Method for predicting compression failure load of composite stiffened plate in aircraft structure
CN121328243A
A method for predicting the compressive failure load of a composite stiffened panel in an aircraft structure
CN121328243B
High ground stress tunnel surrounding rock stability analysis method and device
CN121525150A
High ground stress tunnel surrounding rock stability analysis method and device
CN121525150B