A ship electrical wiring method and system based on multi-level Steiner tree

By adopting a multi-level Steiner tree-based ship electrical wiring method and building an intelligent agent model using a reinforcement learning algorithm, the computational complexity and optimization efficiency challenges of the multi-level power distribution problem in ship electrical wiring are solved, efficient optimization of path planning and reduction of cable length are achieved, and an intelligent and automated optimization solution is provided.

CN119577971BActive Publication Date: 2025-09-23CHINA SHIP DEV & DESIGN CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411730746.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-09-23
Estimated Expiration
2044-11-29

AI Technical Summary

Technical Problem

Existing technologies in ship electrical wiring optimization, especially in multi-level power distribution problems, face challenges in computational complexity and optimization efficiency, and it is difficult to effectively balance optimization quality and computational speed.

Method used

A ship electrical wiring method based on a multi-level Steiner tree is adopted. By initializing and constructing an intelligent agent model based on the attention mechanism, training the intelligent agent model to interact with the environment, optimizing the training strategy and value network, evaluating the intelligent agent model, and combining the reinforcement learning algorithm to handle the multi-level Steiner tree problem.

Benefits of technology

It effectively handles multi-level Steiner tree problems, optimizes ship electrical wiring, improves path planning efficiency, reduces cable length, achieves cost savings and efficiency improvements, adapts to wiring requirements of different scales and complexities, and provides intelligent and automated optimization solutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119577971B_ABST
    Figure CN119577971B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for ship electrical wiring based on a multi-level Steiner tree. By combining a policy-based reinforcement learning algorithm, initializing and constructing an intelligent agent model based on an attention mechanism, interacting with the environment and obtaining environmental feedback to adjust the intelligent agent model's learning rate and train the intelligent agent model, optimizing the training strategy and value network, and evaluating the intelligent agent model, the method can effectively handle the complexity of the multi-level Steiner tree problem, solve the multi-level Steiner tree problem of ship electrical wiring, optimize ship electrical wiring, improve the efficiency of path planning, and reduce cable length, thereby achieving cost savings and efficiency improvements. Aiming at the characteristics of combinatorial optimization problems, the intelligent agent is trained through a simulated environment and a reward mechanism to optimize the electrical wiring path. The input data structure has good scalability and can be applied to wiring requirements of different scales and complexities. At the same time, it realizes the automation and intelligence of wiring optimization, reducing the burden of manual design.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of electrical engineering and optimization algorithms, and in particular relates to a ship electrical wiring method and system based on a multi-level Steiner tree. Background Art

[0002] In the field of ship design and manufacturing, optimizing electrical wiring is a key technical challenge. It not only impacts a ship's energy efficiency and functionality, but also directly impacts cost and safety. Traditional electrical wiring methods rely on the designer's experience and intuitive judgment, often resulting in suboptimal cable routing, increasing material costs and energy consumption, and potentially posing safety risks.

[0003] With the advancement of computing technology, ship electrical wiring design has begun to employ more advanced algorithms to seek optimized solutions. The Steiner tree problem, a well-known combinatorial optimization problem, is used to find the shortest network connecting multiple points. However, most Steiner tree algorithms target static and simple wiring problems, whereas actual ship electrical wiring design is more complex, involving multi-level and multi-stage decision-making and optimization.

[0004] With the development of deep learning technology, the application of machine learning in operations research and optimization is increasing. Yoshua Bengio and other scholars have explored the application of machine learning in solving combinatorial optimization problems, particularly its role in mimicking expert decision-making and integrating with traditional algorithms. Jin Chun et al. studied the application of an optimization algorithm based on heuristic Q-learning in optimizing automotive paint shop operations, demonstrating the potential of machine learning in solving large-scale optimization problems.

[0005] In the field of electrical wiring optimization, particularly in the field of shipboard electrical wiring, the multi-level Steiner tree problem provides an effective solution framework. Siqi Wang et al. introduced a deep reinforcement learning-based method, Deep-Steiner, to handle the complex search space of the Steiner tree problem. This demonstrates the significant potential of deep learning methods in solving Steiner tree problems, especially in multi-level and complex environments.

