ChatGPT-python programming method
Through the ChatGPT-python programming method, human-computer collaborative programming is used to solve the problems of high programming threshold, long development cycle and poor algorithm transparency in traditional programming methods, achieving fast and efficient engineering computing problem solving, demonstrating good computing accuracy and application prospects.
Patent Information
- Application Number
- CN202510155259.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-06-10
AI Technical Summary
Traditional programming methods have problems such as high programming threshold, long development cycle and poor algorithm transparency in the engineering field, especially when dealing with complex multi-physics coupling or high-dimensional optimization problems.
A ChatGPT-python programming method is proposed, through human-computer collaborative programming, and using ChatGPT to assist in problem definition, algorithm design and code implementation, lowering programming thresholds and improving development efficiency.
It quickly understands and deals with complex engineering problems, improves work efficiency and solution accuracy, and verifies that the Python algorithm obtained by ChatGPT programming has good calculation accuracy through the three-dimensional slope stability analysis case.
Smart Images

Figure CN120122951A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and specifically to a ChatGPT-python programming method. Background Art
[0002] ChatGPT (GPT-4) is an advanced natural language processing model developed by OpenAI in the United States. Through training on a large-scale dataset, it can generate human-like conversation content. ChatGPT has demonstrated powerful auxiliary capabilities in data processing, logical reasoning, and code compilation. These advantages not only improve work efficiency but also provide effective new methods for solving complex technical problems. In the engineering field, complex calculation problems are often solved through mechanical calculations and numerical methods. For example, in civil engineering, these methods are used to analyze the stability and strength of slope structures. These calculation methods enable engineers to more accurately predict structural behavior, optimize designs, and thus improve the safety and economy of engineering.
[0003] Although complex calculation problems in the engineering field can be solved through mature mechanical models and numerical methods, traditional methods still have certain limitations in terms of implementation efficiency and flexibility. Especially when developing calculation tools for specific problems, engineers often face the following challenges: high programming threshold, traditional programming requires mastering specific language syntax and technical details, and for engineers without a computer background, additional learning costs may be required; long development cycle, from problem modeling to implementation, a long development cycle is required, especially when dealing with complex multi-physical field coupling or high-dimensional optimization problems; poor algorithm transparency, most current commercial software is a "black box" non-open source toolset, and it is difficult for users to understand the internal calculation process. The lack of transparent and effective reference tool scripts will greatly increase the difficulty of program development when compiling only based on basic calculation theories.
[0004] To solve the above problems, this application aims to construct a human-machine collaborative programming method with ChatGPT as the core, propose a ChatGPT-python programming method, explore the solution path for engineering calculation problems driven by natural language, and take the three-dimensional slope stability analysis in the field of civil engineering as an example, using ChatGPT to assist in case data processing, calculation logic reasoning, and algorithm code implementation. Summary of the Invention
[0005] To solve the above technical problems, the present invention provides the following technical solutions:
[0006] The ChatGPT-python programming method of the present invention includes the following steps:
[0007] (1) Problem Definition: By briefly describing the engineering problem, proposing a solution, and then conducting a feasibility demonstration of the solution. After the feasibility demonstration passes, the engineering geometry situation is prompted, and a geometric schematic diagram is drawn. Finally, an engineering practical demonstration is carried out to complete the problem definition;
[0008] (2) Algorithm Design: According to the problem definition, the initial parameters of the feasible solution are prompted, and the adaptive judgment boundary conditions are determined. An engineering practical demonstration is carried out. When it meets the engineering reality, the algorithm steps of the feasible solution are prompted, and a complete algorithm flow is proposed. An algorithm feasibility demonstration is carried out. When the algorithm flow is feasible, the algorithm design can be completed;
[0009] (3) Code Implementation: According to the algorithm design, the work content of the process is prompted, the working code of the process is compiled, and the code is run and tested. When the work requirements are completed, the working code of each process is compiled in turn, the complete problem-solving code is compiled, and the code is finally tested. When the code runs correctly, the code implementation is completed.
[0010] As a preferred technical solution of the present invention, the problem definition process can preliminarily test ChatGPT's understanding of the given engineering problem, thereby laying a foundation for the implementation of subsequent algorithm design.
[0011] As a preferred technical solution of the present invention, when conducting a feasibility demonstration of the proposed solution in the problem definition stage, if the feasibility demonstration does not meet the engineering reality, it is necessary to continue to propose a solution according to the briefly described engineering problem and conduct a feasibility demonstration again.
[0012] As a preferred technical solution of the present invention, if the engineering practical demonstration in the problem definition stage does not meet the engineering reality, it is necessary to draw a geometric schematic diagram again according to the prompted engineering geometry situation and continue the engineering practical demonstration.
[0013] As a preferred technical solution of the present invention, when conducting an engineering practical demonstration according to the initial parameters of the feasible solution and the boundary conditions in the algorithm design stage, if it does not meet the engineering reality, it is necessary to continue to prompt the initial parameters of the new feasible solution, adaptively determine the boundary conditions and continue the engineering practical demonstration.
[0014] As a preferred technical solution of the present invention, if the algorithm flow is incorrect when conducting an algorithm feasibility demonstration on the complete algorithm flow in the algorithm design stage, it is necessary to continue to prompt the algorithm steps of the feasible solution and propose a complete algorithm flow, and conduct an algorithm feasibility demonstration again.
[0015] As a preferred technical solution of the present invention, when the running test of the process working code in the code implementation stage does not complete the work requirements, it is necessary to compile the process working code again according to the prompted process work content and conduct a code running test.
[0016] As a preferred technical solution of the present invention, during the code implementation stage, when there is an error in the code during the final inspection of the complete problem-solving code, it is necessary to recompile each process to obtain the complete problem-solving code and continue with the final code inspection.
[0017] The beneficial effects of the present invention are as follows:
[0018] The present invention includes three main steps: problem definition, in which the engineering situation is described in detail and ChatGPT is guided to generate an engineering schematic diagram; algorithm design, in which the calculation problem is elaborated and ChatGPT is required to provide an effective solution; and code implementation, in which a feasible programming solution is generated based on computational theory. Intelligent suggestions are provided in each process, and manual review ensures the theoretical accuracy and engineering feasibility of the results. Taking the three-dimensional slope stability analysis as an example and comparing with the calculation results of commercial software, it is verified that the Python algorithm obtained by ChatGPT programming has good calculation accuracy, providing an innovative auxiliary means for engineering calculations and demonstrating the great application prospects of artificial intelligence in the field of civil engineering. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the present invention, and do not constitute a limitation to the present invention. In the drawings:
[0020] Figure 1 is a flow schematic diagram of the ChatGPT-python programming method of the present invention;
[0021] Figure 2 is a three-dimensional geometric schematic diagram of the slope in the ChatGPT-python programming method of the present invention;
[0022] Figure 3 is a cross-sectional schematic diagram of the slope in the ChatGPT-python programming method of the present invention;
[0023] Figure 4 is a work flow diagram of the brief description of the engineering problem and the proposed solution in the ChatGPT-python programming method of the present invention;
[0024] Figure 5 is a schematic diagram of the geometric modeling result of the three-dimensional slope model in the ChatGPT-python programming method of the present invention;
[0025] Figure 6 is a schematic diagram of the division process of the slope body and the force condition at the bottom of the slices in the ChatGPT-python programming method of the present invention;
[0026] Figure 7It is a schematic diagram of the code implementation process for calculating the mechanical parameters of the three-dimensional simplified Janbu method column in the ChatGPT-python programming method of the present invention;
[0027] Figure 8 It is a schematic diagram of the complete code calculation process structure in the three-dimensional simplified Janbu method of the limit equilibrium method in the ChatGPT-python programming method of the present invention;
[0028] Figure 9 It is a schematic diagram of the complete code calculation process structure in the code implementation process of the strength reduction method in the ChatGPT-python programming method of the present invention;
[0029] Figure 10 It is a distribution diagram of the stability coefficient obtained by the ChatGPT-Python programming method and the commercial software GeoStudio2024 under the limit equilibrium method in the ChatGPT-python programming method of the present invention;
[0030] Figure 11 It is a relationship curve between the strength reduction coefficient and the iteration convergence criterion index of the ChatGPT-Python programming method and the commercial software Abaqus2024 under the strength reduction method in the ChatGPT-python programming method of the present invention;
[0031] Figure 12 It is a broken line diagram of the relationship between the internal friction angle variable of the soil body and the stability coefficient in the ChatGPT-python programming method of the present invention;
[0032] Figure 13 It is a broken line diagram of the relationship between the cohesion variable of the soil body and the stability coefficient in the ChatGPT-python programming method of the present invention. Detailed implementation manners
[0033] The following is a description of the preferred embodiments of the present invention with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are only for the purpose of illustrating and explaining the present invention, and are not intended to limit the present invention.
[0034] Embodiment: As Figure 1 shown, the ChatGPT-python programming method of the present invention includes the following steps:
[0035] (1) Problem definition: By briefly describing the engineering problem, proposing a solution, then conducting a feasibility demonstration on the solution. After the feasibility demonstration is passed, the engineering geometry situation is prompted, and a geometric schematic diagram is drawn. Finally, an engineering actual demonstration is carried out to complete the problem definition; the problem definition process can preliminarily test ChatGPT's understanding of the given engineering problem, and thus lay a foundation for the implementation of subsequent algorithm design.
[0036] When conducting a feasibility demonstration of the proposed solutions in the problem definition phase, if the feasibility demonstration does not meet the engineering practice, it is necessary to continue to propose solutions based on the described engineering problems and conduct a feasibility demonstration again.
[0037] If the engineering practice demonstration in the problem definition phase does not meet the engineering practice, it is necessary to draw a geometric schematic diagram again according to the prompted engineering geometry and continue the engineering practice demonstration.
[0038] (2) Algorithm design: Prompt the initial parameters of the feasible solution according to the problem definition, determine the adaptive decision boundary conditions, and conduct an engineering practice demonstration. When the engineering practice is met, prompt the algorithm steps of the feasible solution and propose a complete algorithm flow, and conduct an algorithm feasibility demonstration. When the algorithm flow is feasible, the algorithm design can be completed; in the algorithm design phase, when conducting an engineering practice demonstration based on the initial parameters and boundary conditions of the feasible solution and it does not meet the engineering practice, it is necessary to continue to prompt the initial parameters of the new feasible solution, adaptively determine the boundary conditions and continue the engineering practice demonstration.
[0039] The goal of the algorithm design phase is to adaptively determine the initial parameters and boundary conditions of the known feasible solutions. The accurate determination of these initial parameters and boundary conditions is the basis for subsequent code implementation. On the premise of ensuring that ChatGPT accurately understands the engineering practice situation, and then obtain the complete algorithm flow of the corresponding feasible solution.
[0040] If there is an error in the algorithm flow during the algorithm feasibility demonstration of the complete algorithm flow in the algorithm design phase, it is necessary to continue to prompt the algorithm steps of the feasible solution and propose a complete algorithm flow, and conduct the algorithm feasibility demonstration again.
[0041] (3) Code implementation: Prompt the work content of the process according to the algorithm design, compile the work code of the process, and conduct a running test on the code. When the work requirements are completed, compile the work of each process in turn, compile the complete problem-solving code, and conduct a final test on the code. When the code runs without error, the code implementation is completed.
[0042] In the code implementation phase, it is necessary to gradually prompt ChatGPT to generate Python code through natural language description. This process is to compile the known complete algorithm flow in batches, and finally conduct manual assembly work on all Python code segments to form the complete code for solving the original engineering calculation problem. Considering the subjectivity of the description of the manual prompt words and the limitations of ChatGPT's natural language generation, the reply results of ChatGPT based on the manual prompt words are not always completely accurate. Therefore, we have conducted manual verification and demonstration processing on the reply information generated in each step to ensure the accuracy of solving the original engineering problem to the greatest extent.
[0043] During the code implementation phase, when running tests on the process working code and there are unfinished work requirements, it is necessary to recompile the process working code according to the prompt process work content and conduct code running tests again.
[0044] During the final inspection of the complete problem-solving code in the code implementation phase, if there are errors in the code running, it is necessary to recompile each process work to obtain the complete problem-solving code and continue with the final code inspection.
[0045] As an auxiliary tool for engineering problem-solving, the advantage of ChatGPT lies in its ability to quickly understand and process complex natural language descriptions, correspondingly generate engineering visualization diagrams and algorithmic processes, and gradually realize the compilation and integration of code. Through this workflow, engineers can solve complex engineering calculation problems more efficiently, improving work efficiency and the accuracy of solutions.
[0046] Taking the three-dimensional slope stability analysis as an example below, the problems in this example cover multiple disciplines such as soil mechanics and geology, and can fully verify the performance of the ChatGPT-python programming method in dealing with complex calculation problems. Slope stability analysis has extensive practical applications in fields such as highways, railways, and water conservancy projects, and can fully demonstrate the potential and advantages of ChatGPT in assisting in dealing with complex and diverse engineering problems.
[0047] The three-dimensional geometric diagram of the slope and the cross-sectional diagram of the slope are as Figure 2 and Figure 3 shown. The key slope geometric parameters include the slope height H, slope inclination angle α, slope width W, lengths of the upper and lower platform of the slope T1T2, and soil layer width S, which can correspond to the Figure 2 spatial vertex coordinate values in Figure 2 to determine the geometric parameters. The key slope geological parameters include the unit weight γ of the soil, cohesion c of the soil, and internal friction angle of the soil, which can correspond to the definition of the slope physical properties in 3 to determine the geological parameters. The key parameters of this example are correspondingly H = 8m, α = 50°, W = 10m, T1 = T2 = 10m, S = 10m, γ = 17KN / m
[0048] Problem definition: To obtain a feasible solution to the example problem, we first briefly summarize the engineering problem to be solved and input the problem prompt into the GPT-4 model. The workflow for the brief description of the engineering problem and the proposed solution is as Figure 4 shown. After receiving the prompt, the GPT-4 model provides multiple theoretical methods for solving the three-dimensional slope stability analysis problem, lists the advantages and disadvantages of each method, and provides corresponding application suggestions according to the characteristics of different methods.
[0049] Based on the application suggestions provided by the GPT-4 model, a three-dimensional stability analysis is carried out for the homogeneous soil slope with complex geometric shapes. The three-dimensional simplified Janbu method and the strength reduction method are selected, and both show good applicability. The three-dimensional simplified Janbu method is a three-dimensional limit equilibrium method extended from the Janbu slice method, especially suitable for dealing with slope problems with complex geometric shapes. This method has high computational efficiency and adaptability, but under low-cost computing conditions, its accuracy may be limited in some complex cases. Therefore, the three-dimensional simplified Janbu method can be used as a tool for preliminary analysis. On the other hand, although the strength reduction method requires finite element analysis combined with higher computing resources, its powerful modeling ability enables it to simulate the three-dimensional stress distribution and nonlinear behavior of the slope in detail, which is suitable for deeply revealing the details of slope stability. Combining these two methods can effectively achieve the organic connection between preliminary evaluation and in-depth analysis, thus ensuring the comprehensiveness and accuracy of the analysis results.
[0050] On the basis of preliminarily summarizing the engineering problems and obtaining all theoretical methods, key parameters are further input into the GPT-4 model to describe the specific engineering geometric situation. In order to evaluate the recognition accuracy of the GPT-4 model for engineering geometry, it is required to draw the corresponding engineering geometric schematic diagram while receiving the prompt, providing a reference for subsequent engineering actual verification. Figure 5 The geometric modeling results of the three-dimensional slope model are shown. To help the GPT-4 model more accurately recognize the engineering geometric situation, we first set coordinate points in the three-dimensional space coordinate system to draw a complete spatial graph. At the same time, the slope geological parameters are set through variable assignment in the Python code, and the definition of geological parameters is added to the properties of the slope soil layer.
[0051] Algorithm design: On the basis of the GPT-4 model's understanding of the actual engineering problem, it is prompted with the required initial parameters and boundary conditions to provide a feasible solution method. The initial parameters include geometric parameters for constructing the three-dimensional space model and geological parameters for defining the properties of the soil layer. The Dirichlet boundary conditions are set as follows: all-direction displacements on the geometric bottom surface are completely fixed, the vertical-direction displacements on the geometric side surfaces are fixed, and all-direction displacements on the geometric top surface are completely free.
[0052] The three-dimensional simplified Janbu method divides the sliding slope body into discrete vertical slice columns, assumes that the sliding surface is spherical, and calculates the sliding force and anti-sliding force acting on the slice columns through the static equilibrium conditions in the x-axis and z-axis directions. This method assumes that the inter-column interaction force in the z-axis direction can be ignored and does not consider the shear force parallel to the yoz plane. The process of dividing the slope body and the force condition at the bottom of the slices are as Figure 6As shown in the figure. When considering the force equilibrium of the bottom sliding surface of the strip column in the x - direction and z - direction, the static equilibrium relationships of the self - weight \(W_n\), normal force \(N_n\), and tangential force \(T_n\) of the bottom sliding surface of the \(n\)th slice are as follows:
[0053] W n =\(\gamma V\) n (1);
[0054]
[0055] The slope stability coefficient is defined as the ratio of the overall anti - sliding moment to the sliding moment of the potential sliding slope. The calculation formula for the slope stability coefficient \(F_s\) of the three - dimensional simplified Janbu method without correction coefficient given by Hungr et al. is:
[0056]
[0057] where \(V_n\) is the volume of the \(n\)th slice, is the angle between the bottom sliding surface of the \(n\)th strip column and the positive x - axis, \(A_n\) is the area of the bottom sliding surface of the \(n\)th strip column, is the angle between the normal vector of the bottom sliding surface of the \(n\)th strip column and the positive z - axis, and \(n_0\) is the total number of strip columns in the potential sliding area.
[0058] When the slope geometric parameters, geological parameters, and the position of the potential sliding surface are determined, the value of \(F_s\) can be calculated to judge the stability of the corresponding slope. When \(F_s>1.50\), it indicates that the soil slope has sufficient safety reserves and can withstand the environmental and load conditions under normal conditions.
[0059] The strength reduction method is a calculation method for the stability coefficient combined with finite element analysis. Its principle is based on gradually weakening the shear strength parameters (cohesion \(c\) and internal friction angle) of the soil or rock mass until the slope reaches the limit equilibrium state. The calculation expression for the reduced shear strength parameters given by Song Erxiang is:
[0060]
[0061] where \(c\) and are the maximum shear strength parameter values that the soil can provide; \(c_m\) and \(m\) are the shear strength parameter values that can be provided after reduction; \(F_r\) is the strength reduction coefficient.
[0062] During the reduction process, when the shear strength of the soil mass is equal to the shear stress acting on the potential sliding surface, the slope is in the critical state of instability. Therefore, the reduction coefficient \(F_r\) at the limit equilibrium state can be used as the overall stability coefficient \(F_s\) of the slope.
[0063] Code implementation: Based on the complete Python algorithm process, we elaborated on the theoretical logic of the calculation to guide the GPT-4 model to generate or modify the corresponding Python code snippets. The output Python code snippets will be imported into the scientific computing integrated development environment Spyder and tested with example data to ensure that the basic tasks of the corresponding algorithm logic can be completed. Figure 7 It shows the working part related to the calculation of bar mechanical parameters during the code implementation process. Through the discussion of the mechanical parameter theory, this code implementation example generates function definitions and example call functions for the corresponding variable operations. By gradually implementing each step of the algorithm process in a similar way, we finally obtain the code snippets for all algorithm logic tasks. After implementing the complete algorithm process, all code snippets will be manually assembled, and the function definitions or discrete algorithm logic fragments of different algorithm logic tasks will be correctly called in the main program. The final complete main program code will be further executed in Spyder for statement optimization and running tests.
[0064] In the three-dimensional simplified Janbu method of the limit equilibrium method, the complete code calculation process is as Figure 8 shown. After completing the modeling process, an initial bar database is established by defining the mesh cutting plane. For each determined potential sliding surface, the spatial surface equation of the sliding surface is established to obtain the geometric information of the bars in the potentially sliding part. Combining specific theoretical formulas, the calculation of the geometric parameters, mechanical parameters of the potentially sliding bars, and the overall stability coefficient of the potentially sliding slope is gradually completed. By traversing the calculation and result recording within the range of all potential sliding surfaces, the potential sliding surface corresponding to the minimum slope stability coefficient, that is, the critical sliding surface, can be determined. Based on the visualization effect of the slip surface result record, the spatial distribution map of the slip surface stability coefficient can be obtained.
[0065] During the code implementation process of the strength reduction method, the complete code calculation process is as Figure 9As shown. Based on the calculation logic proposed by the GPT-4 model, we referred to the omnidirectional quantization method proposed by ERMáK M et al. for implementing the strength reduction method calculation under three-dimensional elastoplastic conditions. During the slope model mesh generation process, first, one-dimensional node distributions are obtained by linearly distributing nodes at equal intervals in each direction, and then complete three-dimensional node coordinates are generated through repeated permutations and splicing in three directions. The nodes of tetrahedral elements are identified using a defined logical index array to obtain the element node number index of each tetrahedral element. A similar method can also be used to extract the triangular mesh node information on the model surface. At the end of the model mesh generation, the Dirichlet boundary conditions located on the model surface are defined using a logical array. For the implementation process of finite element numerical integration, we use the Gaussian numerical integration method with 11 integration points of fourth-order accuracy. During the calculation of the basic finite element formulation, the Jacobian matrix components can be assembled through the partial derivatives of the second-order shape function in each direction, thereby calculating the value of the Jacobian determinant. Furthermore, the strain matrix is assembled at all element nodes to establish the relationship between the strain vector and the displacement vector. Similarly, the global stiffness matrix and the total body force vector are assembled to represent the system stiffness relationship and the equivalent nodal load distribution, respectively. During the implementation of the nonlinearity of the soil material, the soil Mohr-Coulomb yield criterion is completed through the following steps: ① According to the current strain state, calculate the stress decision criterion involving material strength and strain invariants; ② Based on the stress decision criterion, judge whether the current stress state reaches the yield criterion. If it does not reach the yield, the linear elastic method is used for calculation; if the yield criterion is satisfied, the stress is corrected through the flow rule and the hardening rule until the stress is on the yield surface; ③ Based on the plastic strain and the hardening model, update the stress state of the material. The iterative steps of the Newton's method solution process are as follows: ① Establish the initial iterative displacement field; ② Calculate the theoretical calculation residual under the current displacement field; ③ Linearize the nonlinear problem through Taylor expansion; ④ Solve the linear equations to obtain the displacement solution; ⑤ Continuously iterate and update the displacement solution until the residual accuracy reaches the predetermined solution accuracy requirement or the number of iterations reaches the maximum set number of times.
[0066] Algorithm implementation results and performance analysis: Based on the given three-dimensional slope case, the algorithm logic code is implemented in combination with the GPT-4 model. Figure 10The distribution diagrams of the stability coefficients obtained by the ChatGPT-Python programming method and the commercial software GeoStudio2024 under the limit equilibrium method are plotted. The arc surface shown in the figure is the intersection line of the potential slip surface on the slope surface, and the color represents the magnitude of the stability coefficient of the corresponding slip surface. The white arc surface line is the calculated critical slip surface. Finally, the magnitudes of the stability coefficients corresponding to the obtained critical slip surfaces are 1.628 and 1.609 respectively. By comparing the coordinate values of the slip sphere centers corresponding to the critical slip surfaces, the differences in the coordinate values in each direction of the two are less than 0.70, verifying that the limit equilibrium method based on the ChatGPT-Python programming method has good calculation accuracy.
[0067] Figure 11 The relationship curve between the strength reduction factor and the iteration convergence criterion index obtained by the ChatGPT-Python programming method and the commercial software Abaqus2024 under the strength reduction method is presented. The code implemented by the programming method uses the energy criterion. This method calculates the change in the total potential energy of the slope by applying a small disturbance displacement. When approaching the limit equilibrium state, the change in the total potential energy of the system shows non-linearity and gradually approaches positive infinity. The corresponding reduction factor at this time is the maximum value to maintain the equilibrium state. If this value is exceeded, the slope will become unstable. Most of the popular finite element software for slope stability analysis uses the displacement mutation or iteration convergence criterion. The results under the displacement mutation criterion of the commercial software Abaqus2024 are used for comparison. Finally, the magnitudes of the stability coefficients corresponding to the obtained critical slip surfaces are 1.4170 and 1.4360 respectively. In the case of a given three-dimensional slope model, it is further verified that the strength reduction method based on the ChatGPT-Python method has good calculation accuracy.
[0068] Under the same operating environment, the operating environments of the algorithms corresponding to the two methods are both based on the same hardware configuration: a 13th Gen Intel(R) Core(TM) i7-13700H 2.40GHz CPU with 16GB of RAM and an NVIDIA GeForce RTX 4060 Laptop GPU with 8GB of video memory. After building the necessary Python environment with the application Anaconda, the code is run and tested through the scientific computing integrated development environment Spyder. The running time of a single landslide case under the limit equilibrium method is approximately 90 minutes. Compared with the 10-minute calculation time of the commercial software GeoStudio 2024, the main difference is that the commercial software uses a heuristic optimization algorithm of the Cuckoo Search Algorithm and incorporates GPU acceleration technology for integration. This indicates that without prompting the GPT-4 optimization algorithm, the implemented code only performs calculations according to conventional computational theory and does not optimize the algorithm efficiency. For the strength reduction method, the running time of a single landslide case is approximately 8 hours. After integrating GPU acceleration and using the Generalized Minimal Residual method (GMRES) based on sparse matrices for iterative solution of linear equations, the optimized calculation time is shortened to 60 - 120 minutes. Compared with the calculation time of the commercial software Abaqus 2024 (30 - 90 minutes), the calculation efficiency has been significantly improved after the GPT-4 model optimizes the code of the strength reduction method. This optimization result verifies that when prompting the GPT-4 model to integrate GPU acceleration, the generated code can be maximally close to the calculation efficiency of commercial software.
[0069] Under the same operating environment, the operating environments of the algorithms corresponding to the two methods are both based on the same hardware configuration: a 13th Gen Intel(R) Core(TM) i7-13700H 2.40GHz CPU with 16GB of RAM and an NVIDIA GeForce RTX 4060 Laptop GPU with 8GB of video memory. After building the necessary Python environment using the application Anaconda, the code is run and tested through the scientific computing integrated development environment Spyder. The running time of a single landslide case under the limit equilibrium method is approximately 90 minutes. Compared with the 10-minute calculation time of the commercial software GeoStudio 2024, the main difference is that the commercial software uses heuristic optimization algorithms such as the Cuckoo Search Algorithm and incorporates GPU acceleration technology for integration. This indicates that without the GPT-4 prompt optimization algorithm, the implemented code only performs calculations according to conventional computational theory and does not optimize the algorithm efficiency. For the strength reduction method, the running time of a single landslide case is approximately 8 hours. After integrating GPU acceleration and using the Generalized Minimal Residual method (GMRES) based on sparse matrices to iteratively solve linear equations, the optimized calculation time is shortened to approximately 60 - 120 minutes. Compared with the calculation time of the commercial software Abaqus 2024 (30 - 90 minutes), after the GPT-4 model optimizes the code for the strength reduction method, the calculation time is already close to the efficiency of the commercial software. This optimization result verifies that with the full integration of GPU accelerated computing, the code generated by GPT-4 can significantly improve the calculation efficiency.
[0070] The codes implemented for the limit equilibrium method and the strength reduction method are not only applicable to the slope in this case but also have good scalability. The codes for all key calculation processes are encapsulated in functions, and by simply adjusting the inputs according to the geometric or mechanical parameters of different slope projects, they can be applied to slope stability analysis in different scenarios. Figure 12 and Figure 13 shows the changing trends of the stability coefficient calculation results corresponding to the four methods under different variable conditions. The results indicate that the stability coefficients calculated by the four methods all increase with the increase of the internal friction angle or cohesion of the soil, which further verifies the reliability of the programming method in this paper.
[0071] In summary, we can conclude that: (1) ChatGPT performs well in the application of three-dimensional slope stability analysis. Consistent with the calculation results of commercial software, it verifies its auxiliary role in solving engineering problems, especially in data processing, logical reasoning, and code writing, demonstrating significant advantages.
[0072] (2) ChatGPT is not always able to guarantee accuracy when dealing with complex mathematical problems and advanced logical tasks. Therefore, in practical applications, manual verification of the calculation results of each step is necessary. Refining complex steps into multiple sub-steps can improve the accuracy of problem-solving and enhance the reliability of the model in engineering problems.
[0073] (3) The solving efficiency and accuracy of ChatGPT highly depend on the detail and accuracy of the input prompt words. This emphasizes the key role of engineering expertise in guiding and optimizing ChatGPT to solve specific engineering problems.
[0074] (4) ChatGPT shows great potential in generating engineering calculation codes. In the future, through diverse verification and expansion in different engineering scenarios, ChatGPT is expected to drive the development of the civil engineering field towards intelligence and automation.
[0075] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing embodiments or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. ChatGPT-python programming method, characterized in that, The following steps are involved: (1) Problem definition: The problem is defined by briefly describing the engineering problem, proposing a solution, and then demonstrating the feasibility of the solution. After the feasibility demonstration is passed, the engineering geometry is prompted and a geometric diagram is drawn. Finally, the actual engineering demonstration is carried out to complete the problem definition. (2) Algorithm design: Prompt the initial parameters of feasible methods according to the problem definition, determine the boundary conditions for adaptive judgment, and conduct engineering practice demonstration. When the engineering practice is met, the algorithm steps of feasible methods are prompted, and a complete algorithm flow is proposed to conduct algorithm feasibility demonstration. When the algorithm flow is feasible, the algorithm design is completed; (3) Code implementation: Compile the process work code according to the algorithm design prompts, and run the code to check. When the work requirements are completed, compile each process work in sequence, compile the complete problem-solving code, and perform a final check on the code. When the code runs correctly, the code implementation is completed.
2. The ChatGPT-python programming method according to claim 1, characterized in that: The problem definition process can preliminarily test ChatGPT's understanding of the given engineering problem, thereby laying the foundation for the implementation of subsequent algorithm design.
3. The ChatGPT-python programming method according to claim 1, characterized in that: During the problem definition phase, when the feasibility of the proposed solution is demonstrated, if the feasibility demonstration does not meet the actual engineering requirements, it is necessary to continue to propose solutions based on the briefly described engineering problem and conduct the feasibility demonstration again.
4. The ChatGPT-python programming method according to claim 1, characterized in that: If the actual engineering demonstration in the problem definition stage does not meet the actual engineering situation, it is necessary to draw a geometric diagram again according to the prompted engineering geometry situation and continue the actual engineering demonstration.
5. The ChatGPT-python programming method according to claim 1, characterized in that: During the algorithm design phase, when the actual engineering demonstration is carried out according to the initial parameters and boundary conditions of the feasible method, if the actual engineering demonstration is not satisfied, it is necessary to continue to prompt the initial parameters of the new feasible method, adaptively determine the boundary conditions and continue the actual engineering demonstration.
6. The ChatGPT-python programming method according to claim 1, characterized in that: If the algorithm flow is incorrect when conducting algorithm feasibility demonstration on the complete algorithm flow during the algorithm design phase, it is necessary to continue to prompt feasible algorithm steps and propose a complete algorithm flow, and conduct algorithm feasibility demonstration again.
7. The ChatGPT-python programming method according to claim 1, characterized in that: When the code implementation stage performs a run check on the process work code and fails to complete the work requirements, it is necessary to compile the process work code again according to the prompted process work content and perform a code run check.
8. The ChatGPT-python programming method according to claim 1, characterized in that: During the code implementation phase, if the complete problem-solving code is finally checked and the code runs incorrectly, it is necessary to compile each process again to obtain the complete problem-solving code and continue the final code check.
Citation Information
Patent Citations
Design method and device of photonic crystal surface emitting laser and intelligent terminal
CN118036370A
Unmanned system control method and device based on multistage world model, and medium
CN119270885A
Mine blasting analysis method
CN119294260A
Method for implementing ultimate strength analysis of plate frame structure based on isogeometric analysis
US20240411955A1
Cited By
Bedding rock slope earthquake instability mechanism analysis method, medium and system
CN122042820A
A method, medium, and system for analyzing the seismic instability mechanism of bedding rock slopes.
CN122042820B