A large casting defect repair welding path planning method and system based on reinforcement learning
By using a reinforcement learning-based method, welding paths for repairing defects in large castings are generated, solving the problems of low efficiency and thermal stress concentration in traditional methods, and realizing efficient and safe casting repair welding path planning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YANSHAN UNIV
- Filing Date
- 2026-04-13
- Publication Date
- 2026-07-07
AI Technical Summary
The planning of welding paths for repairing defects in large castings relies on manual experience, which results in low planning efficiency and a tendency to generate thermal stress concentration. Traditional algorithms are difficult to adapt to the strong coupling characteristics of multi-physics fields and transfer learning, leading to low production efficiency.
A reinforcement learning-based approach is adopted to acquire casting defect data through a visual sensor, generate hypergraph network data, generate welding paths using graph convolutional neural networks and policy networks, optimize the paths by combining a transient thermophysical field proxy model, introduce a hard constraint shielding mechanism and a comprehensive reward function, and generate efficient and safe welding paths.
It enables rapid adaptive welding path planning, reduces reliance on human experience, improves planning efficiency, avoids thermal stress concentration, and enhances repair quality and production efficiency.
Smart Images

Figure CN122346643A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated welding, path planning and artificial intelligence, specifically to a method and system for welding path planning for repairing defects in large castings based on reinforcement learning. Background Technology
[0002] In high-end equipment manufacturing fields such as aerospace, shipbuilding, water conservancy and hydropower, and heavy machinery, large castings, as core load-bearing components, are key parts that ensure the structural strength, service stability, and service life of equipment. Due to the inherent physical characteristics of the casting process, large castings inevitably produce internal or surface defects such as porosity, slag inclusions, shrinkage cavities, cold shuts, and microcracks during the casting, cooling, and solidification processes. These defects directly reduce the mechanical properties and fatigue life of the components. Therefore, it is necessary to grind and groove the defective areas and use multi-axis industrial robots to complete automated welding repairs to ensure the structural integrity and service reliability of large castings.
[0003] Defects in large castings generally exhibit randomness, discreteness, and high-density clustering. Planning the welding path for defect repair has long been a core technological bottleneck restricting the efficiency and quality of automated repair of large castings. Existing technologies mainly suffer from the following prominent problems: First, path planning is highly dependent on human experience, resulting in poor planning efficiency and optimization effects. Traditional welding repair paths are mainly completed by senior welding engineers through manual teaching and offline programming software to set points one by one. When dealing with complex large castings containing thousands of tiny defects, the manual planning cycle can take several weeks or even months. This is not only time-consuming and costly, but also makes it difficult to achieve optimal planning of the welding path from a global perspective.
[0004] Secondly, it is difficult to adapt to the strong coupling characteristics of multiple physical fields in welding, and multi-objective optimization has inherent defects. The welding process is accompanied by intense local heat input. If the welding path planning is unreasonable, it is easy to cause excessive local heat accumulation and residual thermal stress concentration in the welding torch working area, which in turn can lead to secondary cracking or macroscopic deformation of the heat-affected zone of the base material, significantly reducing the repair quality. Traditional path search algorithms (such as ant colony algorithms, genetic algorithms, numerical analysis solvers, etc.) only take the shortest path as the single optimization objective, and cannot incorporate non-differentiable physical constraints such as thermal stress and heat accumulation into the global optimization framework, and cannot take into account both path efficiency and welding thermophysical safety constraints.
[0005] Third, the algorithm lacks generalization and transfer learning capabilities, making it difficult to adapt to the customized production characteristics of large castings. Large castings are mostly produced in small batches on a single-piece basis, and the defect distribution topology of different castings varies significantly. When faced with a completely new casting, traditional heuristic planning algorithms need to conduct hundreds of thousands of iterative searches from scratch, resulting in huge computational overhead and extremely low planning efficiency. Furthermore, they cannot extract the planning experience from historical castings into transferable prior knowledge, making it difficult to reuse planning capabilities, causing a large waste of computational resources, and severely slowing down the overall production cycle.
[0006] No effective solutions have yet been proposed to address the problems in the relevant technologies. Summary of the Invention
[0007] (a) Technical problems to be solved To address the shortcomings of existing technologies, this invention provides a method and system for welding path planning in the repair of defects in large castings based on reinforcement learning. This method has the advantages of reducing reliance on human experience, improving path planning efficiency, and avoiding thermal stress concentration. It solves the problems of excessive reliance on human experience, time-consuming path planning, and easy thermal stress concentration in the repair of large castings.
[0008] (II) Technical Solution To achieve the aforementioned advantages of reducing reliance on human experience, improving path planning efficiency, and avoiding thermal stress concentration, the specific technical solution adopted by this invention is as follows: According to one aspect of the present invention, a method for planning welding paths for repairing defects in large castings based on reinforcement learning is provided, the method comprising: S1. Determine the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system, obtain the defect data of large castings based on the transformation relationship, and preprocess the defect data to generate hypergraph network data. S2. Based on the hypergraph network data and the sequence Markov decision process, determine and concatenate multidimensional features to generate the state feature code for the current time step; S3. Based on multi-dimensional features, generate the action space of welding node positions and corresponding associated welding process parameters, and establish a hard constraint shielding mechanism; S4. Input the state feature encoding into the pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation. Combine the preset policy network and value network with the hard constraint masking mechanism as the constraint condition to generate a defect repair welding path planning sequence. S5. The three-dimensional residual stress field corresponding to the defect repair welding path planning sequence is output using the pre-constructed transient thermophysical field proxy model. The policy network and value network are iteratively optimized through the near-end policy optimization algorithm to generate the optimal defect repair welding path planning sequence, so as to realize the defect repair welding path planning of large castings.
[0009] Optionally, the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system is determined, and defect data of large castings is obtained based on the transformation relationship. The defect data is then preprocessed to generate hypergraph network data, including: S11. By using the hand-eye calibration of the vision sensor and the end effector mounted on the welding robot, the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system is determined, and the defect area of the large casting is scanned according to the preset scanning trajectory to obtain the three-dimensional point cloud data of the defect area in order to generate a three-dimensional scanning model. S12. Based on the three-dimensional scanning model, non-destructive testing technology is used to obtain defect data of large castings, and defect point sets are extracted from the defect data. S13. Use a multi-level hypergraph partitioning algorithm to perform spatial clustering on the defect point set, and perform voxelization on the spatially clustered defect node set to generate hypergraph network data.
[0010] Optionally, a multi-level hypergraph partitioning algorithm is used to spatially cluster the defect point set, and the spatially clustered defect node set is voxelized to generate hypergraph network data including: S131. Using the defect points as the initial nodes of the hypergraph network, perform spatial clustering on the adjacent initial nodes, and divide the hypergraph network after spatial clustering into subgraphs to determine several target defect clusters and discrete defect points. S132. Based on the global planning of the target defect cluster, the discrete defect points are locally planned using the thermal diffusion force-guided algorithm based on physical simulation. S133. Combining the results of local planning, the spatial distance between defect nodes, and the thermal conductivity properties of the casting material, an adjacency matrix characterizing the thermodynamic interaction between defect nodes is constructed using a distance-based exponential decay weighting mechanism, thereby generating hypergraph network data.
[0011] Optionally, using defect points as initial nodes in the hypergraph network, spatial clustering is performed on adjacent initial nodes, and the hypergraph network after spatial clustering is divided into subgraphs to determine several target defect clusters and discrete defect points, including: S1311. Take each defect point in the defect point set as the initial node of the hypergraph network and calculate the spatial Euclidean distance between adjacent initial nodes. S1312. Merge adjacent initial nodes whose spatial Euclidean distance is less than the preset clustering threshold into supernodes to generate the optimal hypergraph network. S1313. Using minimizing the sum of the weights of the connecting edges between different subgraphs as the objective function, the optimal hypergraph network is divided into subgraphs to obtain several target defect clusters. S1314. Map the supernodes in each subgraph to the hypergraph network, use a heuristic algorithm to adjust the defect points located at the partition boundary, determine the global planning of the target defect cluster, and treat the defect points not included in the target defect cluster as discrete defect points.
[0012] Optionally, based on the global planning of the target defect cluster, the discrete defect points are locally planned using a physics-based thermal diffusion force-guided algorithm, including: S1321. Set the target defect cluster of the global planning as a fixed anchor point and set the discrete defect points as moving free points. S1322. Based on the attraction and thermal repulsion of the free point, establish a virtual attraction model based on spatial distance and a virtual repulsion model based on thermodynamic density between the free point and the anchor point, respectively. S1323. Based on the virtual gravity model and the virtual repulsion model, calculate the gravitational and repulsive forces acting on the free point as the resultant force, and iteratively calculate the resultant force displacement of the free point in the virtual force field until the virtual force field reaches a state of force equilibrium. S1324. Based on the spatial topological projection position of the free point under the force equilibrium state, the free point is inserted into the local sequence of the adjacent target defect cluster according to the spatial order, so as to realize the local planning of discrete defect points.
[0013] Optionally, the state feature encoding is input into a pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation. This representation is then combined with a pre-defined policy network and value network, using a hard constraint masking mechanism as a constraint condition, to generate a defect repair welding path planning sequence, including: S41. Using the state feature encoding of the current time step as input, a pre-trained edge-based graph convolutional neural network encoder is used to perform multi-layer feature iteration and topological information aggregation to generate a low-dimensional vector embedding representation. S42. Perform feature concatenation on the low-dimensional vector embedding representation, and input the feature concatenation results into the preset policy network and value network respectively, and output the action probability distribution map and the expected value baseline. S43. Based on the action probability distribution map and the expected value baseline, the legality of the action space is filtered using a hard constraint masking mechanism to obtain the target action at the current time step. S44. Execute the target action, and based on the execution result, transfer the environment to the next time step state, and repeat steps S41 to S43 until all defect points are traversed, generating a defect repair welding path planning sequence.
[0014] Optionally, a pre-built transient thermophysical field surrogate model is used to output the three-dimensional residual stress field corresponding to the defect repair welding path planning sequence. The policy network and value network are then iteratively optimized using a near-end policy optimization algorithm to generate the optimal defect repair welding path planning sequence. This enables defect repair welding path planning for large castings, including: S51. Using the spatiotemporal trajectory distribution of the welding heat source as input and the three-dimensional residual stress field as output, a transient thermophysical field proxy model based on Fourier neural operators is constructed, and the transient thermophysical field proxy model is trained using historical finite element simulation data. S52. Take the spatiotemporal trajectory distribution of the welding heat source corresponding to the defect repair welding path planning sequence as input, and use the trained transient thermophysical field proxy model to output the corresponding three-dimensional residual stress field. S53. Based on the three-dimensional residual stress field, the residual thermal stress assessment value is calculated using the distortion energy criterion, and the total time cost is calculated using the half-perimeter boundary box principle to form an assessment index. S54. Based on the evaluation indicators, construct a comprehensive reward function using a sparse reward mechanism, and calculate the total reward value of the defect repair welding path through the comprehensive reward function. S55. Based on the total reward value, the weight parameters of the policy network and the value network are iteratively updated using the generalized advantage estimation and proximal policy optimization algorithm. Based on the iterative update results, the optimal defect repair welding path planning sequence is output to realize the defect repair welding path planning of large castings.
[0015] Optionally, based on the three-dimensional residual stress field, the residual thermal stress assessment value is calculated using the distortion energy criterion, and the total time cost is calculated using the half-perimeter boundary box principle, forming the assessment indicators, including: S531. Based on the distortion energy criterion, the three-dimensional residual stress field is calculated to obtain the local maximum equivalent stress penalty term, and the local maximum equivalent stress penalty term is used as the residual thermal stress evaluation value. S532. Based on the principle of semi-perimeter bounding box, calculate the local semi-perimeter bounding box cost of connected defect points in the three-dimensional residual stress field, and normalize the local semi-perimeter bounding box cost to obtain the total time cost. S533. Combining the residual thermal stress assessment value with the total time cost, an evaluation index is obtained for calculating the comprehensive reward function.
[0016] Optionally, based on the total reward value, the weight parameters of the policy network and value network are iteratively updated using generalized advantage estimation and proximal policy optimization algorithms. The optimal defect repair welding path planning sequence is output based on the iterative update results, including: S551. Based on the total reward value and the expected value baseline, calculate the advantage estimate of the state and action pair using the generalized advantage estimation algorithm, and construct the total loss function by combining the truncation mechanism of the proximal policy optimization algorithm. S552. Using the total loss function as the optimization objective, the near-end policy optimization algorithm is used to perform backpropagation calculation, and the weight parameters of the policy network and the value network are iteratively updated with a preset truncation threshold as a constraint. S553. Based on the iterative update process, obtain the corresponding evaluation return rate and determine whether the evaluation return rate meets the preset early stopping mechanism. If yes, stop the iterative update, freeze the weight parameters of the strategy network and the value network, and output the optimal defect repair welding path planning sequence. If no, continue iterative update until the preset early stopping mechanism is met, and output the optimal defect repair welding path planning sequence to realize the defect repair welding path planning of large castings.
[0017] According to another aspect of the present invention, a reinforcement learning-based welding path planning system for repairing defects in large castings is also provided, the system comprising: The data acquisition and preprocessing module is used to determine the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system, acquire defect data of large castings based on the transformation relationship, and preprocess the defect data to generate hypergraph network data. The state feature encoding generation module is used to determine and concatenate multidimensional features based on hypergraph network data and sequential Markov decision processes to generate the state feature encoding for the current time step. The action space definition and mechanism establishment module is used to generate the action space of welding node positions and corresponding associated welding process parameters based on multi-dimensional features, and to establish a hard constraint shielding mechanism. The feature extraction and path planning module is used to input the state feature encoding into the pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation. Combined with the preset policy network and value network, and with the hard constraint masking mechanism as the constraint condition, it generates a defect repair welding path planning sequence. The reward calculation and model update module is used to output the three-dimensional residual stress field corresponding to the defect repair welding path planning sequence using a pre-built transient thermophysical field proxy model. Iterative optimization of the policy network and value network is performed through a near-end policy optimization algorithm to generate the optimal defect repair welding path planning sequence, so as to realize the defect repair welding path planning of large castings.
[0018] (III) Beneficial Effects Compared with existing technologies, this invention provides a method and system for planning welding paths for repairing defects in large castings based on reinforcement learning, which has the following beneficial effects: (1) This invention has excellent domain adaptive capability and generalized planning capability. It innovatively applies the idea of integrated circuit layout optimization to the field of casting welding repair. By using an edge-based graph convolutional neural network encoder to perform deep feature representation and learning of the defect topology, the model can generate a high-quality welding path directly in sub-second time through zero-sample reasoning when facing castings with new structures and defect distributions after accumulating a large amount of casting repair planning experience. This improves the efficiency of cross-workpiece planning and the applicability of the solution.
[0019] (2) This invention solves the problem of secondary cracking and deformation caused by strong coupling of multiple physical fields in welding. It breaks through the limitation of traditional path algorithms that can only optimize the single objective of spatial distance. Through the hard constraint mask mechanism, illegal actions that are prone to causing local heat exceedance are directly eliminated in the forward inference stage. In addition, residual stress penalty term and heat concentration constraint term are introduced into the comprehensive reward function to guide the model to automatically generate a jumping or ring-shaped macroscopic welding trajectory with uniform thermal stress dispersion, thereby reducing the risk of thermal defects from the planning source.
[0020] (3) This invention improves the efficiency of path calculation and model optimization under large-scale defect nodes. It applies the semi-perimeter bounding box algorithm to the rapid approximate calculation of the spatial movement cost of welding robot arm. Compared with the traditional robot inverse kinematics solution and thermodynamic physical simulation, its computation time complexity is greatly reduced, enabling the reinforcement learning agent to complete a large number of planning scenario exercises and policy updates in a very short iteration cycle, effectively accelerating the model convergence speed and improving the overall planning efficiency. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart according to an embodiment of the present invention; Figure 2 This is a principle block diagram according to an embodiment of the present invention; Figure 3 This is a process diagram according to an embodiment of the present invention; Figure 4 This is a block diagram of the module structure according to an embodiment of the present invention; Figure 5 This is a performance difference diagram between the present invention and traditional manual experience planning and genetic algorithms according to embodiments of the present invention; Figure 6 This is a topology diagram of an end-to-end deep reinforcement learning network architecture according to an embodiment of the present invention; Figure 7 This is a data flow graph of reinforcement learning environment interaction and parameter update according to an embodiment of the present invention; Figure 8 This is a schematic diagram illustrating the point cloud preprocessing and defect reconstruction effects according to an embodiment of the present invention; Figure 9 This is a reward convergence curve diagram according to an embodiment of the present invention; Figure 10 These are comparative heat maps of local heat distribution under different algorithm planning according to embodiments of the present invention; Figure 11 This is a network topology diagram according to an embodiment of the present invention; Figure 12 This is a schematic diagram of the types of defects in large castings according to embodiments of the present invention.
[0023] In the picture: 1. Data acquisition and preprocessing module; 2. State feature encoding generation module; 3. Action space definition and mechanism establishment module; 4. Feature extraction and path planning module; 5. Reward calculation and model update module. Detailed Implementation
[0024] To further illustrate the various embodiments, the present invention provides accompanying drawings, which are part of the disclosure of the present invention. These drawings are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementation methods and the advantages of the present invention. The components in the drawings are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0025] According to an embodiment of the present invention, a method and system for planning welding paths for repairing defects in large castings based on reinforcement learning are provided.
[0026] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments, such as... Figure 1 and Figure 3 As shown, according to an embodiment of the present invention, a reinforcement learning-based welding path planning method for repairing defects in large castings includes: S1. Determine the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system, obtain the defect data of large castings based on the transformation relationship, and preprocess the defect data to generate hypergraph network data.
[0027] It should be further explained that the process involves acquiring a high-precision 3D scanning model of the large casting and defect detection data obtained from non-destructive testing. The defect detection data undergoes spatial clustering and voxelization, discretizing the continuous defect region into a hypergraph network containing multiple defect nodes. An adjacency matrix representing the thermodynamic interaction between nodes is established based on the spatial distance between nodes and the material's thermal conductivity properties. The output hypergraph network data, including node features, edge features, and the adjacency matrix, serves as the basic physical environment for state space construction. Specifically, 3D point cloud data and ultrasonic waves from defects in the large casting are acquired and graph topology modeling is performed. A parallel computing training cluster, containing multiple actuator nodes and at least one learner node, with each actuator node distributed across multi-core CPUs and GPUs, is used to run the reinforcement learning model in parallel within a simulation environment, collecting Markov trajectory data generated due to path planning. Furthermore, the types of defects in large castings targeted by this invention include... Figure 12 As shown, schematic diagrams of planar defects (i.e., pits on a plane) and circular defects (i.e., pits on a cylindrical surface) are displayed in sequence.
[0028] In this optional embodiment, the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system is determined, defect data of large castings is obtained based on the transformation relationship, and the defect data is preprocessed to generate hypergraph network data, including: S11. By using the hand-eye calibration of the vision sensor and the end effector mounted on the welding robot, the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system is determined, and the defect area of the large casting is scanned according to the preset scanning trajectory to obtain the three-dimensional point cloud data of the defect area in order to generate a three-dimensional scanning model. It should be further explained that the transformation relationship between the vision sensor coordinate system and the robot coordinate system is determined by the hand-eye calibration of the robot's end effector and the vision sensor carried by the robot. The robot is controlled to carry the vision sensor to scan the defect area of the large casting according to the preset trajectory, and obtain the original three-dimensional point cloud data and three-dimensional scanning model of the defect area.
[0029] S12. Based on the three-dimensional scanning model, non-destructive testing technology is used to obtain defect data of large castings, and defect point sets are extracted from the defect data. S13. Use a multi-level hypergraph partitioning algorithm to perform spatial clustering on the defect point set, and perform voxelization on the spatially clustered defect node set to generate hypergraph network data.
[0030] In this optional embodiment, a multi-level hypergraph partitioning algorithm is used to spatially cluster the defect point set, and the spatially clustered defect node set is voxelized to generate hypergraph network data, including: S131. Using the defect points as the initial nodes of the hypergraph network, perform spatial clustering on the adjacent initial nodes, and divide the hypergraph network after spatial clustering into subgraphs to determine several target defect clusters and discrete defect points. In this optional embodiment, using defect points as the initial nodes of the hypergraph network, spatial clustering is performed on adjacent initial nodes, and the hypergraph network after spatial clustering is divided into subgraphs to determine several target defect clusters and discrete defect points, including: S1311. Take each defect point in the defect point set as the initial node of the hypergraph network and calculate the spatial Euclidean distance between adjacent initial nodes. S1312. Merge adjacent initial nodes whose spatial Euclidean distance is less than the preset clustering threshold into supernodes to generate the optimal hypergraph network. S1313. Using minimizing the sum of the weights of the connecting edges between different subgraphs as the objective function, the optimal hypergraph network is divided into subgraphs to obtain several target defect clusters. S1314. Map the supernodes in each subgraph to the hypergraph network, use a heuristic algorithm to adjust the defect points located at the partition boundary, determine the global planning of the target defect cluster, and treat the defect points not included in the target defect cluster as discrete defect points.
[0031] S132. Based on the global planning of the target defect cluster, the discrete defect points are locally planned using the thermal diffusion force-guided algorithm based on physical simulation. In this optional embodiment, based on the global planning of the target defect cluster, the local planning of discrete defect points using a physics-based thermal diffusion force-guided algorithm includes: S1321. Set the target defect cluster of the global planning as a fixed anchor point and set the discrete defect points as moving free points. S1322. Based on the attraction and thermal repulsion of the free point, establish a virtual attraction model based on spatial distance and a virtual repulsion model based on thermodynamic density between the free point and the anchor point, respectively. S1323. Based on the virtual gravity model and the virtual repulsion model, calculate the gravitational and repulsive forces acting on the free point as the resultant force, and iteratively calculate the resultant force displacement of the free point in the virtual force field until the virtual force field reaches a state of force equilibrium. S1324. Based on the spatial topological projection position of the free point under the force equilibrium state, the free point is inserted into the local sequence of the adjacent target defect cluster according to the spatial order, so as to realize the local planning of discrete defect points.
[0032] S133. Combining the results of local planning, the spatial distance between defect nodes, and the thermal conductivity properties of the casting material, an adjacency matrix characterizing the thermodynamic interaction between defect nodes is constructed using a distance-based exponential decay weighting mechanism, thereby generating hypergraph network data.
[0033] It should be further explained that tens of thousands of tiny defect points are extracted, and a multi-level hypergraph partitioning algorithm is used to merge the spatially highly clustered tiny defect points into several main defect clusters (target defect clusters) and thousands of discrete tiny defects (discrete defect points). The specific execution steps of the multi-level hypergraph partitioning algorithm include: coarsening stage: The extracted tiny defect points are regarded as the initial nodes of the graph. If the spatial Euclidean distance between adjacent nodes is less than the set clustering threshold, the adjacent nodes are matched and merged into a supernode, and the defect volume contained in it is accumulated; this merging process is repeated for iterative coarsening until the supernodes of the entire defect hypergraph network are obtained. The total number is reduced to a preset number; Initial partitioning stage: The hypergraph network with the fewest nodes after coarsening is initially partitioned into subgraphs. The objective function of partitioning is to minimize the sum of the weights of the connecting edges between different subgraphs, so as to ensure that the defect points with strong thermodynamic correlation are partitioned into the same subgraph as much as possible; Anti-coarsening and refining stage: The partitioned hypergraphs are expanded layer by layer to restore the original network of small defect points; During each expansion and mapping process, a heuristic boundary node moving algorithm is applied to fine-tune the defect points located at the boundaries of the subgraphs. If moving a boundary node into an adjacent subgraph can further reduce the thermodynamic coupling between subgraphs, then the movement is performed.
[0034] After the planning and sorting of all major defect clusters are established, a heat diffusion force-guided algorithm based on physical simulation is used to quickly plan the local interleaving of the remaining discrete micro-defects. The heat diffusion force-guided algorithm sets the sorted major defect clusters as anchor points with fixed positions and the discrete micro-defects as movable free points. A virtual gravity model based on spatial distance is established between the free points and anchor points, and a virtual repulsion model based on node heat capacity and heat accumulation is established between all nodes. The resultant force displacement of the free points in the virtual force field is calculated iteratively until the force field reaches a state of equilibrium. Finally, according to the spatial topological projection position of the free points after equilibrium, they are inserted into the local welding execution sequence of the adjacent major defect clusters in order. In this way, while reducing the spatial dimension of reinforcement learning actions, the discrete defect groups with highly concentrated heat dissipation are forcibly attacked, ensuring the physical feasibility of the global path.
[0035] Furthermore, when generating the adjacency matrix of the hypergraph network, a distance-based exponential decay weighting mechanism is applied: for any two defect nodes in the adjacency matrix, if their topological distance or theoretical heat conduction time exceeds a preset threshold, no connection edge is created; if it is within the threshold range, the initial weight of the edge between the two nodes is set to 1, and decays exponentially with the increase of the spatial Euclidean distance between the nodes. Each time the distance increases by one unit, the edge weight is halved, thus accurately mapping the local decay characteristics of heat conduction within the casting; for example... Figure 8 The image shown is a diagram illustrating the results of point cloud preprocessing and defect reconstruction.
[0036] S2. Based on the hypergraph network data and the sequence Markov decision process, determine and concatenate multidimensional features to generate the state feature code for the current time step.
[0037] It should be noted that the current state is defined based on a sequence Markov decision process. The state is a feature encoding of the planned welding path up to the current time step t. The feature encoding concatenates the following information: the defect graph adjacency matrix features of planned and unplanned nodes, node features (including but not limited to defect volume, depth, and shape classification parameters), edge features (including the three-dimensional physical straight-line distance between nodes and the estimated thermal conductivity), the identity features of the target defect node to be processed at the current time step, and the global metadata of the current casting (including the total heat capacity of the casting, the global maximum allowable deformation, and the total number of defect nodes). The constructed current state feature encoding serves as input data for the neural network to extract features, and the thermodynamic physical parameters it contains provide real-time data for hard constraint mask calculation.
[0038] S3. Based on multi-dimensional features, generate the action space of welding node positions and corresponding associated welding process parameters, and establish a hard constraint shielding mechanism.
[0039] It should be added that defining actions For a welding robot (or multi-axis CNC welding equipment) in its current state, the next target welding node spatial position and its associated welding process parameters (including welding movement speed, arc initiation current and voltage) are selected from a discretized effective mesh set. The action selection must meet the hard constraint of maximum heat input density to avoid secondary cracking caused by local thermal stress concentration. The generated dynamic hard constraint mask will be used as the action constraint condition and directly applied to the output of the policy network. The specific execution process of the hard constraint masking mechanism is as follows: in each reinforcement learning decision step, the current dynamic heat input density mask is calculated in real time. This mask is a binary matrix.
[0040] S4. Input the state feature encoding into the pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation. Combine the preset policy network and value network with the hard constraint masking mechanism as the constraint condition to generate a defect repair welding path planning sequence.
[0041] It should be added that the status The input is fed into a pre-trained edge-based graph convolutional neural network encoder to generate a low-dimensional vector embedding representation of the current network node and topological edge. The embedding representation is then concatenated and input into the policy network to output the probability distribution of the next legal action. The value network synchronously outputs the predicted baseline of the expected value of the current state. The actions sampled according to the probability distribution drive the casting repair environment to the next state and continue to loop until a complete welding path covering all defect nodes is generated. In this process, the pre-trained edge-based graph convolutional neural network and policy network are loaded, and the physical hard constraints of the target casting are combined to perform masking and probability sampling of actions.
[0042] In this optional embodiment, the state feature encoding is input into a pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation. Combined with a preset policy network and value network, and using a hard constraint masking mechanism as a constraint condition, a defect repair welding path planning sequence is generated, including: S41. Using the state feature encoding of the current time step as input, a pre-trained edge-based graph convolutional neural network encoder is used to perform multi-layer feature iteration and topological information aggregation to generate a low-dimensional vector embedding representation. It should be noted that the iterative updates of nodes and edge features within the edge-based graph convolutional neural network encoder follow the following mathematical formula: ; ;in, and These represent the low-dimensional vector representations of the i-th and j-th nodes in the defect network of large castings, respectively. The edge feature representation between nodes i and j; It is a fully connected layer; The learnable weights are applied to the connection edges; concat represents the concatenation operation of feature vectors; mean represents the mean of the edge features associated with all neighboring nodes j of the i-th node, and the local thermodynamic connectivity information is aggregated through multiple iterations.
[0043] S42. Perform feature concatenation on the low-dimensional vector embedding representation, and input the feature concatenation results into the preset policy network and value network respectively, and output the action probability distribution map and the expected value baseline. It should be further explained that after the policy network outputs the original action probability distribution, a dot product operation is performed between the original probability distribution and the mask matrix. This forces the probability of mesh positions violating the heat density constraint to 0. Subsequently, action sampling is performed only from the distribution of non-zero feasible positions, thereby absolutely avoiding excessive concentration of welding heat at the algorithm's underlying level. For example, Figure 4As shown, the specific network topology of the policy network includes: the input layer receives the node features output by the Edge-GNN encoder, the local features of some planned paths, and the joint feature embedding vector of casting metadata; the hidden layer contains five consecutive deconvolution layers, combined with batch normalization layers and modified linear unit activation function layers; the kernel size of the deconvolution layers is set to... The step size is set to 2, and the number of filter channels in the five deconvolution layers decreases sequentially to 16, 8, 4, 2 and 1 respectively; the output layer outputs an action probability heatmap that matches the casting mesh size.
[0044] S43. Based on the action probability distribution map and the expected value baseline, the legality of the action space is filtered using a hard constraint masking mechanism to obtain the target action at the current time step. S44. Execute the target action, and based on the execution result, transfer the environment to the next time step state, and repeat steps S41 to S43 until all defect points are traversed, generating a defect repair welding path planning sequence.
[0045] S5. The three-dimensional residual stress field corresponding to the defect repair welding path planning sequence is output using the pre-constructed transient thermophysical field proxy model. The policy network and value network are iteratively optimized through the near-end policy optimization algorithm to generate the optimal defect repair welding path planning sequence, so as to realize the defect repair welding path planning of large castings.
[0046] It should be noted that when the time step t < T (T is the total number of defective nodes), the single-step reward value is set to 0; when a complete welding path for a large castings (all defective nodes are traversed) is planned, the environment simulator calculates the comprehensive reward function, and the reward value is negatively weighted and summed based on the approximate total welding time of the agent, the residual thermal stress evaluation value, and the heat aggregation index; using the proximal policy optimization algorithm, the weight parameters of the policy network and the value network are updated based on the above cumulative rewards until the model reaches the convergence condition on the validation set; finally, the optimal defective repair welding path planning sequence for the large castings is output; the output optimal defective repair welding path planning sequence and the corresponding process parameters are converted into standard numerical control codes to drive the end robotic arm to perform physical welding operations, including slicing the three-dimensional digital model into layers to obtain two-dimensional contours, generating contour paths close to the boundary by contour offset for the two-dimensional contours, and generating reciprocating filling paths for the internal regions, and finally determining the robot welding torch posture based on the surface normal vectors of the path points on the three-dimensional model; in addition, the welding robot includes: a multi-degree-of-freedom robotic arm, an end welding torch and a vision sensing device, an AI computing center built-in or connected to the cloud, the AI computing center is equipped with the planning method of the present invention, and the residual thermal stress evaluation value in the reward function is calibrated using the thermal deformation scan data fed back after each actual physical welding, so that the equipment has the lifelong learning ability to continuously improve the path planning quality and calculation speed as the number of repaired castings increases; before driving the robotic arm to execute, it also includes a motion simulation verification step: sending the generated welding motion trajectory to the simulation framework for kinematic verification and collision detection; and automatically inserting welding process instructions such as arc starting, arc ending, and interlayer cooling between motion instructions according to the preset welding process parameter database.
[0047] In this optional embodiment, the three-dimensional residual stress field corresponding to the defective repair welding path planning sequence is output by using the pre-constructed transient thermophysical field surrogate model, and the policy network and the value network are iteratively optimized by the proximal policy optimization algorithm to generate the optimal defective repair welding path planning sequence, so as to realize the defective repair welding path planning of large castings, including: S51. With the spatio-temporal trajectory distribution of the welding heat source as the input and the three-dimensional residual stress field as the output, a transient thermophysical field surrogate model based on the Fourier neural operator is constructed, and the transient thermophysical field surrogate model is trained using historical finite element simulation data; It should be further explained that a transient thermophysical field proxy model based on Fourier Neural Operator (FNO) is constructed. The FNO is trained using historical finite element simulation data or high-fidelity physical data. The FNO takes the spatiotemporal trajectory distribution of the welding heat source as an input function and directly outputs the corresponding three-dimensional transient temperature field distribution and residual stress tensor field, i.e., the three-dimensional residual stress field. The trained FNO will serve as a hyper-real-time physical environment feedback engine during reinforcement learning interactions. Specifically, the spatial heat source distribution and material thermal boundary conditions at the current and historical time steps are extracted and input into the FNO-based proxy model. The FNO performs fast global convolution in the frequency domain to extract transient thermophysical features. The nonlinear iterative mathematical formula for a single layer of its network is as follows: ;in, It is the hidden layer feature representation of layer t; and These represent the Fast Fourier Transform and its inverse transform, respectively. W is a learnable complex weight tensor that truncates and preserves the first k low-frequency modes in the frequency domain; W is a local linear transformation matrix in the spatial domain. The activation function is nonlinear; FNO outputs the high-fidelity temperature field distribution T(x,y,z,t) of the entire casting at the current time step in real time, and forces the mask value corresponding to the grid region that exceeds the material phase transformation yield temperature threshold to 0.
[0048] S52. Take the spatiotemporal trajectory distribution of the welding heat source corresponding to the defect repair welding path planning sequence as input, and use the trained transient thermophysical field proxy model to output the corresponding three-dimensional residual stress field. S53. Based on the three-dimensional residual stress field, the residual thermal stress assessment value is calculated using the distortion energy criterion, and the total time cost is calculated using the half-perimeter boundary box principle to form an assessment index. In this optional embodiment, based on the three-dimensional residual stress field, the residual thermal stress assessment value is calculated using the distortion energy criterion, and the total time cost is calculated using the half-perimeter boundary box principle, forming the assessment indicators, including: S531. Based on the distortion energy criterion, the three-dimensional residual stress field is calculated to obtain the local maximum equivalent stress penalty term, and the local maximum equivalent stress penalty term is used as the residual thermal stress evaluation value. It should be noted that the residual thermal stress assessment value The system extracts the three-dimensional residual stress field predicted by FNO from the global stress tensor output by the FNO surrogate model, and calculates the local maximum equivalent stress penalty term according to the von Mises yield criterion (distortion energy criterion). The physics-driven reward function formula is supplemented as follows: ;in, and The FNO agent network predicts the normal and shear stress components within the casting repair volume $V$. This precise stress penalty term guides the near-end strategy optimization algorithm to actively avoid welding actions that lead to microlattice tearing.
[0049] S532. Based on the principle of semi-perimeter bounding box, calculate the local semi-perimeter bounding box cost of connected defect points in the three-dimensional residual stress field, and normalize the local semi-perimeter bounding box cost to obtain the total time cost. It should be noted that the approximate total time cost The calculation introduces the half-perimeter bounding box (HPWL) principle as a fast approximation of spatial movement distance. The specific calculation steps and formulas are as follows: For a given network of connected defect nodes i, its local half-perimeter bounding box cost is: ;in, and These are the x and y coordinates of each endpoint in network i on the projection plane or unfolded mesh; the total approximate time cost of the overall welding path is calculated by taking the normalized sum of all local half-perimeter bounding boxes, with the specific formula as follows: ;in, q(i) represents the total number of connected networks or path segments; q(i) is a normalization factor that increases with the number of nodes to improve estimation accuracy; the calculated total cost HPWL(netlist) is directly mapped to the Time(p,g) term in the integrated reward function for joint optimization. Since this metric is highly correlated with actual welding power consumption and the robotic arm's cycle time, the reinforcement learning agent can quickly converge to the optimal solution without relying on time-consuming physical simulations.
[0050] S533. Combining the residual thermal stress assessment value with the total time cost, an evaluation index is obtained for calculating the comprehensive reward function.
[0051] S54. Based on the evaluation indicators, construct a comprehensive reward function using a sparse reward mechanism, and calculate the total reward value of the defect repair welding path through the comprehensive reward function. It should be noted that the comprehensive reward function is defined in the final step as a negative weighted sum of the evaluation indicators, and the specific mathematical formula is as follows: ;in, The total reward for performing full path planning p on a defective network g; Approximate total time cost for the welding path planned by the agent; The predicted residual thermal stress assessment value, This is the residual thermal stress weighting coefficient; Thermal density (the average thermal density value of the top 10% of grid cells with the highest thermal density is extracted). This is the thermal agglomeration degree weighting coefficient.
[0052] S55. Based on the total reward value, the weight parameters of the policy network and the value network are iteratively updated using the generalized advantage estimation and proximal policy optimization algorithm. Based on the iterative update results, the optimal defect repair welding path planning sequence is output to realize the defect repair welding path planning of large castings.
[0053] In this optional embodiment, based on the total reward value, the weight parameters of the policy network and the value network are iteratively updated using the generalized advantage estimation and proximal policy optimization algorithm. The optimal defect repair welding path planning sequence is output based on the iterative update results, including: S551. Based on the total reward value and the expected value baseline, calculate the advantage estimate of the state and action pair using the generalized advantage estimation algorithm, and construct the total loss function by combining the truncation mechanism of the proximal policy optimization algorithm. S552. Using the total loss function as the optimization objective, the near-end policy optimization algorithm is used to perform backpropagation calculation, and the weight parameters of the policy network and the value network are iteratively updated with a preset truncation threshold as a constraint. It should be noted that the proximal policy optimization algorithm has limitations in training parameters. The objective function formula with truncation mechanism used is as follows: The PPO algorithm adopts an Actor-Critic architecture, where the policy network is responsible for outputting action probabilities, and the value network is responsible for evaluating the value of the current state; in the model training parameters At that time, generalized advantage estimation is introduced to calculate the advantage function of the current state-action pair. The algorithm measures the merits of the currently selected welding position and process parameters relative to the average level. To prevent the strategy from collapsing due to excessively large single parameter update steps when searching for the optimal welding path, the PPO algorithm employs an objective function with a truncation mechanism. And combined with the value network loss function And policy entropy rewards used to encourage exploration Construct a total loss function for joint optimization; objective function with truncation mechanism. The formula is as follows: ;in, This represents the expected value based on experience at time step t. This represents the ratio of the probability of the current action occurring between the updated policy network and the old policy network. It is the estimate of the generalized dominance function at time step t; The hyperparameter pruning threshold is used to limit the step size of a single policy update, preventing policy collapse caused by excessively large gradient updates when the model is searching for the optimal welding path; the objective function is defined as: ;in, The learnable parameter set G for the policy network is an offline training dataset containing K representative different casting defect distribution patterns (covering different defect size proportions, spatial densities, and shape features). Given a defect graph g and a policy network distribution The expected reward mathematical expectation corresponding to the planned trajectory p obtained from sampling is given below.
[0054] S553. Based on the iterative update process, obtain the corresponding evaluation return rate and determine whether the evaluation return rate meets the preset early stopping mechanism. If yes, stop the iterative update, freeze the weight parameters of the strategy network and the value network, and output the optimal defect repair welding path planning sequence. If no, continue iterative update until the preset early stopping mechanism is met, and output the optimal defect repair welding path planning sequence to realize the defect repair welding path planning of large castings.
[0055] It should be further explained that the early stopping mechanism to prevent the model from overfitting to a single casting is as follows: During the training or fine-tuning of the policy network, the system continuously monitors the evaluation reward rate on the validation set in the background; when the evaluation reward rate is less than 0.5% higher than the historical best reward rate within the set time window, the system determines that the policy has converged and actively triggers an early stopping instruction to freeze the network parameters, thereby greatly saving computing resources and ensuring the model's generalization ability when applied to multiple castings.
[0056] Furthermore, this invention possesses domain adaptation capabilities for heterogeneous castings. Specifically, it employs two execution modes: Zero-shot inference mode: Pre-trained policy network weights are directly loaded onto a large-scale heterogeneous casting dataset. For entirely new, unknown castings, the network only needs to perform a single forward propagation, outputting a feasible heuristic initial welding path within sub-seconds. Fine-tuning mode: Pre-trained policy network weights are used as initial parameters. For specific new castings with unique physical characteristics and constraint files, several hours of additional interactive training are conducted using a reinforcement learning environment to specifically optimize the zero-shot results, approximating or even surpassing the manual operation results of experienced human welding experts. Simultaneously, this invention also includes a local post-processing optimization step after the reinforcement learning agent outputs the full-map welding path sequence: taking the welding torch six-DOF pose set of the local continuous welding node sequence output by reinforcement learning as the initial state, constructing a joint energy function that includes robot joint kinematic costs and local residual thermal stress costs; at the current temperature, randomly performing neighborhood perturbation operations on the nodes in the sequence, including welding torch spatial mirror flipping operations around the tool center point (TCP) or spatial micro-movement operations along the weld direction, generating new candidate pose sets; calculating the difference in the joint energy function before and after the perturbation, and deciding whether to accept the new candidate pose set based on the Metropolis criterion; as the number of iterations increases, reducing the temperature according to the set exponential cooling rate until the convergence condition is met; thereby further eliminating potential robotic arm interference singularities and smoothing the local heat distribution without changing the macroscopic direction of the global planning.
[0057] Taking the runner of a mixed-flow turbine used in a large hydropower station as an example, it weighs 50 tons and has an outer diameter of about 8 meters. It is made of high-strength martensitic stainless steel. Although this material has high strength and good cavitation resistance, it is a heat-sensitive material with a high tendency for both cold and hot cracking. After casting and sand removal, ultrasonic and X-ray flaw detection revealed a total of more than 1,500 tiny defects such as porosity, slag inclusions, and microcracks at the blade roots, the inner junction of the upper crown and the lower ring of the runner. If the traditional method is used, welding is carried out sequentially from far to near with the welding torch. This would cause a certain area to be subjected to a huge cumulative heat input within a few hours, which would inevitably cause the base material to anneal or even severely crack, directly leading to the scrapping of the runner, which is worth tens of millions of yuan. Therefore, planning a path that can minimize the time and ensure absolutely uniform heat distribution has become the core challenge.
[0058] like Figure 3 and Figure 4As shown, before the system starts to acquire the casting model, the vision sensor and the robot's hand-eye calibration are first performed. The system uses functions in the vision library to input the robot's end pose and the calibration plate's pose in the scanner coordinate system, solves the AX=XB matrix equation, and obtains the accurate transformation matrix between the scanner coordinate system and the robot's end pose coordinate system, which is used for the spatial coordinate transformation of all subsequent acquired data. Then, the robot is controlled to carry the line structured light scanner to scan the defect area according to the preset trajectory, and acquire millions of raw point cloud data.
[0059] Step 1: Acquisition and Preprocessing: Faced with 1500 discrete defect points, directly handing them over to a reinforcement learning agent for sequential decision-making would lead to an exponential explosion of the state space. Therefore, this invention introduces a multi-level hypergraph partitioning algorithm, hMETIS, similar to the algorithm used in chip design to process VLSI netlists, to cluster and reduce the dimensionality of the defect points. The specific implementation process of this algorithm in this embodiment is divided into three core stages: 1. Coarsening Stage: These 1500 tiny defect points are considered as the initial nodes of the graph, and a spatial thermal influence radius is set. If multiple defect points overlap or are extremely close within this radius, they are merged into a single supernode, and the defect volume and heat capacity of these points are accumulated. This process is iterated multiple times, continuously merging adjacent supernodes until the total number of nodes in the entire network is reduced to a computationally convenient level. Weighted Jaccard similarity or multiple edge matching is used as the merging criterion. Let the initial defect hypergraph be... For any two connected nodes u and v, their aggregation priority is... The calculation formula is: ;in, and Let U and V represent the sets of hyperedges containing nodes u and v, respectively. Let represent the weight of the hyperedge 'e', which represents the heat conduction system based on exponential decay over distance. The node pair with the highest score will be selected first; when nodes u and v meet the threshold and are merged into a new hypernode m, the update formula for their vertex weights is a simple linear superposition: .
[0060] 2. Initial Partitioning Stage: The coarsened micro-network is initially partitioned. The objective function of this partitioning is to minimize the number of cross-edges between different partitions, ensuring that heat will not easily be conducted to other partitions when continuous welding occurs within the same partition. The objective function for this stage is: ;in, It is a set of superedges that span multiple partitions. It is the weight of the superedge. It is the number of subgraphs that the hyperedge e currently traverses. This formula aims to use a penalty term. Strictly limit partitioning schemes that could lead to severe cross-regional heat transfer; hard constraints (load balancing constraint): ;in, This represents the i-th partition. It is the weight of the node. This is the allowable load imbalance tolerance.
[0061] 3. Anti-coarsening and Refinement Stage: The segmented partitions are mapped back to the original 1500 defect points layer by layer. During each layer of mapping, fine-tuning is performed at the boundaries of the partitions using heuristic algorithms such as Fiduccia-Mattheyses: the system attempts to virtually move defect points on the boundaries into adjacent partitions. If calculations show that this movement further reduces the total thermodynamic weight of the cross-edge between different partitions without disrupting the volume balance within the partition, the movement is confirmed. When the hypergraph is unfolded and restored layer by layer, the Fiduccia-Mattheyses heuristic algorithm is used to calculate the benefit of moving boundary defect points to adjacent partitions to further optimize local paths. For any node v located in the source partition A and attempting to virtually move into the target partition B, its movement benefit Gain(v) is calculated based on the state change of its hyperedge before and after the movement. Define the benefit change brought by a single hyperedge e. for: ; This means that node v is the only node in partition A connected to the hyperedge e. If v is removed, the hyperedge will no longer cross partition A, thus reducing hot coupling and generating a positive benefit +w(e); This means that the target partition B was not previously connected to this hyperedge. Moving v into B will cause the hyperedge to add a new partition-crossing element, resulting in a heat dissipation penalty of -w(e); the total move benefit of node v is the sum of the benefits of all hyperedges containing that node: In each refinement iteration, the system will prioritize the node with Gain(v) > 0 and the largest value for actual movement, until the movement gains of all boundary nodes are less than or equal to zero.
[0062] After the above multi-level hypergraph partitioning algorithm, the system successfully extracted the spatially highly clustered nodes with strong internal thermodynamic interactions from the 1500 defect points, and finally divided them into 150 main defect clusters (target defect clusters). These 150 clusters correspond to macrounits that need to be prioritized in the subsequent reinforcement learning model. As for those scattered nodes that failed to be merged into any main partition during the clustering and merging process due to their large spatial distance, the system separated them and defined them as the remaining discrete standard micro-defects (discrete defect points). In this way, the agent only needs to perform reinforcement learning sequence planning on 150 macrounits, which greatly avoids the dimensionality curse and computational non-convergence problems caused by too many nodes. For the thousands of discrete micro-defects that were separated, this embodiment did not discard them or use simple proximity allocation, but introduced a thermal diffusion force-guided algorithm based on physical simulation for local interleaving planning.
[0063] This algorithm is triggered after the reinforcement learning agent establishes a global macroscopic welding order for 150 major defect clusters. It aims to rationally distribute discrete defects into the gaps of the main path while strictly preventing local heat accumulation. This heat diffusion force-guided algorithm borrows from the Fruchterman-Reingold spring-charge model and maps its physical meaning to the welding heat diffusion process. First, the system treats the 150 major defect clusters with fixed welding order as anchor points with fixed positions and strong heat adsorption capabilities in the network, and the remaining discrete micro-defects as free points driven by a virtual force field. The system initializes the positions of the free points to their real three-dimensional spatial coordinates. In the virtual force field, the free points are simultaneously subjected to both attraction and thermal repulsion. The attraction model states that each free point i is attracted by the nearest anchor point j in its physical space, tending to merge into the main path. The magnitude of the attraction follows Hooke's Law and is proportional to the square of the spatial distance between them, defined by the formula: ;in, The set gravitational elastic coefficient, These are the virtual coordinates of the free point i in the current iteration step. It is the actual physical coordinate of the nearest anchor point j. It is the unit direction vector from i to j; Thermal repulsion model: To prevent too many discrete defects from crowding into the local area of the same main defect and causing thermal stress concentration, the algorithm introduces a repulsion model based on thermodynamic density. All nodes have repulsive forces, which simulate the thermal resistance effect in heat conduction; The formula for calculating the total repulsive force on free point i is: ;in, It is the thermal diffusion repulsion coefficient. and These represent the intrinsic heat capacities of node i and node m, respectively. It is a unit vector pointing from m to i. This formula ensures that nodes with high heat capacity strongly repel each other, forcing free points to automatically seek regions with lower heat density; Iterative mapping and interleaving: At each time step t, the resultant force on free point i is the vector sum of attractive and repulsive forces, i.e. The system updates the virtual position of the free point according to the direction of the resultant force and introduces a temperature cooling mechanism from the simulated annealing process. To limit the maximum displacement in a single operation: When the virtual force field reaches equilibrium and converges through iterations, all discrete micro-defects are pushed away from the originally crowded area with high heat density in the virtual space. The system reads the equilibrium coordinates of each free point when it finally stabilizes, recalculates its nearest anchor point, and inserts its physical entity as a subtask, sequentially after the main reinforcement learning sequence containing that anchor point. This mechanism significantly reduces the spatial dimension of reinforcement learning actions while ensuring the physical feasibility of the global path and the uniformity of heat distribution from the underlying mathematical logic. The system establishes an adjacency matrix for these 150 macrounits. To reflect the physical laws of heat conduction, the system calculates the spatial distance between any two clusters. If there is a thick parent material between the two clusters and the distance is greater than 500mm, the thermal influence is considered negligible, and the adjacency matrix has no edge connections. If the distance is within 500mm, an edge is created, and the edge weight decreases according to the exponential distance decay formula. This lays the physical foundation for the feature extraction of the subsequent graph neural network.
[0064] Step 2, State Space Construction: In step t of the reinforcement learning environment, the current state of the system... It is a high-dimensional tensor splice: global environmental features: the total heat capacity of the rotor, ambient temperature, and the number of remaining unplanned defect clusters; graph topology encoding: including the aforementioned adjacency matrix, reflecting the thermal conduction resistance between defects; node and edge features: the volume, depth, and three-dimensional coordinates of each unplanned defect cluster; current node identity: based on heuristic rules of area descending order and topological sorting, the system specifies which macrocell urgently needs to be planned.
[0065] Step 3, Action Space and Hard Constraint Mask Implementation: Agent Actions This determines the exact location within the entire rotary machining mesh where the currently specified defect cluster should be processed; to incorporate the complex thermal properties of martensitic stainless steel into the model, this invention does not rely on soft penalties but instead implements a stringent hard constraint mask; based on the material thermodynamics expert system settings, the maximum allowable heat input density of the local rotary mesh is set to 60% of the material's yield heat limit; to assess the current thermal state in real time, the system calculates a dynamic cumulative thermogram at each time step t based on the executed historical welding trajectories, for dimensions discretized as... For any point (x, y) on the rotary machining mesh, the cumulative heat input density at the current time step t is... The calculation formula is as follows: ; This represents the accumulated heat input density at grid coordinates (x, y) at the current reinforcement learning decision step t. This represents the total heat input when the welding action is performed at the k-th time step in history; Indicates the time since the completion of the k-th welding action. The time interval up to the current time t; The exponential cooling time constant represents the heat dissipation characteristics of a material and reflects the dissipation of heat over time. This represents the target grid point (x, y) and the k-th historical actual welding center point. The square of the spatial Euclidean distance between them; This represents the spatial Gaussian diffusion standard deviation of the heat-affected zone; after calculating the heat input density of the entire map, the system compares it with the set maximum allowable heat input density threshold. A step-by-step comparison is performed to generate the final binarized dynamic thermal input density mask matrix. The formula is as follows: When the policy network is about to output the probability distribution matrix of the next action during forward propagation... At that time, the system forcibly performs the dot product operation: If a certain grid area is saturated with virtual heat accumulation due to similar welding tasks that have been arranged previously, the action probability corresponding to that grid will be instantly truncated to 0; the agent can only re-perform Softmax normalization from the remaining safe non-zero probability grids and sample welding points. This mechanism absolutely eliminates the potential danger of heat concentration that may be generated by artificial intelligence during exploration from the underlying mathematical logic.
[0066] Step 4: Edge-GNN Feature Extraction and Policy Forward Propagation Because different models of water turbine runners have different structures, traditional convolutional neural networks cannot process this type of non-Euclidean graph data. This embodiment loads a pre-trained edge-based graph convolutional neural network, which will... The input features are highly refined using the following formula: , At this time, the characteristics The data not only includes its own geometric size but also deeply incorporates the crowding level and heat conduction pressure of its surrounding neighbors. The resulting low-dimensional embedding representation is input into a policy network consisting of five deconvolutional layers with a stride of 2 (channel numbers of 16, 8, 4, 2, and 1 respectively), which outputs the next action. Simultaneously, a parallel fully connected feedforward value network outputs a score for the current state to guide subsequent PPO algorithm updates. Figure 6The diagram shown is a topology diagram of an end-to-end deep reinforcement learning network architecture, illustrating the complete neural network structure from node / edge feature input, Edge-GNN feature extraction, to the split output of the policy network and value network.
[0067] To enable those skilled in the art to clearly reproduce this system, the specific network architecture and hierarchical parameters of the aforementioned edge-based graph convolutional neural network, policy network, and value network are shown in Table 1.
[0068] Table 1 - Network Architecture and Layer Parameters Step 5: Comprehensive reward calculation and model training: Once the welding sequence and placement of all 150 major defect clusters are planned (i.e., t=T), the environment simulator distributes the final reward to the agent. The reward function in this embodiment accurately matches the industrial pain points: Approximate estimation of movement costs: The idle time of industrial-grade 6-axis robots between large workpieces accounts for a significant portion of the cost. If professional RobotStudio is used for dynamic simulation for each planning operation, reinforcement learning would require hundreds of thousands of training rounds, which would be completely unsustainable in terms of computing power. Therefore, this invention borrows the semi-perimeter bounding box algorithm from chip wiring, treating the connected welding work points as a network i: The overall calculation is performed by superposition. This value is highly correlated with the actual stroke range of each joint of the robotic arm, and the calculation process takes only a few milliseconds. This value is used as... This greatly improves evaluation efficiency; at the same time, it utilizes the average heat density value of the top 10% of the hottest grids in the entire map to calculate... As a penalty for hot aggregation, the system then employs the Proximal Policy Optimization (PPO) algorithm for end-to-end model training and parameter updates. Traditional policy gradient algorithms are prone to policy collapse due to excessive parameter updates when facing a high-dimensional discrete action space with up to 1500 defect nodes in this embodiment. Therefore, the PPO algorithm introduced in this system adopts an Actor-Critic dual-network architecture and strictly executes the following mathematical calculation process: 1. Generalized Advantage Estimation: The predicted state value output by the value network (Critic). The system uses time difference error to calculate the advantage function, which assesses how much better the currently selected welding position is compared to the average expectation. Calculate the advantage function : , In the formula, As a reward discount factor, This is the GAE smoothing parameter, used to weigh the tradeoff between variance and bias; This is a single-step reward.
[0069] 2. Calculate the probability ratio between the old and new policies: To limit the magnitude of policy updates, define the current new policy network in state... Take action below The probability, compared with the old policy network The ratio of corresponding probabilities is : .
[0070] 3. Construct the total loss function and backpropagate: The total loss function of the system Loss truncation by strategy Value network loss and policy entropy Composed of three weighted components, the objective function is maximized (or minimized) using gradient descent. The core objective function, with a truncation mechanism, is defined as follows: In the formula, To truncate the threshold, The function forces the ratio of new to old policies to be limited to the range of [0.8, 1.2] to prevent over-reliance on experience gained from a single collection; the loss function of the value network is the mean squared error. ;in Given the target state value, the final total update objective function is: ;in and These are the value loss coefficient and the entropy reward coefficient, respectively. Through this strict constraint combining GAE and Clip mechanisms, the reinforcement learning agent can stably explore the complex three-dimensional topological space of the rotary wheel and smoothly converge to a physically feasible welding trajectory with optimal heat distribution; such as Figure 9 As shown, this paper compares the convergence trends of the combined reward values of the reinforcement learning algorithm of this invention and the baseline algorithm as the number of training rounds increases during the training process.
[0071] like Figure 7 As shown in the diagram, this is a data flow diagram of the reinforcement learning environment interaction and parameter update, illustrating the Markov decision data loop between the agent and the wheel simulation environment, as well as the internal PPO loss function calculation and gradient backpropagation process of the Adam optimizer. The convergence effect of reinforcement learning is highly dependent on the parameter space setting. In this embodiment, the optimization algorithm used in the training phase is the Adam optimizer. The setting basis and specific value range of the relevant core hyperparameters are shown in Table 2. These parameters together ensure that the model can fully explore the large action space without policy collapse. Among them, the truncated parameters... This mechanism ensures that the strategy does not experience a precipitous drop in parameters when exploring different welding sequences.
[0072] Table 2 - Basis for setting core hyperparameters and specific value ranges Domain Adaptation Performance Verification: Before being deployed to the turbine runner, this system underwent 48 hours of pre-training on a high-performance computing cluster using simulation data from 20 different types of turbine runners and ship propellers. Zero-shot inference: Facing a completely new runner, the pre-trained model weights were directly retrieved, and the model inferred an initial welding path within 0.8 seconds. This path exhibited a clear donut-shaped heat dissipation avoidance characteristic, surpassing the results of a week's planning by a typical engineer. Fine-tuning Enhancement: To achieve optimal performance, the system activated fine-tuning mode, continuing training with specific parameters of the current casting. Under monitoring with an early stopping mechanism, the model converged in just 4 hours, generating the final trajectory sequence with the lowest overall cost. Figure 5 As shown, the performance differences between the reinforcement learning-based planning algorithm of this invention and traditional manual experience planning and genetic algorithms are intuitively demonstrated from two key dimensions: algorithm solution time and approximate total time cost. In order to verify the actual effect of the technical solution of this invention, this embodiment sets traditional manual experience planning and genetic algorithms as the comparison baseline for the above-mentioned task of repairing martensitic stainless steel wheel with more than 1,500 defects. The comparison of the core performance indicators of the three under the same computing equipment and physical constraints is shown in Table 3.
[0073] Table 3 - Comparison of Core Performance Indicators Local force-guided assignment and simulated annealing post-processing: Since the positions and order of the 150 main defect clusters have been fixed by RL, the system quickly starts the physical thermal diffusion force-guided algorithm, which quickly attracts the remaining thousands of tiny defects to the planned main path like a spring model, forming a complete fine-grained plan. Simulated annealing secondary fine-tuning of welding torch pose: Although the reinforcement learning agent and thermal diffusion force-guided algorithm have determined a physically feasible and thermally uniform three-dimensional spatial coordinate sequence, in actual industrial robot execution, the same spatial coordinate point can correspond to multiple different welding torch poses. To further eliminate abrupt singularities in robot joint motion and optimize local microscopic thermal stress, this embodiment introduces a simulated annealing algorithm for secondary pose fine-tuning under the premise of fixing the macroscopic path sequence. The specific implementation and mathematical calculation process are as follows: 1. Define the system state and joint energy function for a given local continuous welding sequence. ,in This represents the six-DOF pose vector of the i-th node, containing three-dimensional coordinates (x, y, z) and attitude angles. The system defines the joint energy function of the sequence. This is used to measure the overall cost of the current pose sequence. ; This represents the corresponding pose obtained by solving the robot's inverse kinematics. The angle vectors of each joint; This represents the sum of squares of the changes in the angles of each joint of the robot between adjacent nodes, i.e., the kinematic smoothing cost; This indicates the local thermal stress cost under a specific current posture (such as the distribution area of the hot arc being slightly adjusted by changing the welding torch tilt angle). and These are the weighting coefficients for kinematic cost and thermal stress cost, respectively.
[0074] 2. Neighborhood solution generation: In each iteration, the system randomly selects a node from the sequence. Then, apply one of the following two heuristic perturbations to generate a new candidate sequence P': Spatial mirror flip, keeping the TCP coordinates unchanged, rotating the welding torch 180° around the weld seam normal vector; this operation is typically used to instantly jump out of the joint limit dead zone; Spatial micro-shift, applying a small random offset to the coordinates (x,y,z) within a given defect geometric tolerance zone. .
[0075] 3. The Metropolis acceptance criterion system calculates the difference in the joint energy function before and after the perturbation. Calculate the probability of accepting the new sequence P' according to the Metropolis criterion in physical statistical mechanics. : ; This indicates that the new attitude sequence is smoother or has less thermal stress, and the system unconditionally accepts the perturbation. This indicates that the new posture leads to an increase in cost, but the system still accepts it with an exponentially decreasing probability, thereby giving the algorithm the ability to escape local optima; Boltzmann's constant; This represents the current system temperature at the k-th iteration.
[0076] 4. Annealing Cooling Schedule: After each batch of disturbance assessment is completed, the system reduces the ambient temperature according to an exponential decay formula: ;in, The cooling rate; as the iteration progresses, the system temperature... As the value gradually approaches 0, the probability of accepting a suboptimal solution decreases sharply, and the algorithm eventually converges stably.
[0077] This post-processing step performs parallel computations on hundreds of local segments, typically completing within minutes. It addresses the limitations of reinforcement learning in micro-kinematics, without affecting overall end-to-end planning efficiency, thus generating perfect G-code that can be directly deployed to industrial robots for execution; such as Figure 10 As shown, the heatmaps comparing local heat distribution under different algorithm planning are presented, intuitively demonstrating the difference in performance between the traditional continuous welding algorithm (which generates a dangerous zone of concentrated thermal stress) and the discrete jump allocation algorithm of this invention (which forms a safe zone of low heat) in terms of heat distribution on the casting surface. After the reinforcement learning agent outputs the global macroscopic welding sequence, the system enters the fine-grained path generation stage. Using a computational geometry library, the 3D defect model is sliced into layers, cutting the 3D model into multiple 2D slice contours. For each slice, a hybrid filling strategy is adopted: an equidistant offset is applied to the contour to generate a contour path that closely follows the boundary to ensure edge fusion quality, while a fixed-spacing bow-shaped reciprocating straight line filling path is generated for the internal area to improve filling efficiency. Based on this, the 2D path points are mapped back to the 3D model surface, and the six-dimensional pose of the welding torch is determined by calculating the normal vector of each point, ensuring that the welding torch always maintains the optimal angle with the surface to be repaired. To ensure the safety of large equipment, the system must undergo rigorous motion simulation verification after the robot program is generated and before actual execution. The generated six-dimensional pose trajectory is sent to the MoveIt framework in the robot operating system for inverse kinematics solving and collision detection, avoiding singularities and ensuring no interference risk. After successful verification, the post-processor automatically inserts specific process instructions such as arc initiation, arc termination, specific welding current and voltage, and interlayer cooling waiting time into the trajectory instructions based on the built-in welding process parameter database. Finally, it is converted into CNC code executable by the robotic arm for automated operation without human intervention. Figure 11 The diagram shown is a network topology diagram of the system according to the present invention.
[0078] The remarkable success of this embodiment does not stem from the isolated application of a single algorithm, but rather from the deep collaboration and seamless integration of multiple mature heterogeneous algorithms within the system, such as hMETIS, Edge-GNN, PPO, thermal diffusion force guidance, simulated annealing, and HPWL, across multiple physical scales. This invention innovatively constructs an artificial intelligence framework that couples macro and micro scales across scales, with bidirectional feedback between cognition and execution. This completely breaks the silo effect caused by the stacking of traditional algorithms, achieving a true breakthrough in path planning where one plus one equals more than two. Firstly, the topological-physical collaborative cognition of hMETIS dimensionality reduction and Edge-GNN deep representation, when faced with thousands of tiny defect points, would inevitably suffer if graph neural networks were used directly. To address the curse of dimensionality and severe gradient vanishing, this invention cleverly utilizes the hMETIS multi-level hypergraph partitioning algorithm from the chip industry as a pre-filter. This algorithm clusters chaotic micro-nodes into macroscopic main defect clusters based on physical space and thermodynamic properties. This step is not merely data compression, but also filters out massive amounts of high-frequency noise for Edge-GNN. The macroscopic topology graph after hMETIS processing allows Edge-GNN to concentrate its computational power to understand the complex distance decay laws and thermal conduction resistance between defect clusters. Without hMETIS dimensionality reduction, Edge-GNN cannot converge on giant rotating wheels; without the depth graph representation of Edge-GNN, hMETIS is merely a static representation. The combination of classification tools and other technologies endows the system with unprecedented three-dimensional thermodynamic spatial perception. Secondly, the co-evolution of PPO trial-and-error exploration and dynamic thermal mask hard constraints is crucial. Reinforcement learning is essentially about continuous trial and error, but in the repair of large precision castings, trial and error means an extremely high risk of thermal cracking and scrapping. This invention transforms the local maximum tolerable thermal input density threshold from materials science into a binary mask matrix at the bottom layer, directly performing dot product truncation when the PPO policy network outputs the probability distribution. This mechanism allows the PPO agent to conduct extremely aggressive and free exploration within a safe threshold, greatly accelerating the convergence speed of generalized advantage estimation. The mask mechanism ensures absolute physical safety, while the PPO algorithm provides the means to find… The driving force of the global optimal solution; secondly, the coordinated execution of macroscopic planning of reinforcement learning and microscopic modification of force-directed / simulated annealing algorithm, the macroscopic sequence output by PPO constitutes a high-quality path, but discrete micro-defects and joint singularities of the robotic arm are still hidden dangers. The thermal diffusion force-directed algorithm of this invention regards the sequence planned by RL as the gravitational anchor point, and cleverly uses the principle of like charges repelling each other to automatically absorb and disperse the free micro-defects into the gaps of the macroscopic skeleton, which not only fills the path flesh and blood, but also strictly inherits the distributed heat dissipation logic of RL. The simulated annealing algorithm in the last step focuses on the microscopic 6-DOF welding gun pose, and smooths out the micro-mutations at the kinematic level of the robotic arm without changing the macroscopic welding sequence.These three algorithms run in succession at the macroscopic, mesoscopic, and microscopic levels, respectively. The upper-level result represents the initial optimal state for the lower-level optimization, while the lower-level optimization represents the perfect physical realization of the upper-level intention.
[0079] Pure reinforcement learning agents, when exploring their environment, often discover and exploit loopholes in the reward function. The Gaussian heat decay formula they employ is a simplified empirical model. RL is highly likely to plan a path that scores highly under the Gaussian model but will lead to breakdowns in real, complex physical fields. Synergistic effect: FNO provides rigorous PDE (partial differential equation) level physical constraints, Edge-GNN efficiently manages the topological relationships of thousands of defective nodes, and FNO ensures that every topological jump is within the absolutely safe boundaries of real physics. RL gives the model an intelligent optimization brain, while FNO gives the model a physical constraint that conforms to objective laws. Common sense dictates that to obtain accurate thermal stress (as FNO can provide), finite element analysis (FEM) must be invoked. However, calculating the transient field of a large rotating wheel using FEM takes hours, making it unsuitable for the millions of interactive iterations required for reinforcement learning. FNO has the ability to compress FEM time by a factor of 10,000 (from hours to milliseconds), enabling the PPO algorithm to achieve finite element-level decision accuracy within the computation time of empirical formulas while maintaining extremely high sampling and training frequencies. Furthermore, incorporating FNO allows the system to adapt not only to new shapes but also directly to new materials and processing environments, because FNO learns thermal... The underlying operator logic of the conduction equation, by simply changing the initial physical boundary condition input, enables the system to reliably plan paths for unseen material or heat source parameters with high accuracy in zero-shot scenarios, completely widening the technological gap with competitors. Finally, the synergy between HPWL approximate evaluation and the release of computational power for large-scale concurrent interactions, combined with the HPWL algorithm in chip wiring, allows the system to reduce the extremely time-consuming complex spatial dynamic trajectory integration into a Manhattan distance evaluation with extremely low time complexity. This cross-disciplinary application enables the PPO agent to interact with the environment tens of thousands of times per unit time. The HPWL algorithm not only saves time... With 99% kinematic verification computing power, the model's comprehensive reward calculation can achieve a millisecond-level response. The various algorithm modules within this system empower and complement each other. Clustering and dimensionality reduction pave the way for graph learning, hard constraints provide a safety net for reinforcement learning, macro-planning guides micro-modification, and low-cost evaluation supports massive training. This deep collaboration across disciplines and scales enables this invention to not only surpass traditional manual and heuristic algorithms by more than three orders of magnitude in computational speed for path planning in the repair of large and complex castings, but also achieve near-perfect theoretical extremes in physical indicators such as controlling thermal stress concentration and preventing secondary cracking, demonstrating extremely high technical barriers and industrial application value.
[0080] In summary, this invention utilizes Edge-GNN to achieve environmental cognition, hard constraint masks to prevent heat concentration, HPWL to estimate movement time at low cost, and PPO to complete efficient training. It breaks down the dimensional barrier of multi-objective optimization in the repair of large castings and is a fundamental technological innovation with milestone significance in the field of large-scale intelligent manufacturing equipment.
[0081] like Figure 2 and Figure 4 As shown, according to another embodiment of the present invention, a reinforcement learning-based welding path planning system for repairing defects in large castings is also provided, the system comprising: The data acquisition and preprocessing module 1 is used to determine the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system, acquire the defect data of large castings based on the transformation relationship, and preprocess the defect data to generate hypergraph network data. The state feature encoding generation module 2 is used to determine and splice multidimensional features based on the hypergraph network data and the sequence Markov decision process to generate the state feature encoding of the current time step. The Action Space Definition and Mechanism Establishment Module 3 is used to generate the action space of welding node positions and corresponding associated welding process parameters based on multi-dimensional features, and to establish a hard constraint shielding mechanism. The feature extraction and path planning module 4 is used to input the state feature encoding into the pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation, and combine it with the preset policy network and value network, with the hard constraint masking mechanism as the constraint condition, to generate a defect repair welding path planning sequence. The reward calculation and model update module 5 is used to output the three-dimensional residual stress field corresponding to the defect repair welding path planning sequence using a pre-built transient thermophysical field proxy model, and to iteratively optimize the policy network and value network through a near-end policy optimization algorithm to generate the optimal defect repair welding path planning sequence, so as to realize the defect repair welding path planning of large castings.
[0082] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for planning welding paths for repairing defects in large castings based on reinforcement learning, characterized in that, The method includes: S1. Determine the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system, obtain the defect data of large castings based on the transformation relationship, and preprocess the defect data to generate hypergraph network data. S2. Based on the hypergraph network data and the sequence Markov decision process, determine and concatenate multidimensional features to generate the state feature code for the current time step; S3. Based on multi-dimensional features, generate the action space of welding node positions and corresponding associated welding process parameters, and establish a hard constraint shielding mechanism; S4. Input the state feature encoding into the pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation. Combine the preset policy network and value network with the hard constraint masking mechanism as the constraint condition to generate a defect repair welding path planning sequence. S5. The three-dimensional residual stress field corresponding to the defect repair welding path planning sequence is output using the pre-constructed transient thermophysical field proxy model. The policy network and value network are iteratively optimized through the near-end policy optimization algorithm to generate the optimal defect repair welding path planning sequence, so as to realize the defect repair welding path planning of large castings.
2. The method for planning welding paths for repairing defects in large castings based on reinforcement learning according to claim 1, characterized in that, The process of determining the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system, acquiring defect data of large castings based on the transformation relationship, and preprocessing the defect data to generate hypergraph network data includes: S11. By using the hand-eye calibration of the vision sensor and the end effector mounted on the welding robot, the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system is determined, and the defect area of the large casting is scanned according to the preset scanning trajectory to obtain the three-dimensional point cloud data of the defect area in order to generate a three-dimensional scanning model. S12. Based on the three-dimensional scanning model, non-destructive testing technology is used to obtain defect data of large castings, and defect point sets are extracted from the defect data. S13. Use a multi-level hypergraph partitioning algorithm to perform spatial clustering on the defect point set, and perform voxelization on the spatially clustered defect node set to generate hypergraph network data.
3. The method for planning welding paths for repairing defects in large castings based on reinforcement learning according to claim 2, characterized in that, The process of spatially clustering the defect point set using a multi-level hypergraph partitioning algorithm and then voxelizing the clustered defect node set to generate hypergraph network data includes: S131. Using the defect points as the initial nodes of the hypergraph network, perform spatial clustering on the adjacent initial nodes, and divide the hypergraph network after spatial clustering into subgraphs to determine several target defect clusters and discrete defect points. S132. Based on the global planning of the target defect cluster, the discrete defect points are locally planned using the thermal diffusion force-guided algorithm based on physical simulation. S133. Combining the results of local planning, the spatial distance between defect nodes, and the thermal conductivity properties of the casting material, an adjacency matrix characterizing the thermodynamic interaction between defect nodes is constructed using a distance-based exponential decay weighting mechanism, thereby generating hypergraph network data.
4. The method for planning welding paths for repairing defects in large castings based on reinforcement learning according to claim 3, characterized in that, The process involves using defect points as initial nodes in a hypergraph network, spatially clustering adjacent initial nodes, and then partitioning the spatially clustered hypergraph network into subgraphs to determine several target defect clusters and discrete defect points, including: S1311. Take each defect point in the defect point set as the initial node of the hypergraph network and calculate the spatial Euclidean distance between adjacent initial nodes. S1312. Merge adjacent initial nodes whose spatial Euclidean distance is less than the preset clustering threshold into supernodes to generate the optimal hypergraph network. S1313. Using minimizing the sum of the weights of the connecting edges between different subgraphs as the objective function, the optimal hypergraph network is divided into subgraphs to obtain several target defect clusters. S1314. Map the supernodes in each subgraph to the hypergraph network, use a heuristic algorithm to adjust the defect points located at the partition boundary, determine the global planning of the target defect cluster, and treat the defect points not included in the target defect cluster as discrete defect points.
5. The method for planning welding paths for repairing defects in large castings based on reinforcement learning according to claim 4, characterized in that, The step of performing local planning for discrete defect points based on the global planning of the target defect cluster and the physical simulation-based thermal diffusion force-guided algorithm includes: S1321. Set the target defect cluster of the global planning as a fixed anchor point and set the discrete defect points as moving free points. S1322. Based on the attraction and thermal repulsion of the free point, establish a virtual attraction model based on spatial distance and a virtual repulsion model based on thermodynamic density between the free point and the anchor point, respectively. S1323. Based on the virtual gravity model and the virtual repulsion model, calculate the gravitational and repulsive forces acting on the free point as the resultant force, and iteratively calculate the resultant force displacement of the free point in the virtual force field until the virtual force field reaches a state of force equilibrium. S1324. Based on the spatial topological projection position of the free point under the force equilibrium state, the free point is inserted into the local sequence of the adjacent target defect cluster according to the spatial order, so as to realize the local planning of discrete defect points.
6. The method for planning welding paths for repairing defects in large castings based on reinforcement learning according to claim 1, characterized in that, The process of inputting the state feature encoding into a pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation, and combining it with a preset policy network and value network, using a hard constraint masking mechanism as a constraint condition, to generate a defect repair welding path planning sequence includes: S41. Using the state feature encoding of the current time step as input, a pre-trained edge-based graph convolutional neural network encoder is used to perform multi-layer feature iteration and topological information aggregation to generate a low-dimensional vector embedding representation. S42. Perform feature concatenation on the low-dimensional vector embedding representation, and input the feature concatenation results into the preset policy network and value network respectively, and output the action probability distribution map and the expected value baseline. S43. Based on the action probability distribution map and the expected value baseline, the legality of the action space is filtered using a hard constraint masking mechanism to obtain the target action at the current time step. S44. Execute the target action, and based on the execution result, transfer the environment to the next time step state, and repeat steps S41 to S43 until all defect points are traversed, generating a defect repair welding path planning sequence.
7. The method for planning welding paths for repairing defects in large castings based on reinforcement learning according to claim 1, characterized in that, The process involves using a pre-constructed transient thermophysical field proxy model to output the three-dimensional residual stress field corresponding to the defect repair welding path planning sequence, and then iteratively optimizing the policy network and value network using a near-end policy optimization algorithm to generate the optimal defect repair welding path planning sequence. This process enables defect repair welding path planning for large castings. S51. Using the spatiotemporal trajectory distribution of the welding heat source as input and the three-dimensional residual stress field as output, a transient thermophysical field proxy model based on Fourier neural operators is constructed, and the transient thermophysical field proxy model is trained using historical finite element simulation data. S52. Take the spatiotemporal trajectory distribution of the welding heat source corresponding to the defect repair welding path planning sequence as input, and use the trained transient thermophysical field proxy model to output the corresponding three-dimensional residual stress field. S53. Based on the three-dimensional residual stress field, the residual thermal stress assessment value is calculated using the distortion energy criterion, and the total time cost is calculated using the half-perimeter boundary box principle to form an assessment index. S54. Based on the evaluation indicators, construct a comprehensive reward function using a sparse reward mechanism, and calculate the total reward value of the defect repair welding path through the comprehensive reward function. S55. Based on the total reward value, the weight parameters of the policy network and the value network are iteratively updated using the generalized advantage estimation and proximal policy optimization algorithm. Based on the iterative update results, the optimal defect repair welding path planning sequence is output to realize the defect repair welding path planning of large castings.
8. The method for planning welding paths for repairing defects in large castings based on reinforcement learning according to claim 7, characterized in that, The evaluation index, based on the three-dimensional residual stress field, calculates the residual thermal stress assessment value using the distortion energy criterion and calculates the total time cost using the half-perimeter boundary box principle, and includes: S531. Based on the distortion energy criterion, the three-dimensional residual stress field is calculated to obtain the local maximum equivalent stress penalty term, and the local maximum equivalent stress penalty term is used as the residual thermal stress evaluation value. S532. Based on the principle of semi-perimeter bounding box, calculate the local semi-perimeter bounding box cost of connected defect points in the three-dimensional residual stress field, and normalize the local semi-perimeter bounding box cost to obtain the total time cost. S533. Combining the residual thermal stress assessment value with the total time cost, an evaluation index is obtained for calculating the comprehensive reward function.
9. A method for planning welding paths for repairing defects in large castings based on reinforcement learning, as described in claim 8, is characterized in that... The process of iteratively updating the weight parameters of the policy network and value network based on the total reward value using generalized advantage estimation and proximal policy optimization algorithms, and outputting the optimal defect repair welding path planning sequence based on the iterative update results includes: S551. Based on the total reward value and the expected value baseline, calculate the advantage estimate of the state and action pair using the generalized advantage estimation algorithm, and construct the total loss function by combining the truncation mechanism of the proximal policy optimization algorithm. S552. Using the total loss function as the optimization objective, the near-end policy optimization algorithm is used to perform backpropagation calculation, and the weight parameters of the policy network and the value network are iteratively updated with a preset truncation threshold as a constraint. S553. Based on the iterative update process, obtain the corresponding evaluation return rate and determine whether the evaluation return rate meets the preset early stopping mechanism. If yes, stop the iterative update, freeze the weight parameters of the strategy network and the value network, and output the optimal defect repair welding path planning sequence. If no, continue iterative update until the preset early stopping mechanism is met, and output the optimal defect repair welding path planning sequence to realize the defect repair welding path planning of large castings.
10. A reinforcement learning-based welding path planning system for repairing defects in large castings, used to implement the reinforcement learning-based welding path planning method for repairing defects in large castings as described in any one of claims 1-9, characterized in that, The system includes: The data acquisition and preprocessing module is used to determine the transformation relationship between the vision sensor coordinate system and the welding robot coordinate system, acquire defect data of large castings based on the transformation relationship, and preprocess the defect data to generate hypergraph network data. The state feature encoding generation module is used to determine and concatenate multidimensional features based on hypergraph network data and sequential Markov decision processes to generate the state feature encoding for the current time step. The action space definition and mechanism establishment module is used to generate the action space of welding node positions and corresponding associated welding process parameters based on multi-dimensional features, and to establish a hard constraint shielding mechanism. The feature extraction and path planning module is used to input the state feature encoding into the pre-trained graph convolutional neural network encoder to obtain a low-dimensional vector embedding representation. Combined with the preset policy network and value network, and with the hard constraint masking mechanism as the constraint condition, it generates a defect repair welding path planning sequence. The reward calculation and model update module is used to output the three-dimensional residual stress field corresponding to the defect repair welding path planning sequence using a pre-built transient thermophysical field proxy model. Iterative optimization of the policy network and value network is performed through a near-end policy optimization algorithm to generate the optimal defect repair welding path planning sequence, so as to realize the defect repair welding path planning of large castings.