[0006] Jiwei Zhang et al. proposed a learning-based graph pruning method, demonstrating the effectiveness of machine learning in solving complex combinatorial optimization problems through integer linear programming transformation and prediction. Chenyang Xu et al.'s research demonstrated the advantages of machine learning in solving online Steiner tree problems, particularly in dynamically changing and uncertain environments.

[0007] Existing technologies for optimizing ship electrical wiring, particularly for multi-level power distribution, face challenges in computational complexity and optimization efficiency. Traditional approaches to such problems are often limited by their high dimensionality and dynamic nature, making it difficult to effectively balance optimization quality and computational speed. Summary of the Invention

[0008] The technical problem to be solved by the present invention is to provide a ship electrical wiring method and system based on a multi-level Steiner tree, which is used to solve the multi-level Steiner tree problem of ship electrical wiring.

[0009] The technical solution adopted by the present invention to solve the above technical problems is: a ship electrical wiring method based on a multi-level Steiner tree, comprising the following steps:

[0010] S1: Initialize and build an attention-based agent model;

[0011] S2: Train the agent model by adjusting its learning rate through interaction with the environment and obtaining environmental feedback.

[0012] S3: Optimize training strategies and value networks;

[0013] S4: Evaluate the agent model.

[0014] According to the above scheme, in step S1, the specific steps are:

[0015] S11: Set hyperparameters, including experiment name, seed, deterministic settings, CUDA graphics processing core platform usage, monitoring, and project name;

[0016] S12: Set up the environment, register and create multiple instances of the training environment and test environment;

[0017] S13: Construct a neural network agent model based on attention mechanism.

[0018] Furthermore, in step S12, the training instances are used to train the intelligent agent model and learn parameters; the test instances are used to evaluate the performance of the intelligent agent model; and the test instances are generated from a fixed data set or seed.

[0019] Furthermore, in step S13, the specific steps are:

[0020] Determine whether there is a pre-trained model: if so, load the weights of the pre-trained model for continued training or use the pre-trained model for inference; otherwise, define a new neural network as the agent model and initialize the parameters;

[0021] Determine the problem to be solved by the agent based on the experiment name parameter passed in when initializing the agent model; select the multi-level Steiner tree problem and adjust the internal network architecture and parameter settings of the agent model accordingly;

[0022] Select the Adam optimizer to adjust the parameters of the agent model during training; set the optimizer parameters, including learning rate, epsilon value, and weight decay;

[0023] Storage initialization, setting up data structures to record the execution process of the algorithm.

[0024] Furthermore, in step S13, the data structure includes the state of the environment, the action of the agent model, the logarithmic probability of the action, the immediate reward obtained at each step, the end state flag of each environment, and the value estimation of the agent model for each step observation.

[0025] According to the above scheme, in step S3, the specific steps are:

[0026] S31: Record parameter metrics, including learning rate, value loss, policy loss, and approximate KL divergence; batch process data including observations, actions, and rewards;

[0027] S32: Calculate policy loss and value function loss;

[0028] Optimize the policy loss through gradient ascent to improve the decision-making ability of the intelligent model; use historical data to calculate the advantage function and update the policy network of the intelligent model;

[0029] The value loss is optimized through gradient descent to improve the accuracy of value estimation; the updated value function is used to estimate the expected return of each state.

[0030] S33: Clip and update gradients to prevent exploding or vanishing gradients; apply clipped gradients to update the neural network parameters of the agent model;

[0031] S34: Regularly test the training policy in the test environment to monitor its performance on unseen data.

[0032] Furthermore, the step S3 further includes the following steps:

[0033] S35: Perform KL divergence detection on the training strategy to monitor the distribution changes before and after the strategy update. If the change exceeds the set threshold, stop further updating to avoid excessive deviation from the original strategy.

[0034] According to the above scheme, in step S4, at the end of each update cycle, the performance indicators of the intelligent agent model are evaluated and recorded, and the status of the intelligent agent model is regularly saved and evaluated in the test environment to verify the training effect; the specific steps are:

[0035] S41: Load the trained agent model;

