Contrast learning topology optimization method and system based on residual network

Through the comparison learning topology optimization method based on residual networks, the topology optimization task is decomposed into multiple stages and combined with contrast learning and improved residual network architecture, the shortcomings of traditional methods in large-scale optimization and complex physics scenarios are solved, and efficient and accurate topology optimization is achieved.

CN120145864APending Publication Date: 2025-06-13GUANGDONG UNIV OF TECH

Patent Information

Application Number
CN202510305703.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

When facing large-scale optimization problems, traditional topological optimization technologies have problems such as large-scale optimization problems, reduced computing accuracy, limited characterization capabilities and high computing resources, which are difficult to meet the needs of real-time decision-making in the industry and the description of complex physics scenarios.

Method used

The comparison learning topology optimization method based on residual network is adopted, and the multi-stage conditional generation adversarial network framework is used to decompose the topology optimization task into three stages: stress generation, strain generation and structural optimization generation. Combined with the contrast learning and improved residual network (IResNet) architecture, it significantly reduces the computational complexity and improves optimization accuracy.

Benefits of technology

It significantly improves computing efficiency, reduces computing time to 40% of the traditional method, and maintains high optimization accuracy, can effectively deal with multi-physics coupling problems, and improves the ability to identify and generate complex structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120145864A_ABST
    Figure CN120145864A_ABST
Patent Text Reader

Abstract

The invention discloses a contrastive learning topological optimization method and system based on a residual network, and aims to optimize structural design to meet specific physical constraints. The method comprises the following steps of: 1, constructing a multi-channel tensor format by preparing a physical domain, a volume fraction, a displacement boundary condition and a load condition as input data; in the second step and the third step, the two cGANs are used for generating stress and strain distribution fields respectively, and necessary physical information is provided for follow-up structure optimization. And 4, combining the generated stress field and strain field with the original physical domain, and inputting into a third cGAN to generate a final topological optimization structure. And 5, introducing a comparative learning discriminator, and comparing a reference structure generated by the SIMP method with a structure output by the generator to enhance the identification capability of the network on topological characteristics. And finally, the optimal configuration of material distribution is realized on the premise that the output optimized topological structure conforms to physical constraints. According to the method, deep learning and structure optimization are combined, and an effective design scheme is expected to be provided in engineering practice.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of topology optimization, and particularly relates to a contrastive learning topology optimization method and system based on a residual network. Background Art

[0002] Topology optimization is a computational method used to determine the optimal material distribution within a design space under specific loads, boundary conditions, and constraints, in order to maximize performance or minimize material usage. Industrial software, especially computer-aided engineering (CAE) tools, plays an indispensable role in fields such as integrated circuit design. Its comprehensive layout and performance evaluation functions provide strong support for engineering design. With the help of multi-physics field analysis and finite element methods, CAE software can accurately evaluate the material properties under different scenarios. Topology optimization significantly improves design efficiency and reliability by optimizing material distribution and layout, showing significant advantages in improving energy efficiency, reducing energy consumption, and enhancing thermal performance. The core of material topology optimization in CAE lies in representing the material density as a continuous function between 0 and 1, and guiding the material layout through optimization algorithms. The main methods include the homogenization technique, the solid isotropic material with penalty (SIMP) method, the evolutionary structural optimization (ESO) method, the level set method, and the material manufacturing constraint (MMC) method. In recent years, with the significant advantages of deep neural networks in general approximation ability and computational efficiency, the research on the integration of artificial intelligence and CAE tools has increased.

[0003] However, traditional topology optimization techniques still face serious challenges when dealing with large-scale optimization problems. First, the iterative calculation process consumes a large amount of time resources and cannot meet the requirements of modern industry for real-time decision-making. Second, as the number of iterations increases, the computational accuracy often gradually decreases, resulting in an unsatisfactory final optimization result. Third, although existing deep learning methods have improved computational efficiency, their representation ability is limited, and it is difficult to accurately capture the subtle changes and structural features in complex physical scenarios. In addition, most existing methods often require a large amount of training data and computational resources when dealing with high-dimensional, multi-parameter optimization problems, and the actual application cost is high. The trade-off between traditional methods and deep learning methods has also become a research difficulty. How to maintain the physical accuracy of traditional methods while taking advantage of the high efficiency of deep learning has become an urgent problem to be solved. These challenges severely restrict the popularization of topology optimization technology in large-scale industrial applications. Therefore, there is an urgent need to develop a new optimization framework that can significantly improve computational efficiency while maintaining high accuracy, providing strong technical support for industrial CAE applications. Summary of the Invention

[0004] In order to solve the technical problems existing in the background art, the present invention aims to provide a contrastive learning topology optimization method and system based on a residual network.

[0005] To solve the technical problems, the technical solution of the present invention is as follows:

[0006] A contrastive learning topology optimization method based on a residual network, the method comprising:

[0007] S1: Obtain input data, including: physical domain, volume fraction, displacement boundary conditions, and load conditions. The data is preprocessed by a ToPy generator and converted into a NumPy array as the model input data for a multi-condition generative adversarial network. The stress and strain energy density are obtained by finite element calculation;

[0008] S2: Process the input data through the first conditional GAN network to generate a predicted stress distribution field Stress pred , in this stage, the network learns the features of the input conditions to generate the prediction result of the stress field;

[0009] S3: Process the input data through the second conditional GAN network to generate a predicted strain distribution field Stress pred ;

[0010] S4: Combine the stress and strain prediction results of steps S2 and S3, and use the third conditional GAN network to generate a structural topology optimization result. The optimized structure S is gradually generated through IResNet and U-Net decoding Pred ;

[0011] S5: Construct a contrastive learning discriminator, compare the generated structure with the real structure, train the discriminator through classification loss and contrast loss to ensure the quality of the generated structure, evaluate the model performance using MAE and MSE, optimize the loss function to ensure volume fraction constraints, and output the final optimized topology structure to obtain a design solution that meets physical constraints and has an optimal material distribution.

