A Path Planning Method for AGV in Automated Container Terminals
The path planning model is trained through the proximal strategy optimization algorithm, which solves the anti-conflict problem of AGV path planning in complex environments and multi-AGV collaborative work, achieves fast and accurate path planning, and improves the operational efficiency and safety of automated container terminals. .
Patent Information
- Application Number
- CN202311588474.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-27
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2043-11-27
AI Technical Summary
Existing AGV path planning methods are difficult to effectively prevent conflicts in complex environments and multi-AGV collaborative working scenarios. The calculation complexity is high, the planning time is long, and it cannot meet the needs of efficient operations.
The proximal policy optimization algorithm is used to train the path planning model, and the AGV path is optimized through the value network and policy network. The distance between the AGV and nearby vehicles and the target point distance are considered, and a penalty mechanism is set to avoid long detours to achieve fast and accurate path planning.
It improves the efficiency and anti-collision performance of AGV path planning, shortens planning time, enhances the safety and efficiency of multi-AGV collaborative work, and adapts to task scenarios in different scale environments.
Smart Images

Figure CN117724478B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of port logistics automation equipment and intelligent decision-making control, and in particular to an automated container terminal AGV path planning method. Background Art
[0002] Automated container terminals are hubs for efficient transshipment in the container logistics supply chain. The horizontal transportation system uses automated guided vehicles (AGVs) as transshipment equipment and is a key system for transshipping containers between the quay crane work area and the yard area. As container ships become larger, higher requirements are placed on terminal operation efficiency. The number of AGVs and the complexity of the operating environment continue to increase. How to improve the efficiency and performance of AGV path planning and avoid conflicts between AGVs while improving the efficiency of container loading and unloading is a key issue in the operation of automated container terminals.
[0003] AGV path planning technology refers to the technology that uses algorithms to calculate the optimal path for AGV in a specific environment. In existing AGV systems, AGV path planning is mainly based on traditional algorithms and heuristic algorithms. Path planning methods based on traditional algorithms usually use algorithms such as A* and Dijkstra to calculate the shortest path or the optimal path. The algorithm has high solving efficiency, but its planning effect is not good for complex environments and dynamically changing scenes. Path planning methods based on heuristic intelligent optimization algorithms usually use optimization algorithms such as genetic algorithms, particle swarm algorithms, and ant colony algorithms to optimize AGV driving paths. Compared with methods based on traditional algorithms, such methods have advantages in adapting to complex scenarios, but they have high computational complexity and long planning time. With the development of artificial intelligence, optimization technology based on reinforcement learning is emerging, providing a new way to solve AGV path planning problems.
[0004] Although AGV path planning technology in the field of automated container terminals has made great progress, there are still some problems to be solved: first, the increase in the number of AGVs in mixed loading and unloading task scenarios and the increase in the spatial complexity of the operating environment result in a longer problem-solving time; second, AGV path planning involves multiple AGVs working together in the same transportation area, which requires consideration of system security and anti-collision, and places higher requirements on the performance and stability of the path planning algorithm. The existing AGV path planning method cannot cope with the anti-collision of multiple AGVs working together in the same transportation area. At the same time, the path solving speed is slow and the planning efficiency is low. Summary of the invention
[0005] The purpose of the present invention is to provide an automated container terminal AGV path planning method in order to improve the anti-collision performance when multiple AGVs work in coordination and to increase the speed of solving the paths of multiple AGVs.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] A method for AGV path planning in an automated container terminal, the method comprising:
[0008] The AGV receives the actual loading and unloading tasks, inputs the actual loading and unloading tasks into the trained path planning model, and outputs the AGV path plan;
[0009] Among them, the training process of the path planning model is:
[0010] S1, receiving a task for training, and determining the starting point and end point of the task in a grid map;
[0011] S2, set the action space, state space, reward function, value network and strategy network of the AGV;
[0012] S3. Use the proximal strategy optimization algorithm to update the parameters of the value network and the strategy network, and iterate until the training round number threshold is reached.
[0013] Furthermore, the state space of the AGV is:
[0014] state=[k 0 ,k 1 ,k 2 ,k 3 ,x now ,y now ,x goal-now ,y goal-now ,d min ]
[0015] Among them, state represents the state of the AGV car, [k 0 ,k 1 ,k 2 ,k 2 ,x now ,y now ,x goal-now ,y goal-now ,d min ] represents the state space of the car, k i ,i∈{0,1,2,3} indicates whether the AGV will exceed the map boundary when executing action i at the current moment. If so, k i is 1, otherwise it is 0, x now and nowThe horizontal and vertical coordinates of the current position of the AGV car, x goal-now and goal-now are the relative horizontal and vertical coordinates of the current position of the AGV and the end point, respectively. min Indicates the distance between the current AGV and the nearest AGV.
[0016] Furthermore, the reward function is:
[0017]
[0018] Among them, d goal-now Indicates the distance between the current AGV and the end point, d goal-next Indicates the distance between the next AGV and the end point.
[0019] Furthermore, the proximal strategy optimization algorithm is used to update the parameters of the value network and the strategy network. The specific steps of iterative updating until the training round number threshold is reached are:
[0020] A1. Initialize an experience array, where the experience array represents a buffer for storing sampled data;
[0021] A2. Get the current state, input the current state into the policy network, and the policy network outputs the probability distribution;
[0022] A3. Sample an action from the probability distribution and perform the action in the environment;
[0023] A4. After executing the action, the environment feedbacks the reward and the next state;
[0024] A5, store the sampled action obtained in A3, the probability corresponding to the sampled action, the reward of A4, the current state and the next state into the experience array, and determine whether the AGV has reached the end point. If so, add 1 to the number of training rounds, set the current state to the initial state of the AGV at the starting point, and then execute A6. If not, execute A6 directly;
[0025] A6 checks whether the size of the experience array reaches the preset batch size. If yes, execute A7. Otherwise, return to A2.
[0026] A7. Calculate the advantage function value of each sample from the experience array, where a sample represents the data stored when A5 is executed once;
[0027] A8. Calculate the importance sampling weight based on the advantage function value;
[0028] A9. Use importance sampling weights to calculate the loss function of the value network and the policy network;
[0029] A10. Back-propagate the loss function to calculate the gradient and update the parameters of the value network and the policy network.
[0030] A11. Repeat A2 to A11 until the specified number of training rounds is reached.
[0031] Furthermore, the specific steps of A3 and A4 are:
[0032] Sample an action from the probability distribution, calculate the coordinates Q of the AGV after executing the action through the action and the current position of the AGV in the current state, and determine whether the coordinates Q will exceed the map boundary. If the coordinates Q exceed the map boundary, then:
[0033] Determine whether the four directions around the current position of the AGV are impassable. If so, stop the AGV and return to A2. If not, return directly to A2.
[0034] If the coordinate Q does not exceed the map boundary, determine whether there are other AVG cars at the coordinate Q. If there are other AVG cars at the coordinate Q, then:
[0035] Determine whether the four directions around the current position of the AGV are impassable. If so, stop the AGV and return to A2. If not, return directly to A2.
[0036] If there is no other AVG car at coordinate Q, then:
[0037] Execute this action and use the coordinate Q as the new current position of the AGV, the environment feedback reward and the next state.
[0038] Furthermore, the policy network is a 5-layer neural network, wherein the first four layers are linear activation function networks, and the last layer is an output layer, each layer of the linear activation function network includes a linear layer and a ReLU activation function layer connected in sequence, and the output layer includes a linear layer and a Hardswish activation function layer connected in sequence;
[0039] The specific steps of inputting the current state into the policy network and outputting the probability distribution of the policy network are as follows:
[0040] After the current state is input into the policy network, it passes through the first four layers of linear activation function networks of the neural network in sequence, and finally enters the output layer, which outputs the probability distribution.
[0041] Furthermore, the importance sampling weights are calculated based on the generalized advantage estimate, and the importance sampling weights are:
[0042]
[0043] Among them, γ is the discount factor, λ advantageis a hyperparameter, T is the length of the experience array, δ t+l Represents the TD error of the lth sample at the current time step t.
[0044] Furthermore, the loss function of the value network is the mean square error loss function.
[0045] Furthermore, the loss function of the policy network is:
[0046]
[0047] Among them, p θ (a t |s t ) represents the probability of the sampled action obtained by the current policy network selecting A3 under the current state of A2, It represents the probability of the sampled action obtained by the policy network selecting A3 in the current state of A2 in the last iteration, represents the advantage function of the sampled action obtained by A3, clip represents the cutoff function, and ε is a preset parameter.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] The present invention optimizes the path planning model by adopting the proximal strategy optimization algorithm, so as to plan the path of the AGV more quickly and accurately, fully consider the operating constraints of the AGV, consider the distance between the two closest AVGs in the state of the planning model, and give a penalty when the distance is less than a certain threshold, so as to avoid collision and improve the anti-collision performance of multiple AGVs working in collaboration; at the same time, the distance to the target point after the next step is executed is considered, and the anti-detour mechanism is used to set a penalty value for the detour behavior that occurs during the driving of the AGV, thereby improving the efficiency of path planning and the speed of solving the paths of multiple AGVs. Based on the learning mechanism, the strategy is adaptively adjusted in environments of different scales, and effective anti-collision path planning is performed according to the actual loading and unloading task scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A flow chart of the path planning model training of the present invention;
[0051] Figure 2 It is a flow chart of the interaction between the AGV and the environment of the present invention;
[0052] Figure 3 An abstract diagram of the automated container terminal environment;
[0053] Figure 4 A grid map of the AGV driving lane in the embodiment;
[0054] Figure 5is the structure of the neural network used in the embodiment;
[0055] Figure 6 is the algorithm convergence curve in the embodiment;
[0056] Figure 7 This is a schematic diagram of the AGV path planning results. DETAILED DESCRIPTION
[0057] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0058] When executing tasks in the horizontal transport area of the AGV at an automated container terminal, the terminal will face complex scenarios with multiple loading and unloading tasks, high timeliness requirements, and mixed loading and unloading tasks. Due to the limitation of the site size, the AGV path planning will be complex, the solution will be time-consuming, and conflicts and deadlocks will easily occur. In view of this, the present invention provides an automated container terminal AGV path planning method based on a proximal strategy optimization algorithm, which can improve the AGV path planning solution efficiency and reduce the possibility of AGV conflicts, thereby effectively improving the transit efficiency and safety of the horizontal transport area of the AGV at the automated container terminal. The present invention proposes an automated container terminal AGV path planning method. The flow chart of the path planning model training in the present invention is as follows: Figure 1 shown.
[0059] The AGV path planning problem in automated container terminals can be described as follows: each AGV is in normal working condition and has been assigned corresponding loading and unloading tasks. The speed of the AGV is kept constant during driving, and the power constraint during driving is not considered. It is not allowed to collide with each other or drive out of the lane during driving. The path planning goal is to minimize the maximum completion time of the AGV. Aiming at the AGV path planning problem scenario of automated container terminals, the AGV horizontal transportation area is abstracted into a grid map scene, and a proximal strategy optimization algorithm considering the anti-detour mechanism is proposed. The anti-collision path planning is performed for multiple AGVs performing loading and unloading tasks with the goal of minimizing the maximum completion time.
[0060] The method proposed by the present invention comprises the following steps:
[0061] The AGV receives the actual loading and unloading tasks, inputs the actual loading and unloading tasks into the trained path planning model, and outputs the AGV path plan;
[0062] Among them, the training process of the path planning model is:
[0063] S1, receiving a task for training, and determining the starting point and end point of the task in a grid map;
[0064] S2, set the action space, state space, reward function, value network and strategy network of the AGV;
[0065] S3. Use the proximal strategy optimization algorithm to update the parameters of the value network and the strategy network, and iterate until the training round number threshold is reached.
[0066] During the training process of the path planning model, the map of the horizontal transportation area of the automated container terminal AGV is gridded, and each AGV is given a loading and unloading task according to the scheduling plan. After the AGV accepts the task, the starting and end points of each task in the gridded map are determined.
[0067] The schematic diagram of the automated container terminal is attached. Figure 3 For example, the terminal environment is abstracted into a 10*10 grid map, where 5 AGVs receive tasks. The grid map is as follows: Figure 4 As shown in the figure. The grid lines represent the two-way guide lanes, the grid nodes represent the nodes where the AGV can turn, the squares represent the initial positions of each AGV, and the dots represent the target positions of each AGV. The starting position coordinates and the end position coordinates of each AGV working in the terminal and the corresponding task type assigned to it are all known.
[0068] In S2, a discrete action space is set for the AGV in the grid map. Since the AGV is traveling on a two-way lane and is allowed to travel in both directions, four action functions need to be realized, namely, going straight, backing up, turning and stopping. Then, according to the action space, five actions are designed for each AGV, namely, up, down, left, right and stop, which are represented by 0, 1, 2, 3 and 4 respectively.
[0069] Action∈{0,1,2,3,4} (1)
[0070] A state space is set for the AGV, and the AGV dynamically updates the state space according to the position coordinates of the target point and the starting point, the position coordinates of the AGVs working nearby at the same time and other environmental information; the AGV driving path cannot cross the boundary of the grid map, and its constraint method is based on the current action execution state. If it crosses the boundary, the indicator is 1, otherwise it is 0; the state space information includes the current position coordinates of the AGV car and the coordinates of the current position relative to the target point to improve the training efficiency; in order to effectively prevent AGV path conflicts, the distance between the current AGV and the nearest AGV nearby is introduced as another environmental variable of the state space, so as to achieve effective avoidance of conflicts and deadlocks among multiple AGVs in the grid map.
[0071] The state space is defined as in equation (2).
[0072] state=[k 0 ,k 1 ,k 2 ,k 3 ,x now ,y now ,x goal-now ,y goal-now ,d min ] (2)
[0073] k i ,i∈{0,1,2,3} indicates whether the AGV will exceed the map boundary when executing action i at the current moment. If so, k i AGV is 1, otherwise it is 0. AGV is traveling on a grid map with limited range. During the driving process, it is obviously not allowed to exceed the map boundary. However, during the training process, the neural network may make a decision to make the AGV go out of the boundary. The present invention informs the AGV in advance whether there is a boundary around it in the state space, which effectively improves the training efficiency; x now and now The horizontal and vertical coordinates of the current position of the AGV are respectively; the neural network must master the current position coordinates of the AGV, otherwise it will not be able to make a decision; x goal-now and goal-now They are the relative horizontal coordinate and relative vertical coordinate of the current position and the target position of the AGV respectively. The preprocessing of the relative coordinates can speed up the training of the neural network. min Indicates the distance between the current AGV and the nearest AGV. When multiple AGVs work together, it is hoped that conflicts and deadlocks can be avoided between AGVs. min If the value is too small, a certain penalty will be imposed on the agent to prevent conflicts.
[0074] A reward function is designed for AGV. As an intelligent agent, each action made by the AGV will cause the state of the environment to change. The algorithm needs to give a reward value based on the current state of the environment to guide the AGV to take better actions. In order to minimize the maximum completion time of the AGV, a higher reward value is set for a shorter completion time solution, encouraging the algorithm to choose a more efficient path. At the same time, in order to guide the AGV to avoid conflicts when working, a higher reward value is set for the driving path with a smaller degree of conflict, encouraging the algorithm to choose a safer and more reliable path. Finally, in order to enable the algorithm to achieve the goal of minimizing the maximum completion time of the AGV faster, a strategy based on the anti-detour mechanism is proposed. The strategy sets a penalty value for the detour behavior that occurs during AGV driving, and improves the ability of the proximal strategy optimization algorithm to select a better anti-collision path.
[0075] When the agent takes an action, the state of the environment changes. The algorithm needs to give a reward value based on the current state of the environment to guide the agent to take better actions. The reward value is obtained through the reward function. The design of the reward function will directly affect the convergence speed and performance of the algorithm. In deep reinforcement learning, extra attention should be paid to avoid sparse rewards. Sparse rewards will make it difficult for the algorithm to converge. Therefore, when designing the reward function, the best situation is that the agent can get feedback from the reward function at every step, and the relative size of each reward value should be reasonable enough.
[0076] Based on the above requirements, the reward function designed in this embodiment is as shown in formula (3).
[0077]
[0078] If the decision made by the algorithm causes the current AGV to conflict with other AGVs, the reward value is -1000; if the decision made by the algorithm causes the AGV to cross the boundary, the reward value is -800; if the decision made by the algorithm causes the AGV to reach the target location, the reward value is 200000. The reward value here is set very large to enhance the attractiveness of reaching the target point: In the early stage of training, the strategy adopted by the agent is very poor and will receive a lot of negative feedback. If the absolute value of the positive reward is too small, the negative feedback will annihilate the positive reward, causing the agent to enter a negative state during the learning process and the algorithm will be difficult to converge; if there are other vehicles very close to the current AGV, the reward value obtained is a value that is equal to d min A negative number that is inversely proportional to the target point; if the distance between the AGV and the target point at the next moment is greater than the distance between the AGV and the target point at the current moment, it means that the AGV has a tendency to move away from the end point. At this time, a penalty is imposed on the AGV. The farther the straight-line distance between the AGV's current position and the target position, the greater the penalty. This item can prevent the AGV from going back or taking a detour. If the AGV is in any other legal state, the reward value obtained is a negative number, that is, a penalty is imposed. The farther the straight-line distance between the AGV's current position and the target position, the greater the penalty. This penalty can guide the AGV to reach the target position faster.
[0079] The specific steps of using the proximal policy optimization algorithm to update the parameters of the value network and the policy network and iteratively updating until the training round number threshold is reached are:
[0080] A1. Initialize an experience array, where the experience array represents a buffer for storing sampled data;
[0081] A2. Get the current state, input the current state into the policy network, and the policy network outputs the probability distribution;
[0082] A3. Sample an action from the probability distribution and perform the action in the environment;
[0083] A4. After executing the action, the environment feedbacks the reward and the next state;
[0084] A5, store the sampled action obtained in A3, the probability corresponding to the sampled action, the reward of A4, the current state and the next state into the experience array, and determine whether the AGV has reached the end point. If so, add 1 to the number of training rounds, set the current state to the initial state of the AGV at the starting point, and then execute A6. If not, execute A6 directly;
[0085] A6 checks whether the size of the experience array reaches the preset batch size. If yes, execute A7. Otherwise, return to A2.
[0086] A7. Calculate the advantage function value of each sample from the experience array, where a sample represents the data stored when A5 is executed once;
[0087] A8. Calculate the importance sampling weight based on the advantage function value;
[0088] A9. Use importance sampling weights to calculate the loss function of the value network and the policy network;
[0089] A10. Back-propagate the loss function to calculate the gradient and update the parameters of the value network and the policy network.
[0090] A11. Repeat A2 to A11 until the specified number of training rounds is reached.
[0091] The formula of the proximal strategy optimization algorithm is as shown in formula (4).
[0092]
[0093] The basic framework of the proximal policy optimization algorithm includes collecting experience, updating strategies, evaluating strategies and repeating processes.
[0094] In A1, the experience array is initialized: an experience array (buffer) buffer is created to store sampled data, and its size is determined by the hyperparameter sample step. This buffer will store a batch of samples during the training process for subsequent advantage function calculation and strategy update.
[0095] In A2, the policy network is input to obtain the probability distribution: the current state state is input into the policy network, which outputs a probability distribution dist, which represents the probability of each possible action in a given state.
[0096] The policy network is a neural network that receives state as input and then generates a probability distribution for each possible action in the output layer. Since there are five possible actions, the output layer will have five neurons, each of which outputs the probability of an action. After inputting the state state to the policy network, the network will output a probability distribution dist, which represents the probability of each possible action (up, down, left, right, and stop) in the given state.
[0097] In A3, sampling action: sample an action action from the probability distribution dist and obtain the probability prob corresponding to the action. This action will be used to execute in the environment.
[0098] In A4, execute actions and obtain rewards: Use the sampled action action to execute in the environment, obtain the reward reward and the next state next_state. This reward reflects the return obtained by taking the action in the current state.
[0099] The specific steps of A3 and A4 are:
[0100] A3. Sample an action from the probability distribution, calculate the coordinates Q of the AGV after executing the action through the action and the current position of the AGV in the current state, and determine whether the coordinates Q will exceed the map boundary. If the coordinates Q exceed the map boundary, then:
[0101] Determine whether the four directions around the current position of the AGV are impassable. If so, stop the AGV and return to A2. If not, return directly to A2.
[0102] If the coordinate Q does not exceed the map boundary, determine whether there are other AVG cars at the coordinate Q. If there are other AVG cars at the coordinate Q, then:
[0103] Determine whether the four directions around the current position of the AGV are impassable. If so, stop the AGV and return to A2. If not, return directly to A2.
[0104] If there is no other AVG car at coordinate Q, then:
[0105] Execute this action, use coordinate Q as the new current position of the AGV, and then execute A4, the environment feedback reward and the next state.
[0106] Among them, when the four directions around the current position of the AGV are impassable, it means that the AGV cannot perform any action at the current moment, so the operation of the AGV is stopped, and then waits for the next moment and returns to S2. The specific steps of A3 and A4 correspond to Figure 2 The process of interacting with the environment.
[0107] In A5, data is stored: the sampled action action, probability prob, reward reward, current state state and next state next_state are stored in the experience array buffer. It is determined whether the AGV has reached the end point at this time. If so, the number of training rounds is increased by 1, the current state is set to the initial state of the AGV at the starting point, and then A6 is executed. If not, A6 is executed directly.
[0108] In A6, check the buffer size: check whether the size of the experience array buffer reaches the pre-set batch size batch_size. If it reaches, proceed to A7; if it is less, jump back to A2 to continue sampling.
[0109] In A7, the advantage function value is calculated: the advantage function value of each sample in the current experience data is calculated. The advantage function represents the superiority of the current sampled action relative to the average action, which helps to estimate the direction of the policy gradient.
[0110] The advantage function expresses the advantage of an action a relative to the average value in state s. The definition of the advantage function is shown in formula (5).
[0111] A π (s,a)=Q π (s,a)-V π (s) (5)
[0112] The use of advantage function helps to avoid overfitting of the algorithm. In the proximal policy optimization algorithm, generalized advantage estimation (GAE) is generally used to estimate the advantage function. The GAE function is shown in formula (6).
[0113]
[0114] Where T is the length of the empirical array, which is generally equal to the hyperparameter batch size set in the experiment; λ advantage is a hyperparameter that needs to be set manually; δ t The calculation of is shown in formula (7).
[0115] δ t =r t +γV(s t+1 )-V(s t ) (7)
[0116] In A8, calculate the importance sampling weight: To solve the problem of different distributions of the new and old strategies, calculate the importance sampling weight ratio of each sample. This weight will be used to adjust the contribution of the old strategy sampling in the subsequent loss function calculation.
[0117] An example of using importance sampling is shown in equation (8).
[0118]
[0119] Among them, J θ′ (θ) refers to the objective function to be optimized, θ is the parameter to be updated during training, θ′ is the parameter before update, and s t and a t It is the data sampled from θ′ as a demonstration.
[0120] In this embodiment, importance sampling is applied as shown in formula (9).
[0121]
[0122] Among them, ε is a hyperparameter that needs to be set manually; 1-ε,1+ε) is a clipping function. Here, this function means: among the three items in the brackets, if the first item is less than the second item, the second item 1-ε is output; if the first item is greater than the third item, the third item 1+ε is output.
[0123] In A9, the loss function is calculated: the importance sampling weight ratio is used to calculate the loss function of the value network and the policy network. This loss function is used to guide the update of the policy network and the value network.
[0124] The loss function of the policy network is calculated based on the policy gradient method. For the update of the policy network, it is necessary to increase the probability of actions that produce high rewards and reduce the probability of actions that produce low rewards. The loss function can be adjusted using the ratio between the new and old policies to reduce the changes introduced by the new policy.
[0125] For example, suppose that in state s t Next, action a t The old strategy probability is The probability of the new strategy is p θ (a t |s t ), and the corresponding advantage function is The loss function of the policy network is shown in formula (10).
[0126]
[0127] The loss function of the value network can use the mean squared error (MSE) to measure the gap between the predicted state value and the actual return. Assuming V(s) is the value network's estimate of state s, and R is the actual return, the loss function of the value network is shown in formula (11).
[0128] L value =MSE(V(s),R) (11)
[0129] Back-propagation updates the policy network: The gradient is calculated by back-propagating the loss function, and the parameters of the policy network are updated using an optimization algorithm to improve the policy.
[0130] Backpropagation is a method for calculating gradients, which is used to determine how to adjust network parameters to reduce the loss function. Through the chain rule, we can calculate the contribution of each parameter to the loss function and pass these contributions along the layers of the network to calculate the gradient of each parameter. After obtaining the gradient of the policy network parameters, we can use the optimization algorithm to update these parameters. In this embodiment, the Adam optimization algorithm built into the deep learning framework PyTorch is used to update the parameters.
[0131] In A10, back propagation updates the value network: back propagates the gradient of the value network parameters and uses the optimization algorithm to update the value network parameters to more accurately estimate the state value function. The general steps are similar to updating the policy network.
[0132] In A11, A2 to A11 are repeated to continuously sample, calculate the advantage function, calculate the loss function, and update the policy network and the value network until the specified number of training rounds is reached.
[0133] The neural network used in this embodiment is as shown in the attached Figure 5 As shown. The training process of the proximal policy optimization algorithm uses a five-layer fully connected neural network to fit the value function and policy function, which is used to evaluate the quality of the AGV path and guide the optimization process. The five-layer fully connected neural network has stronger expressive power, can learn complex features and patterns, more accurately model and represent complex relationships in path planning problems, and improve the prediction and decision-making capabilities of the algorithm; at the same time, the multi-layer neural network provides greater freedom for parameter optimization and adjustment, which helps to improve the generalization ability and performance of the algorithm; because the multi-layer fully connected neural network has multiple nonlinear activation functions, the network can better handle the nonlinear relationship in the input data, ensuring the fitting ability and accuracy of the algorithm. The neural network accepts the current state as input and outputs the value estimate of the corresponding state and the probability distribution of the action; by using the value estimate, the proximal policy optimization algorithm can better guide the AGV path planning process, so that each AGV selects an action with the advantage of obtaining greater potential rewards; by comparing the probability distribution of actions, it can help the algorithm improve the path planning strategy and better adapt to the requirements of the environment and tasks. The interaction process between AGV and the environment is shown in the attached figure. Figure 2 shown.
[0134] In this neural network, a linear function Linear is used as shown in formula (12).
[0135] y=xA T +b (12)
[0136] The first four layers use the activation function ReLU as shown in formula (13), and the fifth layer uses the activation function Hardswish as shown in formula (14).
[0137] Re LU(x)=(x) + =max(0,x) (13)
[0138]
[0139] In this embodiment, the above neural network was trained for 300 rounds, and the algorithm convergence curve obtained by training is shown in the attached figure. Figure 6 As shown in the figure, the AGV path solved by the algorithm after training is as shown in the figure. Figure 7 shown.
[0140] The training time of the proximal strategy optimization algorithm is 160 seconds. After the training, the average CPU calculation time of 10 model solution instances is about 0.5 seconds. The maximum completion time of the AGV path planning scheme is 20 seconds. Under the premise of anti-collision, the sum of the completion time of all AGVs is 73 seconds, which can meet the requirements of solution efficiency and optimization performance of AGV path planning in automated container terminals.
[0141] The present invention has the following advantages:
[0142] 1. The anti-collision path planning method for automated container terminal AGV based on the proximal strategy optimization algorithm proposed in the present invention can plan the path of the AGV more quickly and accurately, and at the same time can fully consider the operating constraints of the AGV to avoid collisions, thereby improving the efficiency of path planning and anti-collision performance.
[0143] 2. The proximal strategy optimization algorithm of the present invention can adaptively adjust strategies in environments of different scales based on a learning mechanism, and perform effective anti-collision path planning according to actual loading and unloading task scenarios.
[0144] 3. The proximal strategy optimization algorithm of the present invention is embedded with an anti-detour mechanism, which improves the algorithm's ability to select a better anti-collision path by setting a penalty value for detour behaviors that occur during AGV driving.
[0145] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A method for AGV path planning in an automated container terminal, characterized in that: Methods include: The AGV receives the actual loading and unloading tasks, inputs the actual loading and unloading tasks into the trained path planning model, and outputs the AGV path plan; Among them, the training process of the path planning model is: S1. Receive a task for training and determine the starting and ending points of the task in a grid map; S2, set the action space, state space, reward function, value network and strategy network of the AGV; S3, using the proximal strategy optimization algorithm to update the parameters of the value network and the strategy network, and iteratively update until the training round number threshold is reached; The action space of the AGV car is: Action∈{0, 1, 2, 3, 4} Among them, Action represents the action taken by the AGV, {0, 1, 2, 3, 4} action space, 0, 1, 2, 3, 4 respectively represent the five actions of the AGV: up, down, left, right, stop; The state space of the AGV car is: state=[k0,k1,k2,k3,x now , y now ,x goal-now ,y goal-now ,d min ] Among them, state represents the state of the AGV car, [k0, k1, k2, k3, x now ,y now , x goal-now ,y goal-now , d min ] represents the state space of the car, k i , i∈{0, 1, 2, 3} indicates whether the AGV will exceed the map boundary when executing action i at the current moment. If so, k i is 1, otherwise it is 0, x now and now The horizontal and vertical coordinates of the current position of the AGV car, x goal-now and goal-now are the relative horizontal and vertical coordinates of the current position of the AGV and the end point, respectively. min Represents the distance between the current AGV and the nearest AGV nearby; the reward function is: Among them, d goal-now Indicates the distance between the current AGV and the end point, d goal-next Indicates the distance between the next AGV and the end point; The specific steps of using the proximal policy optimization algorithm to update the parameters of the value network and the policy network and iteratively updating until the training round number threshold is reached are: A1. Initialize an experience array, where the experience array represents a buffer for storing sampled data; A2. Get the current state, input the current state into the policy network, and the policy network outputs the probability distribution; A3. Sample an action from the probability distribution and perform the action in the environment; A4. After executing the action, the environment feedbacks the reward and the next state; A5, store the sampled action obtained in A3, the probability corresponding to the sampled action, the reward of A4, the current state and the next state into the experience array, and determine whether the AGV has reached the end point. If so, add 1 to the number of training rounds, set the current state to the initial state of the AGV at the starting point, and then execute A6. If not, execute A6 directly; A6 checks whether the size of the experience array reaches the preset batch size. If yes, execute A7. Otherwise, return to A2. A7. Calculate the advantage function value of each sample from the experience array, where a sample represents the data stored when A5 is executed once; A8. Calculate the importance sampling weight based on the advantage function value; A9. Use importance sampling weights to calculate the loss function of the value network and the policy network; A10. Back-propagate the loss function to calculate the gradient and update the parameters of the value network and the policy network. A11, repeat A2 to A11 until the specified number of training rounds is reached; The specific steps of A3 and A4 are: Sample an action from the probability distribution, calculate the coordinates Q of the AGV after executing the action through the action and the current position of the AGV in the current state, and determine whether the coordinates Q will exceed the map boundary. If the coordinates Q exceed the map boundary, then: Determine whether the four directions around the current position of the AGV are impassable. If so, stop the AGV and return to A2. If not, return directly to A2. If the coordinate Q does not exceed the map boundary, determine whether there are other AVG cars at the coordinate Q. If there are other AVG cars at the coordinate Q, then: Determine whether the four directions around the current position of the AGV are impassable. If so, stop the AGV, wait for the next moment, and return to A2. If not, return directly to A2. If there is no other AVG car at coordinate Q, then: Execute this action and use the coordinate Q as the new current position of the AGV, the environment feedback reward and the next state.
2. The method for AGV path planning in an automated container terminal according to claim 1, characterized in that: The policy network is a 5-layer neural network, wherein the first four layers are linear activation function networks, and the last layer is an output layer. Each layer of the linear activation function network includes a linear layer and a ReLU activation function layer connected in sequence, and the output layer includes a linear layer and a Hardswish activation function layer connected in sequence. The specific steps of inputting the current state into the policy network and outputting the probability distribution of the policy network are as follows: After the current state is input into the policy network, it passes through the first four layers of linear activation function networks of the neural network in sequence, and finally enters the output layer, which outputs the probability distribution.
3. The method for AGV path planning in an automated container terminal according to claim 1, characterized in that: The importance sampling weights are calculated based on the generalized advantage estimate and are: Among them, γ is the discount factor, λ advantage is a hyperparameter, T is the length of the experience array, δ t+l Represents the TD error of the lth sample at the current time step t.
4. The method for AGV path planning in an automated container terminal according to claim 1, characterized in that: The loss function of the value network is the mean square error loss function.
5. The method for AGV path planning in an automated container terminal according to claim 1, characterized in that: The loss function of the policy network is: Among them, p θ (a t |s t ) represents the probability of the sampled action obtained by the current policy network selecting A3 under the current state of A2, It represents the probability of the sampled action obtained by the policy network selecting A3 in the current state of A2 in the last iteration, represents the advantage function of the sampled action obtained by A3, clip represents the cutoff function, and ε is a preset parameter.