[0036] S42: creating an environment instance corresponding to the multi-level Steiner tree problem and including all information of the multi-level Steiner tree problem;

[0037] S43: Obtain the initial observation or state of the agent model from the environment, including all the initial information required to solve the problem;

[0038] S44: Decide the next action of the agent model based on the current observation;

[0039] S45: Execute the decision action and receive the response from the environment, including new observations (i.e., the next state), rewards, and information about whether the goal was achieved.

[0040] S46: constructing a path to solve the multi-level Steiner tree problem by repeating steps S44 and S45 until a certain termination condition is reached;

[0041] S47: Output results, including the multi-level Steiner tree graph connection relationship and total length information of the multi-level Steiner tree problem.

[0042] A ship electrical wiring system based on a multi-level Steiner tree,

[0043] Initialization submodule, used to initialize and build an agent model based on the attention mechanism;

[0044] Model training submodule, used to train the intelligent agent model;

[0045] Strategy optimization submodule, used to optimize training strategies and value networks;

[0046] The model evaluation submodule is used to evaluate the intelligent agent model.

[0047] A computer memory stores a computer program executable by a computer processor, wherein the computer program implements a ship electrical wiring method based on a multi-level Steiner tree.

[0048] The beneficial effects of the present invention are:

[0049] 1. The present invention provides a method and system for ship electrical wiring based on a multi-level Steiner tree. By combining a policy-based reinforcement learning algorithm, the method and system initialize and construct an intelligent agent model based on an attention mechanism, interact with the environment and obtain environmental feedback to adjust the learning rate of the intelligent agent model to train the intelligent agent model, optimize the training strategy and value network, and evaluate the intelligent agent model. The method and system can effectively handle the complexity of the multi-level Steiner tree problem, solve the multi-level Steiner tree problem of ship electrical wiring, optimize ship electrical wiring, improve the efficiency of path planning and reduce cable length, thereby achieving cost savings and efficiency improvements.

[0050] 2. In response to the requirements of partitioning and hierarchical start-stopping of electrical equipment in complex power distribution systems, the present invention expands the classic Steiner tree model into a multi-level Steiner tree model to adapt it to the needs of electrical distribution. This significantly improves the efficiency of path planning, especially when dealing with complex multi-level Steiner tree problems.

[0051] 3. This invention targets the characteristics of combinatorial optimization problems and trains intelligent agents through a simulated environment and reward mechanism to optimize electrical wiring paths. It uses advanced algorithms to achieve end-to-end learning of strategies and value networks, which has execution advantages over traditional algorithms, improves design efficiency and the economy of wiring solutions, and has good scalability and practicality.

[0052] 4. The computational design model of the present invention, which is pre-designed for the objective function, has strong adaptability and a well-scalable input data structure. It can be applied to wiring requirements of different scales and complexities, while realizing automation and intelligence in wiring optimization. Thus, it can perform adaptive and dynamic optimization according to different ship designs and electrical wiring requirements, greatly reducing the burden of manual design and providing an efficient, economical, and intelligent ship electrical wiring optimization solution.

[0053] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0055] Figure 1 This is a flowchart of a reinforcement learning agent training based on a multi-level Steiner tree according to an embodiment of the present invention.

[0056] Figure 2 This is a flowchart of a reinforcement learning agent evaluation based on a multi-level Steiner tree according to an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0058] Example 1

[0059] See also Figure 1 ,The specific steps of a ship electrical wiring method based on a multi-level Steiner tree are as follows:

[0060] S1: Initialize and build an attention-based agent model;

[0061] S2: Train the agent model by adjusting its learning rate through interaction with the environment and obtaining environmental feedback.

[0062] S3: Optimize training strategies and value networks;

[0063] S4: Evaluate the agent model.

[0064] Furthermore, in step S1, the specific steps are:

[0065] S11: Set hyperparameters, including experiment name, seed, deterministic settings, CUDA graphics processing core platform usage, monitoring, and project name;

[0066] S12: Set up the environment, register and create multiple instances of the training environment and test environment;

[0067] S13: Construct a neural network agent model based on attention mechanism.

