An ant colony algorithm-based dynamic path calculation optimization method and system
By using the ant colony algorithm to construct a directed weighted graph and iterative search in the edge network to optimize the path tree, the problem of high task latency in the edge network is solved, and faster task processing and lower communication latency are achieved.
Patent Information
- Application Number
- CN202311698603.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-11
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2043-12-11
AI Technical Summary
In edge networks, node heterogeneity and network connection changes cause high task latency, especially in the deployment of chained tasks. Existing technologies find it difficult to optimize computing paths to meet real-time requirements.
A dynamic calculation path optimization method based on ant colony algorithm is adopted. By constructing a directed weighted graph, initializing ants and pheromones, and using ant colony algorithm for iterative search, local and global pheromones are updated, and the path tree is optimized to find the optimal deployment solution.
It shortens the processing time of tasks in edge networks, improves the speed of solving dynamic calculation paths, reduces communication delays and computing costs, and is suitable for the deployment of chain tasks in edge networks.
Smart Images

Figure CN117689095B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of edge computing technology, and more specifically, to a dynamic computing path optimization method and system based on an ant colony algorithm. Background Art
[0002] With the rise of in-network computing (In-Network Computing) technology, Mobile Edge Computing (MEC) further expands the distributed and tightly integrated computing network capabilities from end devices, through the edge, to cloud infrastructure. MEC can provide more collaborative processing and better services to respond to emerging latency-constrained applications that require fast responses and real-time user experiences.
[0003] For example, intelligent surveillance applications require analyzing video content, identifying target events and video clips, and transmitting these back to the monitoring center in real time. Using in-network computing technology, computing resources within the network handle subtasks such as analysis and target identification, significantly reducing processing latency.
[0004] Different deployment schemes can lead to significant latency differences in different network environments and task requirements, especially for chained tasks (where the input of a subtask depends on the output of the previous subtask). In some scenarios, the optimal deployment scheme is to have the task processed by the source node and the final result transmitted to the destination node. In other scenarios, the opposite is true, where transmitting the input parameters to the destination node and having the destination node complete the entire task processing takes the least time.
[0005] However, in edge networks, the network connections between nodes are changing, and the nodes are usually heterogeneous, with a variety of devices with different computing performance and communication bandwidth, that is, resource heterogeneity. If only considering handing tasks over to the source path node or the destination path node for processing, it may result in high latency. Summary of the Invention
[0006] In order to overcome the defect of high latency in single node calculation in edge networks described in the above-mentioned prior art, the present invention provides a dynamic calculation path optimization method and system based on ant colony algorithm.
[0007] In order to solve the above technical problems, the technical solutions of the present invention are as follows:
[0008] In a first aspect, a dynamic computation path optimization method based on an ant colony algorithm comprises:
[0009] Obtaining node information and task chain information about path nodes in the network and constructing a directed weighted graph; wherein the directed weighted graph is configured with a source path node and a destination path node;
[0010] Initialize ants, path trees and pheromones used to store deployment plans;
[0011] Iterative search is performed based on the ant colony algorithm. During each iteration:
[0012] Using the directed weighted graph, each ant starts from a source path node, searches for a path to a destination path node, and offloads tasks to the path node reached by the corresponding ant based on the task chain information, and records effective deployment plans; updates local pheromones and the path tree based on the deployment plans; selects the optimal deployment plan in the current iteration, and updates the path tree until the iteration ends;
[0013] After the iteration is completed, the optimal deployment solution is output according to the path tree as the dynamic calculation path.
[0014] In the second aspect, a dynamic calculation path optimization system based on an ant colony algorithm includes:
[0015] A directed graph construction module is used to obtain node information and task chain information about path nodes in the network and construct a directed weighted graph; wherein the directed weighted graph is configured with a source path node and a destination path node;
[0016] Path search module, used to configure the ant colony algorithm for iterative search;
[0017] The storage module is used to store the path tree and output the optimal deployment plan as a dynamic calculation path after the iteration is completed.
[0018] In each iteration:
[0019] Using the directed weighted graph, each ant starts from a source path node, searches for a path to a destination path node, and offloads tasks to the path node reached by the corresponding ant based on the task chain information, and records effective deployment plans; updates local pheromones and a path tree based on the deployment plans; selects the optimal deployment plan in the current iteration, and updates the path tree until the iteration ends.
[0020] In a third aspect, a computer-readable storage medium is provided, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the method described in the first aspect.
[0021] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:
[0022] This invention discloses a dynamic computation path optimization method based on an ant colony algorithm. Based on information about path nodes and task chains in a network, the ant colony algorithm performs an iterative search and synchronously updates the path tree, ultimately obtaining an optimal deployment solution as a dynamic computation path for deploying tasks to each path node. Compared to existing technologies, this method can shorten the processing time of tasks in edge networks, increase the speed of solving dynamic computation paths, better meet the needs of network changes, reduce communication latency and computation time costs, and is particularly suitable for deploying chained tasks in edge networks. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 Schematic diagram of the process of the dynamic calculation path optimization method in Example 1 of the present invention;
[0024] Figure 2 This is an example diagram of a directed weighted graph in Embodiment 1 of the present invention;
[0025] Figure 3 This is an example diagram of the path tree in Example 1 of the present invention;
[0026] Figure 4 This is a structural diagram of the dynamic calculation path optimization system in Example 2 of the present invention. DETAILED DESCRIPTION
[0027] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0028] The accompanying drawings are for illustrative purposes only and are not to be construed as limiting this patent;
[0029] In order to better illustrate this embodiment, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product size;
[0030] It is understandable to those skilled in the art that some well-known structures and descriptions thereof may be omitted in the drawings.
[0031] To facilitate those skilled in the art to implement the technical solutions described in the embodiments, the ant colony algorithm is described as follows:
[0032] The ant colony algorithm is inspired by the social behavior of ants foraging in nature. Ants with relatively low individual intelligence can, through pheromone communication, find the shortest path from food to their nest, fostering high collective intelligence. Each ant leaves behind pheromones as it moves. These pheromones are detected by the ants behind them and evaporate over time. Individual ants tend to follow paths with high pheromone concentrations. Over time, the pheromone concentration on shorter paths increases, leading more and more ants to follow them.
[0033] The technical solution of the present invention is further described below with reference to the accompanying drawings and embodiments.
[0034] Example 1
[0035] This embodiment proposes a dynamic calculation path optimization method based on ant colony algorithm, see Figure 1 ,include:
[0036] Obtaining node information and task chain information about path nodes in the network and constructing a directed weighted graph; wherein the directed weighted graph is configured with a source path node and a destination path node;
[0037] Initialize ants, path trees and pheromones used to store deployment plans;
[0038] Iterative search is performed based on the ant colony algorithm. During each iteration:
[0039] Using the directed weighted graph, each ant starts from a source path node, searches for a path to a destination path node, and offloads tasks to the path node reached by the corresponding ant based on the task chain information, and records effective deployment plans; updates local pheromones and the path tree based on the deployment plans; selects the optimal deployment plan in the current iteration, and updates the path tree until the iteration ends;
[0040] After the iteration is completed, the optimal deployment solution is output according to the path tree as the dynamic calculation path.
[0041] In this embodiment, the path node selection results and the corresponding task offloading results are combined as the deployment plan. A path tree is established to store the deployment plans. An ant colony algorithm is used to iteratively search for the optimal deployment plan, ultimately finding the globally optimal deployment plan at the end of the iteration. Compared to existing technologies, this embodiment can shorten the processing time of tasks in edge networks, increase the speed of solving dynamic calculation paths, better meet the needs of network changes, reduce communication latency and computing time costs, and is particularly suitable for deploying chained tasks to edge networks.
[0042] In some examples, a directed weighted graph G is constructed<V,E> , V represents the path node v iThe set of directed edges, E represents the set of directed edges, each directed edge e i,j ∈E, represents v i to v j The data transmission rate of the link is B i,j >0; it can be understood that the source path node s∈V and the destination path node d∈V.
[0043] Those skilled in the art should understand that the initialization process of the ant colony algorithm includes the settings of the number of ants, pheromone volatility and the maximum number of iterations; each ant includes a deployment plan, which initially only includes the source path node (i.e., starting from the source path node).
[0044] In some examples, the pheromone is initialized to 0.
[0045] In some preferred embodiments, the task chain information includes a task set k={k1, k2, ..., k K}, represents K task nodes;
[0046] The process of initializing the path tree includes:
[0047] Initialize a tree with only a root node as the path tree;
[0048] Two types of node attributes, V-type nodes and K-type nodes, are configured for the path tree; wherein the V-type node is used to represent a path node in a dynamically calculated path, and the K-type node is used to represent the last task node unloaded on the corresponding V-type node, and its value range is {nil}∪k, where nil indicates that no task is unloaded on the corresponding V-type node, and k is a task set; the V-type node and the K-type node are alternately connected by lines, and the lines are used to configure pheromones between the nodes;
[0049] The source path node is associated with the root node of the path tree and configured as a V-shaped node.
[0050] It should be noted that the odd-numbered nodes in the path tree are V-type nodes (related to path nodes), and the even-numbered nodes are K-type nodes (related to task nodes); and the leaf nodes are all K-type nodes.
[0051] It should be noted that, in this preferred embodiment, the K-type node only represents the last task node unloaded on the corresponding V-type node, which is beneficial to saving storage resources.
[0052] In some optional embodiments, each of the ants starts from a source path node, searches for a path to a destination path node, and offloads the task to the path node reached by the corresponding ant based on the task chain information, including:
[0053] According to the directed weighted graph and the task set, each ant starts from the source path node, obtains the reachable neighboring nodes of the current node, and randomly selects the next node from the reachable neighboring nodes using the roulette method; wherein,
[0054] When the node is a path node, the remaining r task nodes to be unloaded are determined according to the task set, and the situation where the task node is not unloaded and the remaining r task nodes to be unloaded are collectively used as the reachable neighbor nodes, that is, there are r+1 reachable neighbor nodes; when the node is a task node, the remaining accessible path nodes are determined according to the directed weighted graph, and the remaining accessible path nodes are used as the reachable neighbor nodes;
[0055] According to the roulette result, the ant is transferred to the next node to determine whether all task nodes in the task set have been unloaded and whether the previous node of the current node is the destination path node:
[0056] (1) If all task nodes have been uninstalled and the previous node of the current node is the destination path node, then record the current deployment plan;
[0057] (2) If all task nodes have been unloaded, but the previous node of the current node is not the destination path node, the ant is instructed to continue searching for the path until the ant transfers to the destination path node, and the corresponding deployment plan is recorded;
[0058] (3) If the previous node of the current node is the destination path node, but there is a task node to be unloaded, the ant is ordered to start again from the source path node;
[0059] (4) If the previous node of the current node is not the destination path node and there is a task to be offloaded, the ant is instructed to continue searching for a deployment solution.
[0060] For example, assume that the ant has completed the selection of the next path node. There are currently two task nodes k1 and k2 to be unloaded and the corresponding deployment plans are valid deployment plans. At this time, the ant has the following choices:
[0061] (1) Do not uninstall the task node on this path node,
[0062] (2) Unload task node k1 to the path node. At this time, k1 is the last task node to be unloaded. Then, after the V-type node associated with the corresponding path node on the path tree, a K-type node is recorded and associated with task node k1.
[0063] (3) Unload task nodes k1 and k2 to the path node. At this time, k2 is the last task node to be unloaded. Then, after the V-type node associated with the corresponding path node on the path tree, a K-type node is recorded and associated with task node k2.
[0064] It can be understood that ants use a roulette method to randomly select and deploy 0 to 2 task nodes and deploy them to the path node in sequence.
[0065] Those skilled in the art should understand that an effective deployment solution should satisfy the following requirements: the selected path node set p = {p1, p2…, p L}; where p i ∈V, p1 is the source path node s, p L is the destination path node, for All satisfy p i ≠p j ;p i,k Indicates p i Whether the task node is uninstalled, that is, when p i,k =1 means yes, when p i,k =0 means no; That is, a task can only be deployed to one path node; Indicates the last deployment on p i The task above, if p i If the task is not deployed, is 0, That is, the deployment of all tasks must be completed.
[0066] Furthermore, when the roulette wheel method is used to randomly select the next node from the reachable neighboring nodes, the roulette wheel probability is Where, τ i,j represents the pheromone from node i to node j; π0 is the excess, which is used to increase the probability of visiting unvisited nodes and avoid falling into local optimality; S i represents the set of reachable neighboring nodes of the ant at node i.
[0067] Furthermore, updating the local pheromone and the path tree according to the deployment plan includes:
[0068] Obtain the recorded deployment plan and perform local pheromone update, the expression of which is:
[0069] τ i ' ,j =τ i,j +γ
[0070] Where, τ i,j represents the pheromone from node i to child node j before the update; τ i ' ,j represents the corresponding pheromone after update; γ is the excess, which represents the reward value for the effective deployment plan;
[0071] The path tree is updated according to the deployment plan and the updated pheromone.
[0072] In some preferred embodiments, selecting the optimal deployment solution in the current iteration and updating the path tree includes:
[0073] Calculating the cumulative time consumption of the deployment plans recorded on the path tree, and selecting the deployment plan with the shortest cumulative time consumption as the optimal deployment plan in the current iteration;
[0074] Based on the optimal deployment solution in the current iteration, the pheromones on the path tree are globally updated.
[0075] In some optional embodiments, the node information includes the path node p i Computing resources C pi >0, the path node p i To the path node p j Data transfer rate
[0076] The task chain information includes the input data volume k associated with task node k in , output data volume k out and the required computing resources k c ; Among them, the output data volume associated with the current task node is the input data volume k associated with the next task node in ,Right now
[0077] The calculation formula for the cumulative time consumption is as follows:
[0078]
[0079] in, Represents the path node p i Next path node p i+1 The amount of data transferred, Represents node p i to p i+1 The data transfer rate, It represents the total communication time. Indicates running on path node p i The total amount of computing resources for the K tasks on Indicates the computation time of all path nodes.
[0080] In some examples, for a task set k={k1, k2, ..., k K}, the task chain information also includes the amount of computing resources required by k The amount of input data for k is The output data volume is in That is, the input of the next task is the output of the current task.
[0081] In some optional embodiments, pheromones are globally updated according to the following formula:
[0082]
[0083] Where, τ i,j represents the pheromone on the path from node i to child node j on the path tree; ρ represents the global pheromone volatility rate; σ is the reward update coefficient of the optimal deployment plan; Represents τ i,j Whether it is a segment of the optimal deployment plan in the current iteration, if so, it is 1, otherwise it is 0.
[0084] In a specific implementation process,
[0085] S1. The directed weighted graph G(V, E) obtained after the network abstraction of the edge network is as follows: Figure 2 As shown; where V={v1,v2,...,v 12} is the set of path nodes, E={<v1,v3> ,<v1,v4> ,<v2,v1> ,<v2,v4> ,<v3,v5> ,<v3,v7> ,<v4,v5> ,<v4,v6> ,<v4,v7> ,<v5,v9> ,<v6,v2> ,<v6,v9> ,<v7,v8> ,<v7,v9> ,<v8,v3> ,<v9,v8>} is the set of directed edges (network links); the computing resources of each path node are C = {24, 16, 38, 32, 12, 36, 42, 16, 22}, and the transmission rate of the directed edges is B = {3, 5, 4, 6, 2, 4, 1, 2, 6, 3, 1, 2, 2, 1, 3, 3};
[0086] The task set K = {k1, k2, v3} needs to be deployed, and the input values of each task node are: k in ={26,18,12}, the amount of computing resources required for each task node is: k c ={38,24,16}, the output data volume of each task node is: k out ={18,12,24}, source path node s = v2, destination path node d = v7;
[0087] S2. Initialize ants, set the number of ants ANT_NUM to 18, set the number of iterations ITER_NUM to 20, and initialize a path tree with only the root node v2;
[0088] S3, start iteration, in each iteration, according to the amount of pheromone on the path tree (if there is no record on the path tree, the pheromone set during initialization), each ant selects the function with a probability of π0=3 To search for a feasible deployment solution, the steps for ants to find an effective deployment solution are as follows:
[0089] a. Ants randomly select tasks 0 to r based on the pheromone generation probability of the corresponding path on the path tree, using a roulette wheel approach, and deploy them to the current node in sequence, where r is the total number of tasks to be deployed. If all tasks are deployed or the current node is the destination node, proceed to step c.
[0090] b. Obtain the reachable neighboring nodes of the ant's node, and randomly select a node as the next node based on the pheromone generation probability of the corresponding path on the path tree, using a roulette wheel approach, and execute step a.
[0091] c. If the currently found deployment plan is a feasible deployment plan, then output the plan; otherwise, find a new path from the source path node;
[0092] As shown in the path tree, after completing a deployment plan search, the path nodes and task nodes related to the deployment plan will be added to the path tree. The nodes of the path tree are divided into V-type nodes and K-type nodes. The V-type node represents the node in the calculation path, and the K-type node represents the last task deployed on the V-type node. The root node is a V-type node, which is used to deploy the source node s. All leaf nodes are K-type nodes. The value range of the K-type node is {nil}∪k, where nil means no task is deployed and k is the task set. The lines of the path tree contain pheromones. The odd-numbered nodes of the path tree are V-nodes, and the even-numbered nodes are K-type nodes.
[0093] Set the excess γ = 10, according to the formula τ i,j =τ i,j +γ updates the local pheromone of the deployment plan found by each ant;
[0094] According to the cumulative time calculation formula By obtaining the cumulative time taken for each ant to find the path in the first iteration, we can conclude that Ant4's deployment plan is the optimal deployment plan in this iteration, with a cost of 8.2.
[0095] S5. Set the pheromone volatility rate ρ to 0.9, the optimal path reward coefficient σ to 10, and follow the global pheromone update method. Update the pheromones on the entire path tree. In the first iteration of this example, the best deployment plan is Ant4's deployment plan;
[0096] S6. After 20 iterations, the best path of the last iteration is returned as the result.
[0097] Example 2
[0098] This embodiment proposes a dynamic calculation path optimization system based on ant colony algorithm, applying the method described in Example 1, refer to Figure 4 ,include:
[0099] A directed graph construction module is used to obtain node information and task chain information about path nodes in the network and construct a directed weighted graph; wherein the directed weighted graph is configured with a source path node and a destination path node;
[0100] Path search module, used to configure the ant colony algorithm for iterative search;
[0101] The storage module is used to store the path tree and output the optimal deployment plan as a dynamic calculation path after the iteration is completed.
[0102] In each iteration:
[0103] Using the directed weighted graph, each ant starts from a source path node, searches for a path to a destination path node, and offloads tasks to the path node reached by the corresponding ant based on the task chain information, and records effective deployment plans; updates local pheromones and a path tree based on the deployment plans; selects the optimal deployment plan in the current iteration, and updates the path tree until the iteration ends.
[0104] It can be understood that the system of this embodiment corresponds to the method of the above-mentioned embodiment 1, and the options in the above-mentioned embodiment 1 are also applicable to this embodiment, so they will not be described again here.
[0105] Example 3
[0106] This embodiment proposes a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set, or instruction set. The at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor, so that the processor performs some or all of the steps of the method described in Example 1.
[0107] It is understood that the storage medium may be transient or non-transient. Exemplarily, the storage medium includes, but is not limited to, a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, among other media capable of storing program code.
[0108] Exemplarily, the processor may be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA).
[0109] In some examples, a computer program product is provided, which can be implemented in hardware, software, or a combination thereof. As a non-limiting example, the computer program product can be embodied as the storage medium, or as a software product, such as an SDK (Software Development Kit).
[0110] In some examples, a computer program is provided, comprising a computer-readable code. When the computer-readable code is run in a computer device, a processor in the computer device executes the code to implement part or all of the steps in the method.
[0111] This embodiment also proposes an electronic device, including a memory and a processor, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and when the processor executes the at least one instruction, at least one program, code set or instruction set, it implements part or all of the steps of the method described in Example 1.
[0112] In some examples, a hardware entity of the electronic device is provided, including: a processor, a memory and a communication interface; wherein the processor generally controls the overall operation of the electronic device; the communication interface is used to enable the electronic device to communicate with other terminals or servers through a network; the memory is configured to store instructions and applications executable by the processor, and can also cache data to be processed or processed by the processor and various modules in the electronic device (including but not limited to image data, audio data, voice communication data and video communication data), which can be implemented through flash memory (FLASH) or random access memory (RAM).
[0113] Furthermore, data may be transmitted between the processor, the communication interface and the memory via a bus, which may include any number of interconnected buses and bridges, connecting various circuits of one or more processors and memories.
[0114] It can be understood that the options in the above embodiment 1 are also applicable to this embodiment, so they will not be described again here.
[0115] The terms used in the drawings to describe positional relationships are for illustrative purposes only and should not be construed as limiting this patent;
[0116] Obviously, the above-described embodiments of the present invention are merely examples for the purpose of clarifying the present invention and are not intended to limit the implementation of the present invention. It should be understood that, in the various embodiments disclosed herein, the order of the sequence numbers of the steps / processes described above does not imply a sequence of execution. The execution order of the steps / processes is determined by their functions and inherent logic and does not constitute any limitation on the implementation of the embodiments. It should also be understood that the system / device embodiments described above are merely illustrative. For example, the division of units described is merely a logical functional division. In actual implementation, other divisions may be employed, such as combining multiple units or components or integrating them into another system, or omitting or disabling certain features. Furthermore, the coupling, direct coupling, or communication connection between the various components may be through interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other. Those skilled in the art will readily appreciate that other variations or modifications based on the above description are possible. It is not necessary and impossible to enumerate all implementations here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the claims.
Claims
1. A dynamic calculation path optimization method based on ant colony algorithm, characterized in that: include: Obtaining node information and task chain information about path nodes in the network and constructing a directed weighted graph; wherein the directed weighted graph is configured with a source path node and a destination path node; Initialize ants, path trees and pheromones used to store deployment plans; Iterative search is performed based on the ant colony algorithm. During each iteration: Using the directed weighted graph, each ant starts from a source path node, searches for a path to a destination path node, and offloads tasks to the path node reached by the corresponding ant based on the task chain information, and records effective deployment plans; updates local pheromones and the path tree based on the deployment plans; selects the optimal deployment plan in the current iteration, and updates the path tree until the iteration ends; After the iteration is completed, the optimal deployment solution is output according to the path tree as the dynamic calculation path; The selecting the optimal deployment solution in the current iteration and updating the path tree includes: Calculating the cumulative time consumption of the deployment plans recorded on the path tree, and selecting the deployment plan with the shortest cumulative time consumption as the optimal deployment plan in the current iteration; Based on the optimal deployment plan in the current iteration, globally update the pheromones on the path tree; And, the node information includes path node p i Computing resources Path node p i To path node p j Data transfer rate The task chain information includes the input data volume k associated with the task node in , output data volume k out and the required computing resources k c ; Among them, the output data volume associated with the current task node is the input data volume k associated with the next task node in ,Right now The calculation formula for the cumulative time consumption is as follows: in, Represents the path node p i Next path node p i+1 The amount of data output, Represents node p i to p i+1 The data transfer rate, It represents the total communication time. Indicates running on path node p i The total amount of computing resources for the K tasks on Indicates the computation time of all path nodes.
2. The method for dynamic calculation path optimization based on ant colony algorithm according to claim 1, characterized in that: The task chain information includes a task set k={k1, k2, ..., k K }, represents K task nodes; The process of initializing the path tree includes: Initialize a tree with only a root node as the path tree; Two types of node attributes, V-type nodes and O-type nodes, are configured for the path tree; wherein the V-type node is used to represent a path node in a dynamically calculated path, and the O-type node is used to represent the last task node unloaded on the corresponding V-type node, and its value range is {nil}∪k, where nil indicates that no task is unloaded on the corresponding V-type node, and k is a task set; the V-type nodes and the O-type nodes are alternately connected by lines, and the lines are used to configure pheromones between the nodes; The source path node is associated with the root node of the path tree and configured as a V-shaped node.
3. The method for dynamic calculation path optimization based on ant colony algorithm according to claim 2, characterized in that: Each of the ants starts from a source path node, searches for a path to a destination path node, and unloads the task to the path node reached by the corresponding ant based on the task chain information, including: According to the directed weighted graph and the task set, each ant starts from the source path node, obtains the reachable neighboring nodes of the current node, and randomly selects the next node from the reachable neighboring nodes using the roulette method; wherein, When the node is a path node, the remaining r task nodes to be unloaded are determined according to the task set, and the situation where the task node is not unloaded and the remaining r task nodes to be unloaded are collectively used as the reachable neighbor nodes, that is, there are r+1 reachable neighbor nodes; when the node is a task node, the remaining accessible path nodes are determined according to the directed weighted graph, and the remaining accessible path nodes are used as the reachable neighbor nodes; According to the roulette result, the ant is transferred to the next node to determine whether all task nodes in the task set have been unloaded and whether the previous node of the current node is the destination path node: (1) If all task nodes have been uninstalled and the previous node of the current node is the destination path node, then record the current deployment plan; (2) If all task nodes have been unloaded, but the previous node of the current node is not the destination path node, the ant is instructed to continue searching for the path until the ant transfers to the destination path node, and the corresponding deployment plan is recorded; (3) If the previous node of the current node is the destination path node, but there is a task node to be unloaded, the ant is ordered to start again from the source path node; (4) If the previous node of the current node is not the destination path node and there is a task to be offloaded, the ant is instructed to continue searching for a deployment solution.
4. The method for dynamic calculation path optimization based on ant colony algorithm according to claim 3, characterized in that: When the roulette wheel method is used to randomly select the next node from the reachable neighboring nodes, the roulette wheel probability is Where, τ i,j represents the pheromone from node i to node j; π0 is the excess, which is used to increase the probability of visiting unvisited nodes and avoid falling into local optimality; S i represents the set of reachable neighboring nodes of the ant at node i.
5. The method for dynamic calculation path optimization based on ant colony algorithm according to claim 3, characterized in that: The updating of the local pheromone and the path tree according to the deployment plan includes: Obtain the recorded deployment plan and perform local pheromone update, the expression of which is: the i,j =t i,j +g Where, τ i,j represents the pheromone from node i to node j; τ′ i,j represents the corresponding pheromone after update; γ is the excess, which represents the reward value for the effective deployment plan; The path tree is updated according to the deployment plan and the updated pheromone.
6. The method for dynamic calculation path optimization based on ant colony algorithm according to claim 2, characterized in that: The pheromone is globally updated according to the following formula: Where, τ i,j represents the pheromone on the path from node i to node j; ρ represents the global pheromone volatility rate; σ is the reward update coefficient of the optimal deployment plan; Represents τ i,j Whether it is a segment of the optimal deployment plan in the current iteration, if so, it is 1, otherwise it is 0.
7. A dynamic calculation path optimization system based on ant colony algorithm, applying the method according to any one of claims 1 to 6, characterized in that: include: A directed graph construction module is used to obtain node information and task chain information about path nodes in the network and construct a directed weighted graph; wherein the directed weighted graph is configured with a source path node and a destination path node; Path search module, used to configure the ant colony algorithm for iterative search; The storage module is used to store the path tree and output the optimal deployment plan as a dynamic calculation path after the iteration is completed. In each iteration: Using the directed weighted graph, each ant starts from a source path node, searches for a path to a destination path node, and offloads tasks to the path node reached by the corresponding ant based on the task chain information, and records effective deployment plans; updates local pheromones and a path tree based on the deployment plans; selects the optimal deployment plan in the current iteration, and updates the path tree until the iteration ends.
8. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Ant colony algorithm optimization method based on initial distribution and dynamic update of pheromones
CN113009821A
Unmanned aerial vehicle cluster task resource scheduling method based on flow network model
CN116860002A