[0012] Further, step S1 includes:

[0013] Obtain the volume fraction, displacement boundary, load position, loading direction, SIMP penalty, and SIMP filter radius as the input data of the network model;

[0014] The input data is created by a ToPy generator, organized in CSV file format, with each row including the complete attribute information of the optimized structure, and converted into a NumPy array as the network input. The initial stress is assumed to be η = [η 11 , η 22 , η 12 , the strain is assumed to be δ = [δ 11 , δ 22 , δ 12 , the strain energy density η vm and the equivalent stress W are calculated by the finite element algorithm as the physical field vectors:

[0015]

[0016]

[0017] Furthermore, in the step S2, the conditional generative adversarial network cGAN architecture is adopted in the stress generation stage, and the specific operations are as follows:

[0018] Input processing:

[0019] Receive the boundary condition BC, volume fraction VF, physical domain domain, and load L; convert the input into a multi-channel tensor of size 8×16×1024; perform initial feature extraction through the combination of Conv2d, BN, and leaky activation functions;

[0020] The stress generation mathematical formula is:

[0021] Stress pred = StressGAN(BC, domain, L)(3)

[0022] Network structure:

[0023] Encoding part: Use the U-Net architecture, which consists of 5 downsampling blocks:

[0024] Each downsampling block contains: Conv2d(5×5, stride = 2) → BatchNorm → LeakyReLU;

[0025] The sizes of the feature maps become: 32×64×128 → 16×32×256 → 8×16×512 → 4×8×512 → 2×4×512 in sequence;

[0026] IResNet block processing:

[0027] STARTResBlock: x → Conv2d → BN → LReLU → output result1;

[0028] MIDDLEResBlock: result1 → Conv2d → BN → LReLU → output result2;

[0029] ENDResBlock: result2 → Conv2d → BN → LReLU → output result3;

[0030] Decoding part: Gradually restore the spatial resolution through the transposed convolution layer:

[0031] Each upsampling block contains: TransConv2d(5×5,stride=2)→BatchNorm→ReLU;

[0032] The sizes of the feature maps change successively as: 4×8×512→8×16×512→16×32×256→32×64×128→64×128×3;

[0033] Through the above network structure and calculation process in the entire stress generation stage, the physical input conditions are converted into a predicted stress field, providing basic physical information for the subsequent strain field and structural optimization.

[0034] Furthermore, in the step S3, the strain generation stage also adopts the cGAN network architecture, and the specific operations are as follows:

[0035] Input processing:

[0036] The input layer receives the boundary condition BC, volume fraction VF, physical domain domain, and load L, formats them into a tensor of 8×16×1024, and uses a U-Net architecture similar to the stress generator. Through a convolutional layer with a 5×5 convolutional kernel and a stride of 2 for downsampling: Conv2d(input_channels,64,kernel_size=5,stride=2)→BatchNorm2d→LeakyReLU(0.2);

[0037] The continuous downsampling process changes the size of the feature map: 8×16×1024→32×64×128→16×32×256→8×16×512→4×8×512;

[0038] IResNet residual block processing:

[0039] STARTResBlock: x→Conv2d→BN→LReLU→output result1;

[0040] MIDDLEResBlock: result1→Conv2d→BN→LReLU→output result2;

[0041] ENDResBlock: result2→Conv2d→BN→LReLU→output result3;

[0042] Decoding part: The decoder gradually restores the spatial resolution through transposed convolutional layers;

[0043] The sizes of the feature maps change: 4×8×512→8×16×512→16×32×256→32×64×128→64×128×3.

[0044] Furthermore, in the structure generation stage of step S4, it includes:

[0045] Input processing:

[0046] The input layer receives the Stress pred , Strain Pred generated in the previous two stages, as well as the original physical domain domain and volume fraction VF, and combines them into a multi-channel input tensor, as shown in Equation 4;

[0047] S pred = StructureGAN(Stress pred , Strain pred , BC, VF, domain, L)(4)

[0048] The downsampling encoder adopts the following structure:

[0049] Conv2d(input_channels, 64, kernel_size = 5, stride = 2) → BatchNorm2d → LeakyReLU(0.2);

[0050] The process of feature map size change: input → 8×16×512 → Conv2d, BN, leaky → 16×32×256 → Conv2d, BN, leaky → 32×64×128;

[0051] IResNet block processing:

[0052] The IResNet block in the structure generator: IResnetBlock: x → Conv2d → BatchNorm → LReLU → result + identity mapping.

[0053] Furthermore, in step S5, the contrastive learning discriminator specifically includes:

[0054] Input processing:

[0055] The discriminator receives two inputs:

[0056] - S pred : The output of the structure generator;

[0057] - S real : The reference structure generated by the SIMP method;

[0058] The discriminator structure includes a classification module and a contrast module:

[0059] Input structure → Conv2d 5×5 → LeakyReLU → BatchNorm → 32×64×32 → Conv2d 5×5 → BatchNorm → LeakyReLU → 16×32×64 → Conv2d 5×5 → BatchNorm → LeakyReLU → 8×16×128 → Linear layer → Output;

[0060] Output processing:

[0061] The decoder gradually restores the spatial resolution: 8×16×512 → TransConv2d, BN, ReLU → 16×32×256 → TransConv2d, BN, ReLU → 32×64×128 → TransConv2d, BN, ReLU → 64×128×1;

[0062] Output the final topology S through the Sigmoid activation function pred , where the area with a value close to 1 indicates where the material should be placed, and the area with a value close to 0 indicates blank.

[0063] Furthermore, in the step S5, the specific implementation and training process of the contrastive learning discriminator include:

[0064] The generator G is expressed as minimizing the loss function:

[0065]

[0066] To make the result generated by the generator meet the requirement of the volume fraction vf and prevent the volume constraint from failing, the third part of the loss function is proposed: where z is the input random noise; y is the labeled information; λ 1 , λ 2 is a predefined value;

[0067] Loss of volume fraction:

[0068]

[0069] The training loss of the final generator is:

[0070] Loss G = Loss(G 0 ) + λ 2 Loss(vf) (7)

[0071] In the generator G, to ensure the performance of the model, two different types of losses need to be calculated: L2 regularization loss Loss L2 and the absolute error between the volume fraction of the data generated by the generator and the corresponding true data volume fraction

[0072]

[0073]

[0074] Among them, y represents the real data, x represents the problem input, f(x) represents the initial field, the input condition of the generator is r(x) = [x, f(x)], in addition, VF represents the volume fraction, N represents the total number of elements, and the training loss of the discriminator D is expressed as Loss D , including two parts: the training loss of the classification module, expressed as Loss classifier ; the training loss of the comparison module, expressed as Loss contrastive ;

[0075] Loss classifier =E (x,y)~pdata(x,y) [logD(r(x),y)] (10)

[0076]

[0077]

[0078] Loss D =β 1 Loss classifier +β 2 Loss contrastive (13)

[0079] Among them, τ is the temperature hyperparameter, sim is the cosine similarity; thus, it can be seen that the training objective and loss function of the model consist of four parts: the training loss Loss D of the generator, the training loss Loss G of the discriminator, the L2 regularization loss Loss L2 of the generator, and the absolute error of the volume integral

[0080] Loss G,D =Loss G +Loss D (14)

[0081]

[0082] The mean absolute error MAE and the mean squared error MSE are used as the main evaluation indicators of the model:

[0083]

[0084]

[0085] A contrastive learning topology optimization system based on a residual network, where the system is applied to any of the above methods, and the system includes:

[0086] Data input module: Obtain input data, including: physical domain, volume fraction, displacement boundary conditions, and load conditions. The data is preprocessed by a ToPy generator and converted into a NumPy array as the model input data for a multi-condition generative adversarial network. Stress and strain energy density are obtained through finite element calculations;

[0087] Stress generation module: Process the input data through the first conditional GAN network to generate a predicted stress distribution field Stress pred , in this stage, the network learns the features of the input conditions to generate the prediction result of the stress field;

[0088] Strain generation module: Process the input data through the second conditional GAN network to generate a predicted strain distribution field Strain pred ;

[0089] Structure optimization generation module: Combine the above stress and strain prediction results, use the third conditional GAN network to generate the structure topology optimization result, and gradually generate the optimized structure S through IResNet and U-Net decoding Pred ;

[0090] Contrastive learning discriminator module: Construct a contrastive learning discriminator, compare the generated structure with the real structure, train the discriminator through classification loss and contrastive loss to ensure the quality of the generated structure, use MAE and MSE to evaluate the model performance, optimize the loss function to ensure volume fraction constraints, and output the final optimized topology structure to obtain a design scheme that meets physical constraints and has an optimal material distribution.

[0091] A computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements a contrastive learning topology optimization method based on a residual network as described in any of the above.

[0092] A computer-readable storage medium stores a computer program, and when the program is executed by a processor, it implements a contrastive learning topology optimization method based on a residual network as described in any of the above.

[0093] Compared with the prior art, the advantages of the present invention are:

[0094] First, aiming at the problem that the existing single-stage generation architecture cannot effectively handle the complex optimization problems of multi-physical-field coupling, the present invention proposes to establish a multi-stage conditional generative adversarial network framework, which decomposes the topology optimization task into three consecutive stages: stress generation, strain generation, and structural optimization generation, enabling the networks in each stage to focus on the modeling and optimization of specific physical fields and effectively handle the multi-physical-field coupling problem.

[0095] Second, in view of the deficiency of the existing technology in lacking an explicit physical-field characterization mechanism, the present invention designs a data-driven method based on physical information, converts physical inputs such as boundary conditions and volume fractions into stress and strain distributions, and then integrates these physical fields into the structural optimization generation network, making full use of key physical information to guide the optimization process and improving the matching degree between the generated structure and the actual physical scenario.

[0096] Third, aiming at the problem that the existing discriminator is simply designed and lacks the ability to specifically learn topological features, the present invention introduces contrastive learning technology into the structure generation discriminator. By comparing the similarities and differences between the reference structure generated by the SIMP method and the structure output by the generator, the network's understanding and learning ability of topological structure features are enhanced, and the recognition and generation ability of complex structures are improved.

[0097] Fourth, aiming at the problems of high computational complexity and large resource requirements of the traditional ResNet architecture, the present invention adopts an improved residual network (IResNet) framework. By optimizing the network structure and the design of residual blocks, the computational complexity is significantly reduced, and the calculation time is reduced to 40% of the traditional method. At the same time, a high optimization accuracy is maintained, achieving a better balance between computational efficiency and result quality.

[0098] Through the organic combination of the above technical means, the present invention provides an intelligent calculation method with high efficiency and high precision for the field of topology optimization, which can be effectively applied to the material distribution optimization problem in CAE software and provide strong technical support for industrial design and research and development. Brief Description of the Drawings

[0099] Figure 1 The technical roadmap of a contrastive learning topology optimization method based on a residual network according to the present invention. Detailed Embodiments

[0100] The following describes the specific embodiments of the present invention in conjunction with the embodiments:

[0101] It should be noted that the structures, ratios, sizes, etc. shown in this specification are only used to cooperate with the content disclosed in the specification for those familiar with this technology to understand and read, and are not used to limit the implementation conditions of the present invention. Any modification of the structure, change of the proportional relationship or adjustment of the size, without affecting the effects that the present invention can produce and the purposes that can be achieved, should still fall within the scope covered by the technical content disclosed in the present invention.

[0102] At the same time, the terms such as "upper", "lower", "left", "right", "middle" and "one" cited in this specification are only for the convenience of clear narration, rather than used to limit the scope of implementation of the present invention. The change or adjustment of their relative relationship, without substantial change of the technical content, should also be regarded as the scope that the present invention can implement.

[0103] Embodiment 1:

[0104] The present invention proposes a multi-stage contrastive learning conditional generative adversarial network (MSC-GANs) topology optimization method. As Figure 1 shown, the topology optimization task is decomposed into three consecutive stages: stress generation, strain generation, and structural optimization generation. Each stage is implemented by an independent conditional GAN network, and the model representation ability is enhanced through contrastive learning. The topology optimization task is decomposed into three consecutive stages: stress generation, strain generation, and structural optimization generation. Each stage is implemented by an independent conditional GAN network. Through a data stream driven by physical information, physical inputs such as boundary conditions and volume fractions are first transformed into stress and strain distributions, and then this physical field information is integrated into the structural optimization generation. The core innovation lies in introducing contrastive learning to enhance the feature representation ability of the structure discriminator, and using an improved residual network (IResNet) to optimize the network architecture, significantly reducing the computational complexity. Its core steps:

[0105] Data input processing: Convert various input conditions into tensors and perform feature extraction.

[0106] Stress and strain generation: Use the cGAN network to generate predicted stress and strain fields.

[0107] Structural optimization generation: Based on the stress and strain fields, combined with the physical domain, generate the final topology structure.

[0108] Contrastive learning: Improve the ability of the network to generate optimized structures through contrastive learning.

[0109] Loss function and evaluation: Train according to the loss function to ensure that the generated structure meets the requirements such as volume fraction and physical constraints, and finally output the optimization result.

[0110] The technical route of the present invention is:

[0111] S1: Prepare the input conditions, including the physical domain, volume fraction, displacement boundary conditions, and load conditions, and convert them into a multi-channel tensor format as the network input.

[0112] S2: Stress generation stage. Process the input conditions through the first conditional GAN network to generate the predicted stress distribution field Stress. pred 。

[0113] S3: Strain generation stage. Process the input conditions through the second conditional GAN network to generate the predicted strain distribution field Strain. pred 。

[0114] S4: Structural optimization generation stage. Input the stress field and strain field generated in the previous two stages, combined with the original physical domain and volume fraction, into the third conditional GAN network to generate the final topology optimization structure S. Pred 。

[0115] S5: Introduce a contrastive learning discriminator to perform contrastive learning between the reference structure generated by the SIMP method and the structure output by the generator, enhancing the network's ability to recognize topological structure features.

[0116] S6: Output the final optimized topological structure to obtain a design solution that meets the physical constraints and has the optimal material distribution.

[0117] First step, data input;

[0118] MSC-GANs receive the following input data:

[0119] Table 1: - Input data

[0120]

[0121] The data is created by the ToPy generator, organized in the CSV file format, with each row containing the complete attribute information of the optimized structure, and converted into a NumPy array as the network input. The initial stress is assumed to be η = [η 11 , η 22 , η 12 , and the strain is assumed to be δ = [δ 11 , δ 22 , δ 12 . The strain energy density η vm and the equivalent stress W are calculated by the finite element algorithm as the physical field vectors.

[0122]

[0123]

[0124] Second step, stress generation stage:

[0125] In the stress generation stage, the cGAN network architecture is adopted, and the specific operations are as follows:

[0126] 1. Input processing:

[0127] Receive the boundary condition BC, volume fraction VF, physical domain domain, and load L; convert the input into a multi-channel tensor of size 8×16×1024; perform initial feature extraction through the combination of Conv2d, BN, and leaky activation functions.

[0128] The stress generation mathematical formula is:

[0129] Stress pred =StressGAN(BC,domain,L)(3)

[0130] 2. Network structure:

[0131] Encoding part: Use the U-Net architecture, which consists of 5 downsampling blocks:

[0132] Each downsampling block contains: Conv2d(5×5,stride=2)→BatchNorm→LeakyReLU.

[0133] The sizes of the feature maps change sequentially to: 32×64×128→16×32×256→8×16×512→4×8×512→2×4×512.

[0134] 3. IResNet block processing:

[0135] STARTResBlock: x→Conv2d→BN→LReLU→output result1;

[0136] MIDDLEResBlock: result1→Conv2d→BN→LReLU→output result2;

[0137] ENDResBlock: result2→Conv2d→BN→LReLU→output result3.

[0138] 4. Decoding part: Gradually restore the spatial resolution through the transposed convolution layer:

[0139] Each upsampling block contains: TransConv2d(5×5,stride=2)→BatchNorm→ReLU;

[0140] The sizes of the feature maps change successively as: 4×8×512 → 8×16×512 → 16×32×256 → 32×64×128 → 64×128×3.

[0141] During the entire stress generation stage, through the above network structure and calculation process, the physical input conditions are transformed into a predicted stress field, providing basic physical information for the subsequent strain field and structural optimization.

[0142] Step 3: Strain generation stage

[0143] The strain generation stage also adopts the cGAN network architecture, and the specific operations are as follows:

[0144] 1. Input processing:

[0145] The input layer receives the boundary conditions BC, volume fraction VF, physical domain domain, and load L, and formats them into a tensor of 8×16×1024. Using a U-Net architecture similar to the stress generator, downsampling is performed through convolutional layers with a 5×5 convolutional kernel and a stride of 2: Conv2d(input_channels, 64, kernel_size = 5, stride = 2) → BatchNorm2d → LeakyReLU(0.2);

[0146] The continuous downsampling process changes the sizes of the feature maps: 8×16×1024 → 32×64×128 → 16×32×256 → 8×16×512 → 4×8×512.

[0147] 2. IResNet residual block processing: The idea is the same as that of the stress generator.

[0148] 3. Decoding part: The decoder gradually restores the spatial resolution through transposed convolutional layers.

[0149] The sizes of the feature maps change: 4×8×512 → 8×16×512 → 16×32×256 → 32×64×128 → 64×128×3.

[0150] Step 4: Structure generation stage

[0151] 1. Input processing:

[0152] The input layer receives the Stress pred and Strain Pred generated in the previous two stages, as well as the original physical domain domain and volume fraction VF, and combines them into a multi-channel input tensor, as shown in Equation 4.

[0153] S pred = StructureGAN(Stress pred , Strainpred , BC, VF, domain, L) (4)

[0154] The downsampling encoder adopts the following structure:

[0155] Conv2d(input_channels, 64, kernel_size = 5, stride = 2) → BatchNorm2d → LeakyReLU(0.2);

[0156] Process of feature map size change: input → 8×16×512 → Conv2d, BN, leaky → 16×32×256 → Conv2d, BN, leaky → 32×64×128;

[0157] 2. Processing of IResNet block:

[0158] The IResNet block in the structure generator: IResnetBlock: x → Conv2d → BatchNorm → LReLU → result + identity mapping.

[0159] Step 5, contrastive learning discriminator

[0160] 1. Input processing:

[0161] The discriminator receives two inputs:

[0162] - S pred : Output of the structure generator;

[0163] - S real : Reference structure generated by the SIMP method.

[0164] 2. The discriminator structure includes a classification module and a contrast module:

[0165] Input structure → Conv2d 5×5 → LeakyReLU → BatchNorm → 32×64×32 → Conv2d 5×5 → BatchNorm → LeakyReLU → 16×32×64 → Conv2d 5×5 → BatchNorm → LeakyReLU → 8×16×128 → linear layer → output.

[0166] 3. Output processing:

[0167] The decoder gradually restores the spatial resolution: 8×16×512 → TransConv2d, BN, ReLU → 16×32×256 → TransConv2d, BN, ReLU → 32×64×128 → TransConv2d, BN, ReLU → 64×128×1;

[0168] Output the final topological structure S through the Sigmoid activation function pred , where the area with values close to 1 indicates where the material should be placed, and the area with values close to 0 indicates blank.

[0169] Loss function and evaluation metrics:

[0170] The generator G can be expressed as minimizing the loss function:

[0171]

[0172] To make the results generated by the generator meet the requirements of the volume fraction vf and prevent the volume constraint from failing, the third part of the loss function is proposed: where z is the input random noise; y is the labeled information; λ 1 , λ 2 is a predefined value.

[0173]

[0174] The training loss of the final generator is:

[0175] Loss G = Loss(G 0 ) + λ 2 Loss(vf) (7)

[0176] In the generator G, to ensure the performance of the model, two different types of losses need to be calculated: the L2 regularization loss (denoted as Loss L2 ) and the absolute error between the volume fraction of the data generated by the generator and the corresponding true data volume fraction (denoted as ).

[0177] Loss L2 (G) = E x,y [||y - G(f(x))|| 2 (8)

[0178]

[0179] where y represents the true data, x represents the problem input, f(x) represents the initial field, and the input condition of the generator is r(x) = [x, f(x)]. In addition, VF represents the volume fraction and N represents the total number of elements. The training loss of the discriminator D, denoted as Loss D , includes two parts: the training loss of the classification module, denoted as Loss classifier ; the training loss of the comparison module, denoted as Loss contrastive .

[0180] Lossclassifier = E (x,y)~pdata(x,y) [logD(r(x), y)] (10)

[0181]

[0182]

[0183] Loss D = β 1 Loss classifier + β 2 Loss contrastive (13)

[0184] where τ is the temperature hyperparameter and sim is the cosine similarity. It can be seen that the training objective and loss function of the model consist of four parts: the training loss Loss D of the generator, the training loss Loss G of the discriminator, the L2 regularization loss Loss L2 of the generator, and the absolute error of the volume integral

[0185] Loss G,D = Loss G + Loss D (14)

[0186]

[0187] In the present invention, the mean absolute error (MAE) and the mean squared error (MSE) are adopted as the main evaluation indicators of the model:

[0188]

[0189]

[0190] It can be understood that the present invention improves the multi-physical-field coupling processing ability:

[0191] The present invention adopts a three-stage architecture to generate the stress field, the strain field, and the structural optimization respectively. Compared with the existing single-stage architecture, it can handle the multi-physical-field coupling problem more effectively. Experiments show that on the same test set, the mean squared error (MSE) of the MSC-GANs of the present invention is reduced by about 40% compared with TopologyGAN, and the mean absolute error (MAE) is reduced by about 22%, proving that the multi-stage framework significantly improves the optimization accuracy in complex physical scenarios.

[0192] It can be understood that the present invention enhances the physical-field representation ability:

[0193] Through a dedicated stress and strain generation stage, the present invention realizes explicit modeling of key physical quantities. During the strain generation stage, the strain energy density η vm and the explicit expression of the stress-strain relationship enable the model to fully utilize physical information to guide the optimization process. Experimental data shows that within the first 75 training cycles, the MAE and MSE curves of the stress-strain generation network quickly approach zero, indicating that the model effectively learns physical constraints and has a high degree of matching with the physical scenario.

[0194] It can be understood that the present invention improves the topological feature recognition ability:

[0195] Introducing a discriminator design for contrastive learning, through the contrastive loss function Loss contrastive significantly enhances the learning ability of topological features. Experimental results show that after deleting the contrastive learning module, the MAE of the model on the validation set increases from 0.3418 to 0.4002, and the MSE increases from 0.2168 to 0.3495, proving the significant contribution of contrastive learning to improving the recognition and generation ability of complex structures.

[0196] It can be understood that the present invention reduces the computational complexity:

[0197] Adopting the IResNet framework to replace the traditional ResNet optimizes the network structure. Computational time measurements show that the processing time of MSC-GANs on dataset A is 1.714 seconds, while that of TopologyGAN is 4.217 seconds, and that of mcGANs is 7.281 seconds; on dataset B, they are 4.358 seconds, 19.487 seconds, and 26.858 seconds respectively. The computational time is reduced to about 40% of the traditional method while maintaining a high optimization accuracy.

[0198] Example 2:

[0199] This embodiment is applied to Example 1. This embodiment demonstrates the practical application of MSC-GANs in 2D structural topology optimization. Using the ToPy open-source solver to generate training data based on the SIMP method, two datasets are constructed: Dataset A contains 676 data points, and Dataset B contains 1214 data points. Both are randomly divided into an 80% training set and a 20% validation set. The sampling parameters cover the volume fraction interval [0.3:0.02:0.5], 42 different boundary scenarios, and the SIMP penalty factor is set to 2, and the filter radius is 1.5.

[0200] The experiment was conducted on a platform equipped with an Intel Xeon Gold 6430 CPU and an RTX 4090 GPU. The network was trained using the ADAM optimizer (learning rate 0.001), with a batch size of 64 and a total of 100 training epochs. The MSC-GANs network consists of three core stages: stress generation, strain generation, and structural optimization, and each stage adopts a U-Net architecture combined with IResNet residual blocks. In particular, a discriminator that fuses linear classification and contrastive learning was designed to enhance the model's ability to recognize topological features. The experimental results are compared in the following table.

[0201] Table 2 - Comparison of Evaluation Metrics

[0202]

[0203] The experimental results show that on Dataset A, MSC-GANs achieved significant performance improvements: the MAE on the validation set was 0.3418 and the MSE was 0.2168; the MAE on the test set was 0.3979 and the MSE was 0.2418, and the calculation time was only 1.714 seconds. In contrast, on the validation set, TopologyGAN had an MAE of 0.4324 and an MSE of 0.4311, with a calculation time of 4.217 seconds; for mcGANs, the MAE on the validation set was 0.4089 and the MSE was 0.4088, and the calculation time was 7.281 seconds. Tests on Dataset B also showed a similar trend, with MSC-GANs having a calculation time of only 4.358 seconds, far lower than 19.487 seconds for TopologyGAN and 26.858 seconds for mcGANs.

[0204] To verify the contributions of each component, ablation experiments were conducted by removing IResNet, the multi-layer architecture, and contrastive learning respectively. The results showed that the complete MSC-GANs model performed the best, demonstrating the synergistic effect of each component. Notably, during the stress-strain generation process, the error metrics decreased rapidly within the first 20 epochs and then converged stably, indicating that the model effectively learned the physical laws. The data is shown in the following table.

[0205] Table 3 - Performance of Ablation Experiments for Mean Absolute Error (MAE) and Mean Squared Error (MSE) after Removing Different Modules

[0206]

[0207] After 60 training cycles, the topological structures generated by MSC-GANs are highly consistent with the results of the SIMP method. The structural evolution from Epoch 1 to Epoch 100 clearly demonstrates the model learning process, and the finally generated optimized structure has clear boundaries and good connectivity. Generally speaking, while maintaining high-precision optimization results, MSC-GANs reduce the computational time to about 40% of the traditional method, and the average error index on the test set is reduced by nearly 40%, successfully solving the balance problem between efficiency and precision in topological optimization.

[0208] Example 3:

[0209] In an alternative implementation, the Transformer architecture is used to replace U-Net:

[0210] The Vision Transformer (ViT) architecture can be adopted to replace U-Net, transforming the topological optimization problem into a sequence-to-sequence mapping task. The specific implementation includes:

[0211] The input conditions are segmented into patches of a fixed size, and positional encoding is added; the multi-head self-attention mechanism is used to capture global dependencies; the features are processed through a feed-forward network and LayerNorm; finally, the topological structure image is generated through linear projection and reshape.

[0212] This solution can capture long-range dependencies more effectively, especially suitable for the generation of complex topological structures.

[0213] In an alternative implementation, the diffusion model is used to replace the GAN architecture:

[0214] The Diffusion Probabilistic Models can be used to replace the GAN architecture, and the topological structure is generated through a progressive denoising process: define the forward diffusion process, gradually add Gaussian noise to the structure; train the neural network to predict the reverse diffusion process; under the conditional input, gradually recover the topological structure starting from pure noise.

[0215] Example 4:

[0216] This embodiment provides a terminal device, which includes a processor and a memory. The memory is used to store a computer program, and the computer program includes program instructions. The processor is used to execute the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, and is suitable for implementing one or more instructions. Specifically, it is suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function. The processor described in the embodiments of the present invention can be used for the operation of a contrast learning topology optimization method based on a residual network, including the following steps:

[0217] S1: Obtain input data, including: physical domain, volume fraction, displacement boundary conditions, and load conditions. The data is preprocessed by a ToPy generator and converted into a NumPy array as the model input data for a multi-condition generative adversarial network. Stress and strain energy density are obtained by finite element calculation;

[0218] S2: Process the input data through the first conditional GAN network to generate a predicted stress distribution field Stress pred , in this stage, the network learns the features of the input conditions to generate the prediction result of the stress field;

[0219] S3: Process the input data through the second conditional GAN network to generate a predicted strain distribution field Strain pred ;

[0220] S4: Combine the stress and strain prediction results of steps S2 and S3, and use the third conditional GAN network to generate a structural topology optimization result. The optimized structure S is gradually generated through IResNet and U-Net decoding Pred ;

[0221] S5: Construct a contrast learning discriminator, compare the generated structure with the real structure, train the discriminator through classification loss and contrast loss to ensure the quality of the generated structure, use MAE and MSE to evaluate the model performance, optimize the loss function to ensure volume fraction constraints, and output the final optimized topology structure to obtain a design scheme that meets physical constraints and has the optimal material distribution.

[0222] Example 5:

[0223] This embodiment provides a storage medium, specifically a computer-readable storage medium (Memory). The computer-readable storage medium is a memory device in a terminal device and is used to store programs and data. It can be understood that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and, of course, the extended storage medium supported by the terminal device. The computer-readable storage medium provides a storage space, and this storage space stores the operating system of the terminal. Moreover, in this storage space, one or more instructions suitable for being loaded and executed by a processor are also stored. These instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory.

[0224] One or more instructions stored in the computer-readable storage medium can be loaded and executed by a processor to implement the corresponding steps in the above-mentioned embodiment regarding a contrastive learning topology optimization method based on a residual network; one or more instructions in the computer-readable storage medium are loaded and executed by a processor to perform the following steps:

[0225] S1: Obtain input data, including: physical domain, volume fraction, displacement boundary conditions, and load conditions. The data is preprocessed by a ToPy generator and converted into a NumPy array as the model input data for a multi-condition generative adversarial network. Stress and strain energy density are obtained by finite element calculation;

[0226] S2: Process the input data through the first conditional GAN network to generate a predicted stress distribution field Stress pred , and in this stage, the network learns the features of the input conditions to generate a prediction result of the stress field;

[0227] S3: Process the input data through the second conditional GAN network to generate a predicted strain distribution field Strain pred ;

[0228] S4: Combine the stress and strain prediction results in steps S2 and S3, and use the third conditional GAN network to generate a structural topology optimization result. The optimized structure S is gradually generated through decoding by IResNet and U-Net Pred ;

[0229] S5: Construct a contrastive learning discriminator to compare the generated structure and the real structure. Train the discriminator through classification loss and contrastive loss to ensure the quality of the generated structure. Use MAE and MSE to evaluate the model performance, optimize the loss function to ensure the volume fraction constraint, and output the final optimized topological structure to obtain a design solution that meets the physical constraints and has the optimal material distribution.

[0230] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0231] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as the combination of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices produce means for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0232] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means that implement the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0233] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are performed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0234] The above has described in detail the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present invention within the scope of knowledge possessed by those of ordinary skill in the art.

[0235] Many other changes and modifications can be made without departing from the concept and scope of the present invention. It should be understood that the present invention is not limited to the specific embodiments, and the scope of the present invention is defined by the appended claims.

Claims

1. A contrastive learning topology optimization method based on residual network, characterized in that: The method comprises: S1: Obtain input data, including physical domain, volume fraction, displacement boundary conditions and load conditions. The data is preprocessed by ToPy generator and converted into NumPy array as the model input data based on multi-conditional generative adversarial network. Stress and strain energy density are obtained by finite element calculation. S2: Process the input data through the first conditional GAN ​​network to generate the predicted stress distribution field Stress pred ,In this stage, the characteristics of the input conditions are learned through the network to generate the prediction results of the stress field; S3: Process the input data through the second conditional GAN ​​network to generate a predicted strain distribution field Strain pred ; S4: Combine the stress and strain prediction results of steps S2 and S3, use the third conditional GAN ​​network to generate the structural topology optimization results, and gradually generate the optimized structure S through IResNet and U-Net decoding. Pred ; S5: Construct a contrastive learning discriminator to compare the generated structure and the real structure. Train the discriminator through classification loss and contrastive loss to ensure the quality of the generated structure. Use MAE and MSE to evaluate the model performance. Optimize the loss function to ensure the volume fraction constraint and output the final optimized topology to obtain a design that meets physical constraints and has the best material distribution.

2. According to claim 1, a contrastive learning topology optimization method based on residual network is characterized in that: The step S1 comprises: Obtain volume fraction, displacement boundary, load location, loading direction, SIMP penalty, and SIMP filter radius as input data for the network model; The input data is created by the ToPy generator and organized into a CSV file format. Each row includes complete property information of the optimized structure and is converted into a NumPy array as network input. The initial stress is assumed to be η = [η 11 ,η 22 ,η 12 ], the strain is assumed to be δ=[δ 11 ,δ 22 ,δ 12 ], strain energy density η vm and the equivalent stress W are calculated by the finite element method as the physical field vector:

3. The method for topology optimization based on residual network by contrastive learning according to claim 1, characterized in that: In step S2, the stress generation stage adopts the conditional generative adversarial network cGAN architecture, and the specific operations are as follows: Input processing: Receive boundary conditions BC, volume fraction VF, physical domain domain and load L; convert the input into a multi-channel tensor of size 8×16×1024; perform initial feature extraction through a combination of Conv2d, BN, and leaky activation functions; The mathematical formula for stress generation is: Stress pred =StressGAN(BC,domain,L) (3) Network structure: Encoding part: Use U-Net architecture, which consists of 5 downsampling blocks: Each downsampling block contains: Conv2d(5×5, stride=2)→BatchNorm→LeakyReLU; The feature map size changes to: 32×64×128→16×32×256→8×16×512→4×8×512→2×4×512; IResNet block processing: STARTResBlock: x→Conv2d→BN→LReLU→output result1; MIDDLEResBlock: result1→Conv2d→BN→LReLU→output result2; ENDResBlock: result2→Conv2d→BN→LReLU→output result3; Decoding part: gradually restore the spatial resolution through the deconvolution layer: Each upsampling block contains: TransConv2d(5×5, stride=2)→BatchNorm→ReLU; The feature map size changes to: 4×8×512→8×16×512→16×32×256→32×64×128→64×128×3; The entire stress generation stage transforms the physical input conditions into a predicted stress field through the above-mentioned network structure and calculation process, providing basic physical information for subsequent strain field and structural optimization.

4. The method for topology optimization based on residual network by contrastive learning according to claim 1, characterized in that: In step S3, the strain generation stage also uses the cGAN network architecture, and the specific operations are as follows: Input processing: The input layer receives the boundary conditions BC, volume fraction VF, physical domain domain and load L, formatted as a 8×16×1024 tensor, using a U-Net architecture similar to the stress generator, down-sampled by a 5×5 convolutional kernel and a stride 2 convolutional layer: Conv2d(input_channels,64,kernel_size=5,stride=2)→BatchN orm2d→LeakyReLU(0.2); The continuous downsampling process changes the feature map size: 8×16×1024→32×64×128→16×32×256→8×16×512→4×8×512; IResNet residual block processing: STARTResBlock: x→Conv2d→BN→LReLU→output result1; MIDDLEResBlock: result1→Conv2d→BN→LReLU→output result2; ENDResBlock: result2→Conv2d→BN→LReLU→output result3; Decoding part: The decoder gradually restores the spatial resolution through deconvolution layers; Feature map size changes: 4×8×512→8×16×512→16×32×256→32×64×128→64×128×3.

5. The method for topology optimization based on residual network contrast learning according to claim 1, characterized in that: The step S4 structure generation stage includes: Input processing: The input layer receives the Stress generated in the first two stages pred 、Strain Pred As well as the original physical domain domain and volume fraction VF, they are merged into a multi-channel input tensor, as shown in Formula 4; S pred =StructureGAN(Stress pred ,Strain pred ,BC,VF,domain,L)(4) The downsampling encoder adopts the following structure: Conv2d(input_channels,64,kernel_size=5,stride=2)→BatchNorm2d→LeakyReLU(0.2); Feature map size change process: input → 8×16×512 → Conv2d, BN, leaky → 16×32×256 → Conv2d, BN, leaky → 32×64×128; IResNet block processing: IResNet block in the structure builder: IResnetBlock:x→Conv2d→BatchNorm→LReLU→result+identitymapping.

6. The method for topology optimization based on residual network by contrastive learning according to claim 1, characterized in that: In step S5, the contrastive learning discriminator specifically includes: Input processing: The discriminator receives two inputs: -S pred : Structure generator output; -S real : Reference structure generated by SIMP method; The discriminator structure includes a classification module and a comparison module: Input structure → Conv2d5×5 → LeakyReLU → BatchNorm → 32×64×32 → Conv2d5×5 → BatchNorm → LeakyReLU → 16×32×64 → Conv2d5×5 → BatchNorm → LeakyReLU → 8×16×128 → Linear layer → Output; Output processing: The decoder gradually restores the spatial resolution: 8×16×512→TransConv2d,BN,ReLU→16×32×256→TransConv2d,BN,ReLU→32×64×128→TransConv2d,BN,ReLU→64×128×1; The final topological structure S is output through the Sigmoid activation function pred , where values ​​close to 1 indicate areas where material should be placed, and values ​​close to 0 indicate empty areas.

7. The method for topology optimization based on residual network by contrastive learning according to claim 1, characterized in that: In step S5, the specific implementation and training process of the contrastive learning discriminator includes: The generator G is expressed as minimizing the loss function: Loss(G0)=-{log(D(G(z|y)))+λ1||x-G(z|y)|| 2 } (5) In order to make the result generated by the generator meet the requirements of the volume fraction vf and prevent the volume constraint from failing, the third part of the loss function is proposed: where z is the input random noise; y is the label information; λ1, λ2 are predefined values; Loss of volume fraction: The final generator training loss is: Loss G =Loss(G0)+λ2Loss(vf) (7) In the generator G, in order to ensure the performance of the model, two different types of losses need to be calculated: L2 regularization loss Loss L2 The absolute error between the volume fraction of the data generated by the generator and the corresponding real data volume fraction Loss L2 (G)=E x,y [||y-G(f(x))||2] (8) Among them, y represents the real data, x represents the problem input, f(x) represents the initial field, the input condition of the generator is r(x) = [x, f(x)], in addition, VF represents the volume fraction, N represents the total number of elements, and the training loss of the discriminator D is expressed as Loss D , consists of two parts: the training loss of the classification module, expressed as Loss classifier ; Compare the training loss of the module, expressed as Loss contrastive ; Loss D =β1Loss classifier +β2Loss contrastive (13) Among them, τ is the temperature hyperparameter, sim is the cosine similarity; it can be seen that the training objective and loss function of the model are composed of four parts: the training loss of the generator Loss D , the training loss of the discriminator Loss G , L2 regularization loss of the generator Loss L2 The absolute error of the volume integral Loss G,D =Loss G +Loss D (14) The mean absolute error (MAE) and mean square error (MSE) are used as the main evaluation indicators of the model:

8. A contrastive learning topology optimization system based on residual network, characterized in that: The system is applied to the method described in any one of claims 1 to 7, and the system comprises: Data input module: obtain input data, including physical domain, volume fraction, displacement boundary conditions and load conditions. The data is preprocessed by ToPy generator and converted into NumPy array as the model input data based on multi-conditional generative adversarial network. Stress and strain energy density are obtained by finite element calculation. Stress generation module: Process the input data through the first conditional GAN ​​network to generate the predicted stress distribution field Stress pred ,In this stage, the characteristics of the input conditions are learned through the network to generate the prediction results of the stress field; Strain generation module: Process the input data through the second conditional GAN ​​network to generate the predicted strain distribution field Strain pred ; Structural optimization generation module: Combined with the above stress and strain prediction results, the third conditional GAN ​​network is used to generate the structural topology optimization results, and the optimized structure S is gradually generated through IResNet and U-Net decoding. Pred ; Contrastive learning discriminator module: Construct a contrastive learning discriminator to compare the generated structure and the real structure. Train the discriminator through classification loss and contrast loss to ensure the quality of the generated structure. Use MAE and MSE to evaluate the model performance. Optimize the loss function to ensure the volume fraction constraint. Output the final optimized topology structure to obtain a design that meets physical constraints and has the best material distribution.

9. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a residual network-based contrast learning topology optimization method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements a residual network-based contrastive learning topology optimization method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Conditional generative adversarial network topology optimization method and system based on comparative learning

    CN116542080A

  • Inverse design system designing nano-optical device using controllable generative adversarial network and training and design methods

    US20230409781A1

Cited By

  • Method for identifying multiple fault sources of cascaded H-bridge frequency converter

    CN120429624A