[0068] Furthermore, in step S12, the training instances are used to train the intelligent agent model and learn parameters; the test instances are used to evaluate the performance of the intelligent agent model; and the test instances are generated from a fixed data set or seed.

[0069] In step S13, it is determined whether there is a pre-trained model: if so, the weights of the pre-trained model are loaded for continued training or reasoning using the pre-trained model; if not, a new neural network is defined as the agent model and the parameters are initialized;

[0070] Determine the problem to be solved by the agent based on the experiment name parameter passed in when initializing the agent model; select the multi-level Steiner tree problem and adjust the internal network architecture and parameter settings of the agent model accordingly;

[0071] Select the Adam optimizer to adjust the parameters of the agent model during training; set the optimizer parameters, including learning rate, epsilon value, and weight decay;

[0072] Initialize storage and set up data structures to record the execution of the algorithm. This data structure includes the state of the environment, the agent's actions, the log-probability of the actions, the immediate reward obtained at each step, the end state flag for each environment, and the agent's estimated value for each observation step.

[0073] In step S3, the specific steps are:

[0074] S31: Record parameter metrics, including learning rate, value loss, policy loss, and approximate KL divergence; batch process data including observations, actions, and rewards;

[0075] S32: Calculate policy loss and value function loss;

[0076] Optimize the policy loss through gradient ascent to improve the decision-making ability of the intelligent model; use historical data to calculate the advantage function and update the policy network of the intelligent model;

[0077] The value loss is optimized through gradient descent to improve the accuracy of value estimation; the updated value function is used to estimate the expected return of each state.

[0078] S33: Clip and update gradients to prevent exploding or vanishing gradients; apply clipped gradients to update the neural network parameters of the agent model;

[0079] S34: Regularly test the training policy in the test environment to monitor its performance on unseen data.

[0080] Also includes the steps:

[0081] S35: Perform KL divergence detection on the training strategy to monitor the distribution changes before and after the strategy update. If the change exceeds the set threshold, stop further updating to avoid excessive deviation from the original strategy.

[0082] In step S4, at the end of each update cycle, the performance indicators of the agent model are evaluated and recorded, and the state of the agent model is regularly saved and evaluated in the test environment to verify the training effect. The specific steps are:

[0083] S41: Load the trained agent model;

[0084] S42: creating an environment instance corresponding to the multi-level Steiner tree problem and including all information of the multi-level Steiner tree problem;

[0085] S43: Obtain the initial observation or state of the agent model from the environment, including all the initial information required to solve the problem;

[0086] S44: Decide the next action of the agent model based on the current observation;

[0087] S45: Execute the decision action and receive the response from the environment, including new observations (i.e., the next state), rewards, and information about whether the goal was achieved.

[0088] S46: constructing a path to solve the multi-level Steiner tree problem by repeating steps S44 and S45 until a certain termination condition is reached;

[0089] S47: Output results, including the multi-level Steiner tree graph connection relationship and total length information of the multi-level Steiner tree problem.

[0090] This embodiment combines a policy-based reinforcement learning algorithm, initializes and constructs an intelligent agent model based on an attention mechanism, interacts with the environment and obtains environmental feedback to adjust the learning rate of the intelligent agent model to train the intelligent agent model, optimizes the training strategy and value network, and evaluates the intelligent agent model. It can effectively handle the complexity of the multi-level Steiner tree problem, solve the multi-level Steiner tree problem of ship electrical wiring, optimize ship electrical wiring, improve the efficiency of path planning and reduce cable length, thereby achieving cost savings and efficiency improvements.

[0091] Example 2

[0092] The steps of this embodiment are the same as those of embodiment 1, except that each step is applied to a specific example. Specifically, the following steps are included:

[0093] The training process of reinforcement learning agents based on multi-level Steiner trees, such as Figure 1 As shown, the following steps are included:

[0094] 1) Perform parameter analysis and initialization before running the algorithm, including setting hyperparameters, environment, and neural network agent. Hyperparameters include experiment name, seed, deterministic settings, CUDA usage, monitoring, project name, etc.

[0095] 2) Register and create multiple training and test environment instances. The training instances are used for learning, while the test instances (from a fixed dataset or generated using a seed) are used to evaluate the performance of the agent.

