Automatic code generation method for structural reliability analysis based on knowledge graphs and GPT models
Reliability analysis is widely used in engineering structures for safety assessment,but the variety of reliability methods,low automation of the analysis codes,and the difficulties in reuse require reliable code generation methods.Generative Pre-Trained Transformer(GPT)models have been replacing manual programming work by automatic code generation.However,its application in engineering is limited by the small amount of learnable data and the difficulty of problem matching.In this paper,we propose a code prediction method for Matlab reliability analysis by combining multi-category reliability knowledge graphs and a GPT-based code autocompletion model.We used a well-designed source code preprocessing and denoising strategy,and knowledge graphs to transfer simulation intentions.We also employed conditional code generation training.These efforts drastically increase the learning performance of small data size,and enable automatic code generation with high accuracy and problem matching.Finally,the proposed method is verified by three reliability knowledge graph cases.