[0096] 3) Create an attention-based model agent for subsequent learning and decision-making. The agent is initialized and assigned to run on a specific GPU. The initialization includes the following steps:

[0097] (1) If there are pre-trained model weights, you can choose to load the previous model weights to continue the previous training or use the pre-trained model for inference; otherwise, you can choose to define a new neural network and initialize the parameters.

[0098] (2) The problem to be solved by the agent is determined by the problem name parameter passed in when the agent is initialized. Here, the multi-level Steiner tree problem is selected. The internal network architecture and parameter settings of the agent will be adjusted accordingly according to this problem type to adapt to the characteristics of the problem.

[0099] (3) Set up an optimizer for the agent. Select the Adam optimizer to adjust the agent's parameters during training to improve its performance in the environment. The optimizer settings include parameters such as learning rate, epsilon value, and weight decay.

[0100] 4) Initialize storage and set up a data structure to record the algorithm's execution process. This includes the environment state (observation), the agent's actions, the log-probability of those actions, the immediate reward at each step, the end state flag for each environment, and the agent's estimated value for each observation. This storage structure is continuously updated during training to record the agent's learning and decision-making process. This data is used to iteratively update the agent's policy and value network, improving its problem-solving performance.

[0101] 5) Start training the agent. The training cycle includes the following steps:

[0102] (1) Preparation phase: This includes training preparation and environment interaction. The agent is in training mode, and the learning rate may be adjusted. Next, the agent interacts with the environment, receiving observations, deciding actions, and obtaining environmental feedback. This phase is the beginning of the training process and the foundation of the environment interaction.

[0103] (2) Learning and updating phase: This involves data recording, policy updating, and value function updating. This phase uses previously recorded data to calculate the advantage function and update the agent’s policy network. Simultaneously, the agent’s value function is also updated to better estimate the expected reward for each state.

[0104] (3) Performance evaluation and testing: including performance evaluation, preservation, and testing. At the end of each update cycle, the agent’s performance indicators are evaluated and recorded. At the same time, the agent state is regularly saved and evaluated in the test environment to verify the training effect.

[0105] 6) Use data collected from the environment to optimize strategies and value networks. This includes the following key steps:

[0106] (1) Data organization: Data batch processing, organizing observations, actions, rewards, and other data into batches. This is crucial for subsequent optimization calculations.

[0107] (2) Policy and value network optimization: This step involves calculating the policy loss and value function loss. The policy loss is optimized using gradient ascent to improve the agent’s decision-making ability. The value loss is optimized using gradient descent to improve the accuracy of value estimation.

[0108] (3) Gradient Clipping and Update: To prevent gradients from exploding or vanishing, gradient clipping is used. After clipping, these gradients are applied to update the agent’s neural network parameters.

[0109] (4) KL divergence detection: This is an optional step used to monitor the distribution changes before and after the policy update. If the change exceeds a set threshold, further updates may be stopped to avoid excessive deviation from the original policy.

[0110] 7) Log important metrics such as learning rate, value loss, policy loss, and approximate KL divergence to monitor performance.

[0111] 8) Periodically save the state of the trained model for later use or evaluation.

[0112] 9) Regularly test the training strategy on the test environment to monitor its performance on unseen data.

[0113] 10) When training is complete, close the environment properly and save the training log to end the training process.

[0114] The evaluation process of reinforcement learning agents based on multi-level Steiner trees, such as Figure 2 As shown, the following steps are included:

[0115] 1) Model loading: First, the trained model is loaded into memory and prepared for inference.

[0116] 2) Environment initialization: Create an environment instance corresponding to the multi-level Steiner tree problem. This environment contains all the information of the multi-level Steiner tree problem, such as the coordinates of the nodes and the requirements.

[0117] 3) Observation Acquisition: The agent obtains initial observations (or states) from the environment. These observations contain all the initial information needed to solve the problem.

[0118] 4) Action Decision: The agent decides its next action based on the current observation. This typically involves querying a neural network to find the best action for the current state.

[0119] 5) Environment Interaction: The agent performs the selected action and receives a response from the environment. The response includes new observations (next state), rewards, and information about whether the goal was achieved.

[0120] 6) Path Construction: Repeat the steps of action decision-making and environment interaction until the goal is achieved or a termination condition is reached. This process constructs a path to solve the multi-level Steiner tree problem.

[0121] 7) Result output: Finally, the solution is output, that is, the multi-level Steiner tree graph connection relationship and total length and other related information of the multi-level Steiner tree problem.

[0122] Through the above steps, this embodiment not only optimizes the electrical wiring path, but also provides a new technical solution for electrical wiring optimization in the field of future ship design and construction.

[0123] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0124] Aiming at the requirements of electrical equipment partitioning and hierarchical start-stop required by complex power distribution systems, the present invention expands the classic Steiner tree model into a multi-level Steiner tree model to adapt it to the needs of electrical distribution; it greatly improves the efficiency of path planning, especially when dealing with complex multi-level Steiner tree problems.

[0125] The present invention targets the characteristics of combinatorial optimization problems and trains intelligent agents through a simulated environment and reward mechanism to optimize electrical wiring paths. It adopts advanced algorithms to achieve end-to-end learning of strategies and value networks, which has execution advantages over traditional algorithms, improves design efficiency and the economy of wiring solutions, and has good scalability and practicality.

[0126] Example 3

[0127] This embodiment is used to implement the principle of the above method embodiment to construct a ship electrical wiring system based on a multi-level Steiner tree, including an initialization submodule, a model training submodule, a strategy optimization submodule and a model evaluation submodule.

[0128] The initialization submodule is used to initialize and build an agent model based on the attention mechanism;

[0129] The model training submodule is used to train the agent model;

[0130] The policy optimization submodule is used to optimize the training strategy and value network;

[0131] The model evaluation submodule is used to evaluate the agent model.

[0132] Each sub-module is mainly used to implement each step of the method embodiment, which will not be described in detail here.

[0133] It should be pointed out that, according to the needs of implementation, the various steps / components described in this application can be split into more steps / components, or two or more steps / components or partial operations of steps / components can be combined into new steps / components to achieve the purpose of the present invention.

[0134] The computational design model of the present invention, which is pre-designed for the objective function, has strong adaptability and a well-scalable input data structure. It can be applied to wiring requirements of different scales and complexities, while realizing automation and intelligence in wiring optimization. Thus, it can perform adaptive and dynamic optimization according to different ship designs and electrical wiring requirements, greatly reducing the burden of manual design and providing an efficient, economical and intelligent ship electrical wiring optimization solution.

[0135] The above embodiments are intended only to illustrate the design concepts and features of the present invention. Their purpose is to enable those skilled in the art to understand the contents of the present invention and implement them accordingly. The scope of protection of the present invention is not limited to the above embodiments. Therefore, any equivalent changes or modifications made based on the principles and design concepts disclosed in the present invention are within the scope of protection of the present invention.

Claims

1. A ship electrical wiring method based on a multi-level Steiner tree, characterized by: The following steps are involved: S1: Initialize and build an attention-based agent model; the specific steps are: S11: Set hyperparameters, including experiment name, seed, deterministic settings, CUDA graphics processing core platform usage, monitoring, and project name; S12: Set up the environment, register and create multiple instances of the training environment and test environment; S13: Build a neural network agent model based on the attention mechanism; the specific steps are: Determine whether there is a pre-trained model: if so, load the weights of the pre-trained model for continued training or use the pre-trained model for inference; otherwise, define a new neural network as the agent model and initialize the parameters; The problem to be solved by the agent is determined based on the experiment name parameter passed in when initializing the agent model. The multi-level Steiner tree problem for ship electrical wiring is selected, and the internal network architecture and parameter settings of the agent model are adjusted accordingly. Select the Adam optimizer to adjust the parameters of the agent model during training; set the optimizer parameters, including learning rate, epsilon value, and weight decay; Storage initialization, setting up data structures to record the execution process of the algorithm; S2: Train the agent model by adjusting its learning rate through interaction with the environment and obtaining environmental feedback. S3: Optimize training strategies and value networks; S4: Evaluate the agent model.

2. A ship electrical wiring method based on a multi-level Steiner tree according to claim 1, characterized in that: In step S12, the training instance is used to train the intelligent agent model and learn parameters; the test instance is used to evaluate the performance of the intelligent agent model; and the test instance is generated from a fixed data set or seed.

3. A ship electrical wiring method based on a multi-level Steiner tree according to claim 1, characterized in that: In step S13, the data structure includes the state of the environment, the action of the agent model, the logarithmic probability of the action, the immediate reward obtained at each step, the end state flag of each environment, and the value estimation of the agent model for each step observation.

4. The ship electrical wiring method based on a multi-level Steiner tree according to claim 1, characterized in that: In the step S3, the specific steps are: S31: Record parameter metrics, including learning rate, value loss, policy loss, and approximate KL divergence; batch process data including observations, actions, and rewards; S32: Calculate policy loss and value function loss; Optimize the policy loss through gradient ascent to improve the decision-making ability of the intelligent model; use historical data to calculate the advantage function and update the policy network of the intelligent model; Optimize the value loss through gradient descent to improve the accuracy of value estimation; update the value function to estimate the expected return of each state; S33: Clip and update gradients to prevent exploding or vanishing gradients; apply clipped gradients to update the neural network parameters of the agent model; S34: Regularly test the training policy in the test environment to monitor its performance on unseen data.

5. A ship electrical wiring method based on a multi-level Steiner tree according to claim 4, characterized in that: The step S3 further includes the following steps: S35: Perform KL divergence detection on the training strategy to monitor the distribution changes before and after the strategy update. If the change exceeds the set threshold, stop further updating to avoid excessive deviation from the original strategy.

6. The ship electrical wiring method based on a multi-level Steiner tree according to claim 1, characterized in that: In step S4, at the end of each update cycle, the performance indicators of the intelligent agent model are evaluated and recorded, and the status of the intelligent agent model is regularly saved and evaluated in the test environment to verify the training effect; the specific steps are: S41: Load the trained agent model; S42: creating an environment instance corresponding to the multi-level Steiner tree problem and including all information of the multi-level Steiner tree problem; S43: Obtain the initial observation or state of the agent model from the environment, including all the initial information required to solve the problem; S44: Decide the next action of the agent model based on the current observation; S45: Execute the decision action and receive the response from the environment, including new observations (i.e., the next state), rewards, and information about whether the goal was achieved. S46: constructing a path to solve the multi-level Steiner tree problem by repeating steps S44 and S45 until a certain termination condition is reached; S47: Output results, including the multi-level Steiner tree graph connection relationship and total length information of the multi-level Steiner tree problem.

7. A ship electrical wiring system based on a multi-level Steiner tree, characterized by: The initialization submodule is used to initialize and build an attention-based agent model; specifically, it includes: Set hyperparameters, including the experiment name, seed, deterministic settings, CUDA graphics processing core platform usage, monitoring, and project name; Set up the environment, register and create multiple instances of the training and testing environments; Construct a neural network agent model based on the attention mechanism; specifically including: Determine whether there is a pre-trained model: if so, load the weights of the pre-trained model for continued training or use the pre-trained model for inference; otherwise, define a new neural network as the agent model and initialize the parameters; The problem to be solved by the agent is determined based on the experiment name parameter passed in when initializing the agent model. The multi-level Steiner tree problem for ship electrical wiring is selected, and the internal network architecture and parameter settings of the agent model are adjusted accordingly. Select the Adam optimizer to adjust the parameters of the agent model during training; set the optimizer parameters, including learning rate, epsilon value, and weight decay; Storage initialization, setting up data structures to record the execution process of the algorithm; Model training submodule, used to train the intelligent agent model; Strategy optimization submodule, used to optimize training strategies and value networks; The model evaluation submodule is used to evaluate the intelligent agent model.

8. A computer memory, characterized in that: A computer program that can be executed by a computer processor is stored therein, and the computer program executes a ship electrical wiring method based on a multi-level Steiner tree as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Track allocation method based on deep reinforcement learning

    CN115719051A

  • Network analysis with steiner trees

    US20090222782A1