Resource allocation method in task unloading
By using an improved binary whale and particle swarm hybrid algorithm, dynamically adjusting particle search behavior and setting differentiated inertia weights, the problem of uneven resource allocation in MEC systems is solved, achieving efficient task offloading decisions and maximizing system utility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-04-14
AI Technical Summary
Existing task offloading algorithms in MEC systems fail to effectively balance communication link stability, targeted resource allocation, and energy consumption control, leading to resource allocation imbalance and increased algorithm time overhead.
An improved binary whale and particle swarm hybrid algorithm is adopted. By dynamically adjusting the search behavior of particles and combining a differentiated inertial weight strategy, channel resources, computing resources and power consumption control are optimized to achieve dynamic balance in task offloading decision.
It effectively reduces the time overhead during task unloading, improves the value of the system utility function, and ensures the rationality and efficiency of resource allocation.
Smart Images

Figure CN121865342A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network and communication technology, specifically a resource allocation method in task unloading. Background Technology
[0002] With the widespread adoption of 5G technology, mobile terminals are undertaking a large number of data processing tasks. However, due to computing power limitations, mobile terminals struggle to handle computationally intensive tasks independently. To address this, researchers have proposed task offloading. Through wireless communication, the terminal device migrates its computing tasks to a roadside server, which then returns the results to the mobile terminal. This working mode is called mobile edge computing (MEC), and its system consists of small base stations (SBS) connected to the roadside server and user equipment (UE). Task offloading not only reduces the computational load on terminal devices and extends battery life but also leverages the computing power of roadside edge nodes to achieve low-latency task processing. Therefore, research on task offloading is of great significance for improving the response speed of mobile applications, reducing overall energy consumption, and enhancing network resource utilization.
[0003] However, task offloading in MEC also faces some challenges. First, due to the limited communication coverage of SBS and the uncertainty of UE movement, the network connection status in the MEC system frequently switches, leading to a decrease in the stability of the communication link between SBS and UE, affecting task transmission. Second, the computational tasks of each UE vary in size, and the uplink and downlink channel resource requirements change dynamically. Task offloading must consider computational and bandwidth resources; otherwise, it can easily lead to resource contention and conflicts. Therefore, the task offloading algorithm must consider both the user equipment's movement speed and location changes, as well as the base station's computational resources, communication bandwidth, and energy consumption constraints; otherwise, problems such as increased algorithm time overhead and resource allocation imbalance may occur. Therefore, for the joint optimization of sub-channel resource allocation, computational resource allocation, and power consumption control, task offloading decision-making (when and how to offload) has become a research focus in MEC.
[0004] To address the aforementioned challenges of task offloading in a MEC environment, existing research has mainly focused on the following aspects.
[0005] The paper "Multi-User Offloading for Edge Computing Networks: ADependency-Aware and Latency-Optimal Approach" (IEEE Internet of Things Journal, 2019) proposes a Distributed Earliest Finish-time Offloading (DEFO) algorithm. First, it divides the task into subtasks and prioritizes them based on execution time and communication cost. Second, it models and analyzes the dependencies between subtasks, the relationship between transmission and computation latency, and multi-user resource contention. Third, it allocates the subtasks to local or edge servers through centralized or distributed decision-making. Experiments show that this algorithm effectively reduces the average task latency and improves the resource utilization of edge servers.
[0006] The paper "Joint Task Offloading and Radio Resource Management in Stochastic MEC Systems" (IEEE Transactions on Communications, 2024) proposes a hybrid offloading algorithm based on Binary Whale Optimization (BWOA) and Particle Swarm Optimization (PSO). First, the SBS channel is divided into multiple orthogonal sub-channels, and a unified channel model is used to handle uplink and downlink transmissions. Second, task offloading is modeled as a multi-objective optimization problem involving sub-channel allocation, power control, and computational resource allocation. Finally, the hybrid BWOA and PSO algorithm is used to solve this optimization problem. Experiments show that the algorithm effectively reduces task latency and improves system efficiency.
[0007] However, the aforementioned studies also have some problems. The DEFO algorithm in the paper "Multi-User Offloading for EdgeComputing Networks: A Dependency-Aware and Latency-Optimal Approach" designs subtask splitting and priority ranking mechanisms, but fails to consider uplink and downlink factors, resulting in a lack of targeted resource allocation. The particle swarm optimization algorithm in the paper "Joint Task Offloading and Radio Resource Management in Stochastic MECSystems" uses a single exponential decay method for its dynamic weight strategy, which cannot adapt to the different search requirements of complex optimization problems. Due to the difficulty in balancing the dynamic requirements of global search and local development, this algorithm is prone to getting trapped in local optima in the later stages of iteration, leading to a decrease in convergence speed and an increase in algorithm time.
[0008] To address the shortcomings of the paper "Joint Task Offloading and Radio Resource Management in Stochastic MEC Systems," this invention proposes an improved hybrid binary whale and particle swarm optimization algorithm to solve the resource allocation problem during task offloading. First, a particle classification mechanism is designed; second, differentiated inertia weight update strategies are formulated for different particle types. The algorithm dynamically adjusts the particle search behavior accordingly, maintaining strong global exploration capabilities in the early stages of iteration and enhancing local exploration capabilities in the later stages, thus avoiding getting trapped in local optima and effectively shortening the algorithm's running time. Summary of the Invention
[0009] This invention provides a resource allocation method for task unloading, solving the technical problem of time-consuming joint optimization of channel resources, computing resources, and power consumption control during task unloading. The allocation method of this invention can dynamically adjust the search behavior based on the real-time performance of particles, dynamically balancing the exploration and development of the resource allocation problem. The solution reduces the time overhead of program computation while maintaining a high objective utility function value.
[0010] To achieve the aforementioned objectives, the present invention employs the following technical solution: a resource allocation method during task unloading, comprising the following steps:
[0011] S1: Task Unloading Problem Modeling
[0012] Based on the definitions of task unloading latency and energy consumption, a mathematical model for multi-objective optimization of task unloading latency and energy consumption is derived.
[0013] S2: Implementation of the unloading decision
[0014] The Binary Whale Optimization Algorithm (BWOA) is used to make offloading decisions. The input to the BWOA algorithm includes the number of user devices N. ul Sub-channel k and utility function Among them, utility function The problem aims to maximize both latency and energy consumption.
[0015] The first stage involves initialization and binary encoding. First, an initial decision matrix regarding "whether to unload" is randomly generated. Then, each element in the matrix is represented using binary encoding, with 0 representing no unloading and 1 representing unloading. The encoding must follow the rule that "each user occupies at most one sub-channel" to ensure "orthogonal allocation of sub-channels."
[0016] The second stage involves iterative search and position update. First, for each search agent, the utility function is calculated. Simulating whale foraging behavior, the algorithm generates continuous position updates through exploration (random search), development (refined search around the optimal solution), and a spiral update mechanism. Next, the continuous step size is converted into binary flip probabilities using a sigmoid function. Then, the unloading decision is dynamically adjusted. If a user's utility function increases after unloading, the algorithm will retain the "1" state (i.e., unload) through a probabilistic mechanism; otherwise, it will flip to "0" (i.e., do not unload) through a probabilistic mechanism, thus achieving dynamic task unloading decisions.
[0017] In the third stage, when the convergence condition is met, the output optimal binary matrix is directly mapped to an executable offloading scheme. The base station allocates computing resources and sub-channels based on this matrix, achieving the goal of "joint task offloading and resource management".
[0018] S3: Resource Allocation Algorithm Design and Implementation
[0019] S31: Initialize the particle swarm
[0020] S32: Assess fitness
[0021] S33: Determine the particle's position based on its current fitness.
[0022] S34: Update individual optimal position
[0023] S35: Update global optimal position
[0024] S36: Set differentiated inertial weights for different particles.
[0025] S37: Iteration
[0026] S38: Output Results
[0027] The task unloading problem modeling in step S1 includes the following steps:
[0028] S11, Task Latency Modeling
[0029] In an MEC system, computation tasks can be executed in two ways. First, the computation task can be completed locally on the UE. Second, the computation task can be offloaded to a nearby server (edge node) via the uplink. Define variables. As a task unloading decision. When When, it represents user equipment n unloading tasks to edge node m via sub-channel k. When the condition is met, it means that the computing task of user device n is executed locally (i.e., without being unloaded).
[0030] S111, User Equipment End
[0031] Define the computational load C carried by user equipment n. n With local CPU processing power When the UE's task is completed locally, the computation time for the user equipment n to process the task locally. for
[0032]
[0033] S112, Edge Node End
[0034] ① Uplink task transmission time modeling
[0035] According to Shannon's formula, the transmission rate R of user equipment n offloading tasks to edge node m on sub-channel k is... n,k,m Written as
[0036] R n,k,m =B k log2(1+γ n,k,m (6)
[0037] Among them, B k γ is the bandwidth of subchannel k. n,k,m The signal-to-interference-plus-noise ratio (SINR) of subchannel k between user equipment n and edge node m is given by reference to "Joint Task Offloading and Radio Resource Management in Stochastic MEC Systems" (IEEE Transactions on Communications, 2024).
[0038] User equipment n's task data volume D n The transmission rate R of user equipment n to edge node m on sub-channel kn,k,m And the decision of user equipment n to offload tasks to edge node m through sub-channel k. m ul κ represents the number of edge nodes and the number of sub-channels. When user equipment n unloads a task to edge node m, the task transmission time... Can be written as
[0039]
[0040] ② Modeling the computation time of tasks at edge nodes
[0041] The computing resources F allocated to user device n based on edge node m nm And whether user equipment n uploads tasks to edge node m through sub-channel k. When edge node m processes the task offloaded by user device n, the task computation time of the edge node is... for
[0042]
[0043] According to formulas (3) and (4), the total time required for the edge node to complete the task is... Written as
[0044]
[0045] S113, Obtain the task latency model
[0046] Depending on the different locations where the two tasks are executed (user device and edge node), the task latency T n The expression is
[0047]
[0048] S12, Energy Consumption Modeling
[0049] S121, User Equipment End
[0050] For MEC systems, when a user device's task is completed locally, its energy consumption is only the local CPU energy consumption. The energy consumption of user device n... for
[0051]
[0052] Among them κ n It is the energy coefficient related to the UE chip architecture.
[0053] S122, Edge Node End
[0054] ① Uplink transmission energy consumption modeling
[0055] Define the transmit power p of user equipment n n and power amplifier efficiency ξ n The energy consumption required for user equipment n to transmit tasks Can be written as
[0056]
[0057] ② Modeling the computational energy consumption at edge nodes
[0058] Computational energy consumption at edge nodes It equals the energy consumed during the mission transmission process, specifically expressed as follows:
[0059]
[0060] S123, Obtain the total energy consumption model
[0061] Depending on the different locations where the above two tasks are executed (user device and edge node), the total energy consumption E n The expression is
[0062]
[0063] S13, Optimize target modeling
[0064] Considering latency and energy consumption are two core metrics for mobile user equipment (MUE), we define the utility function of MUE n. The formula is
[0065]
[0066] in Time preference coefficient ( Set to 0.5), Energy consumption preference coefficient ( Set to 0.5).
[0067] To achieve maximum utility, the dual-objective optimization problem of latency and energy consumption can be expressed as:
[0068]
[0069] S14, Constraints
[0070] S141, Sub-channel constraints
[0071] When a UE offloads a task to a SBS, it needs to occupy a subchannel. In the uplink scenario, assume that a UE uses at most one subchannel k to offload a task, and let N be the number of subchannels. ul It is the number of user devices, therefore there are
[0072]
[0073] The above sub-channel constraints illustrate that the number of idle sub-channels a given SBS possesses determines the number of offloading tasks it can access.
[0074] S142, Computational Power Constraints
[0075] Since there is an upper limit to the total computing power of a single server, the total computing power that the m-th server can accept for tasks must conform to the following expression.
[0076]
[0077] in This represents the maximum computing power of the m-th server.
[0078] The above computing power constraints state that the total computing power allocated to each user equipment (UE) cannot exceed the server's maximum computing power.
[0079] S143, Power Constraint
[0080] User equipment n has an upper limit on its maximum transmit power, therefore its transmit power p n The following constraints must be met.
[0081]
[0082] in This represents the UE's maximum transmit power.
[0083] The power constraints mentioned above mean that the power of each user equipment cannot exceed its own maximum transmit power.
[0084] The implementation of the unloading decision in step S2 includes the following steps:
[0085] Due to limited subchannel bandwidth, energy consumption, and computational resources, randomly determined task offloading decisions may lead to a mismatch between resources and task requirements, resulting in a decline in application service quality. While using a traversal method to determine task offloading decisions can find the optimal offloading strategy, in mobile scenarios, UEs typically move frequently, making it difficult for traversal methods to provide the optimal offloading decision in a timely manner, thus reducing the timeliness of task completion. Therefore, it is necessary to comprehensively consider channel resources, energy consumption, and computational resources, and propose an intelligent optimization algorithm to solve for the optimal task offloading decision.
[0086] To obtain the optimal task offloading decision, this invention selects the Binary Whale Algorithm (BWOA). BWOA can efficiently solve the "whether to offload" problem. Based on channel resources, energy consumption, and computational resource constraints, it allocates sub-channels and computing resources through task offloading decisions to maximize the system utility function (the dual objective of delay and energy consumption).
[0087] Specifically, the BWOA algorithm searches for the optimal offloading decision by calculating latency and energy consumption. If the local execution latency and energy consumption performance of the task are higher than those of the edge node execution, a decision of "1" (i.e., offloading) is determined. If the local execution latency and energy consumption performance are lower than those of the edge node execution, a decision of "0" (i.e., no offloading) is determined. By simulating the exploration and exploitation behavior of whales hunting, the BWOA algorithm can filter out reasonable offloading schemes from a massive number of offloading possibilities and obtain an offloading decision matrix. The core process of the algorithm is divided into three stages: initialization and binary encoding, iterative search and position update, and convergence and decoding. Since the BWOA algorithm is not the focus of this invention, its algorithm steps are briefly described below.
[0088] The input to BWOA includes the number of user devices N. ul Sub-channel k and utility function Among them, utility function The problem aims to maximize both latency and energy consumption.
[0089] The first stage involves initialization and binary encoding. First, an initial decision matrix regarding "whether to unload" is randomly generated. Then, each element in the matrix is represented using binary encoding, with 0 representing no unloading and 1 representing unloading. The encoding must follow the rule that "each user occupies at most one sub-channel" to ensure "orthogonal allocation of sub-channels."
[0090] The second stage involves iterative search and position update. First, for each search agent, the utility function is calculated. Simulating whale foraging behavior, the algorithm generates continuous position updates through exploration (random search), development (refined search around the optimal solution), and a spiral update mechanism. Next, the continuous step size is converted into binary flip probabilities using a sigmoid function. Then, the unloading decision is dynamically adjusted. If a user's utility function increases after unloading, the algorithm will retain the "1" state (i.e., unload) through a probabilistic mechanism; otherwise, it will flip to "0" (i.e., do not unload) through a probabilistic mechanism, thus achieving dynamic task unloading decisions.
[0091] In the third stage, when the convergence condition is met, the output optimal binary matrix is directly mapped to an executable offloading scheme. The base station allocates computing resources and sub-channels based on this matrix, achieving the goal of "joint task offloading and resource management".
[0092] Step S3 includes the following steps:
[0093] Once the task offloading decision is determined (the first round of offloading decisions is randomly generated during program initialization), subchannel bandwidth resources, energy consumption, and computing resources need to be dynamically allocated based on the offloading decision. The rationality of the above resource allocation directly affects the algorithm's own time overhead, task latency, and energy consumption. The resource allocation requirements of this invention must meet the following two points: First, ensure that the utility function is maximized; second, ensure that the channel and computing resources of the MEC edge node are sufficient to support the task requirements it is allocated.
[0094] To solve the aforementioned resource allocation problem, this invention proposes an improved Particle Swarm Optimization (PSO) algorithm. The core idea of PSO is to simulate the cooperative behavior among individuals in a flock of birds in order to find the optimal solution or a near-optimal solution. Candidate solutions in PSO are represented as individuals (particles) in the swarm. Each particle has a position and velocity, and they communicate and cooperate to find the optimal solution. The basic idea of PSO is to guide the search space through information sharing and cooperation among individuals. Each particle adjusts its position and velocity based on its own experience and that of its neighbors; this cooperative behavior moves the entire swarm towards the potential optimal solution, ultimately leading to the global optimum. However, traditional PSO algorithms employ a single inertial weight decay strategy, which easily leads to an imbalance in search efficiency among particles with different performance levels. Particles close to the optimal solution are prone to losing their local exploitation ability due to premature weight decay, while particles far from the optimal solution struggle to escape local optima due to insufficient weight. Therefore, traditional PSO suffers from the problem of failing to balance global exploration and local exploitation. Thus, the objective function f is... This invention proposes an improved PSO algorithm, the specific steps of which are described below.
[0095] S31: Initialize the particle swarm
[0096] ① Determine the number of particles N
[0097] Suppose there are N particles in a D-dimensional search space, each particle representing a solution.
[0098] ② Initialize particle positions
[0099] Generate an initial position X for each particle i i =(x i1 ,x i2 ,…,x iD The location represents a potential solution.
[0100] ③ Initialize particle velocity
[0101] Generate an initial velocity V for each particle i i =(v i1 ,v i2 ,…,v iDInitially, the velocity is set to a zero vector. The velocity is limited to the range [-VelMax, VelMax] to prevent particles from flying too far out of the search space.
[0102] ④ Initialize the optimal position of the individual
[0103] Set the initial position of each particle i to its individual historical best position Pbest. i =X i .
[0104] ⑤ Initialize the global optimal position
[0105] Evaluate the objective function value corresponding to the initial position of all particles, find the particle with the smallest objective function value, and set its position as the global historical best position Gbest for the entire swarm.
[0106] S32: Assess fitness
[0107] For each particle, calculate its fitness value (i.e., the objective function f) based on its position. The fitness value is the objective function at position X. i The value of is the performance metric for the problem to be optimized. This step is used to determine the performance of the particle in the search space.
[0108] The position of each particle is a potential solution, X i Substituting the objective function f, we can obtain its fitness f(X). i ).
[0109] S33: Determine the particle's position based on its current fitness.
[0110] Traditional PSO uses an exponentially decreasing inertial weight for velocity and position updates for all particles. However, the fitness (i.e., the objective function f-value) of different particles can vary significantly. If all particles are treated the same and the same inertial weight strategy is used, it can easily lead to an imbalance in search efficiency among particles with different performance levels, making it difficult to achieve a balanced exploration and utilization of the objective function. Therefore, this invention classifies particles into three categories based on their fitness: strong particles, moderate particles, and weak particles. Let f be defined. i f is the fitness of the i-th particle. gbest f is the current global optimal fitness. avg ε represents the average fitness of all current particles, and ε is the floating-point comparison tolerance value.
[0111] ① Dominant Particles
[0112] When the current fitness of a particle satisfies (f i ≤f gbestA particle with fitness (i.e., objective function f) less than or equal to the global optimal fitness is defined as a dominant particle, representing a solution that is close to the global optimum. For dominant particles, local optimization is needed to fine-tune the parameters.
[0113] ② Neutral Particle
[0114] When the current fitness of a particle satisfies (f gbest +ε <f i ≤f avg The particle with fitness (i.e., the objective function f-value) is defined as a neutral particle because its fitness (i.e., the objective function f-value) lies between the global optimal fitness and the average fitness. This means that it has the ability to find the global optimal solution, but has not yet reached the optimal solution. For neutral particles, it is necessary to balance global exploration and local development.
[0115] ③ Weak particles
[0116] When the current fitness of a particle satisfies (f i >f avg A particle with fitness (i.e., the objective function f-value) greater than the average fitness is defined as a weak particle, representing a solution far from the optimal solution. For weak particles, global exploration needs to be strengthened to escape local optima.
[0117] S34: Update individual optimal position
[0118] For each particle, update its optimal position based on its current fitness value. If the fitness of the particle's current position is f... i Fitness f less than the individual's historical best position gbest Then f i Assigned the value f gbest .
[0119] S35: Update global optimal position
[0120] Evaluate the objective function value corresponding to the current position of all particles, find the particle with the smallest objective function value, and set its position as the global historical best position Gbest for the entire swarm.
[0121] S36: Set differentiated inertial weights for different particles.
[0122] To efficiently solve resource allocation under different task decisions, this invention designs differentiated inertial weights for three types of particles and adaptively adjusts them to improve the algorithm's convergence speed.
[0123] ① Dominant Particles
[0124] For dominant particles, which represent resource allocation schemes close to the global optimum, an exponentially decaying weight should be employed to enhance local exploitation capabilities. To achieve this goal, this invention designs an intermediate inertial weight coefficient w in the inertial weight expression for dominant particles. mid Then the inertia weight w of the improved PSO algorithm can be written as
[0125]
[0126] Among them, the minimum inertia weight w min =0.4, intermediate inertia weight w max =0.7, decay coefficient λ=13, it is the current iteration number, MaxIt is the maximum iteration number.
[0127] Observing formula (16), it can be found that during the algorithm iteration process, as the position and velocity are continuously updated, the intermediate inertia weight coefficient w designed in this invention... mid This can ensure that the inertial weight of the dominant particle changes from w mid To w min Smooth decay enables the algorithm to gradually converge and achieve local optimization.
[0128] ② Neutral Particle
[0129] For neutral particles, which represent solutions with significant potential but not yet optimal, a polynomial-weighted linearly decreasing weight strategy is designed. The polynomial part helps the particle escape local optima, while the linear part helps the algorithm gradually converge, balancing exploration and development. The formula for the inertia weight w in the improved PSO algorithm is:
[0130]
[0131] Where it / MaxIt represents the linear part, the part within square brackets represents the polynomial part, and ratio represents the relative distance between the particle's fitness and the global optimal fitness (reflecting the difference between the particle and the optimal solution), its calculation formula is:
[0132] The formula (17) designed in this invention focuses on exploration when the ratio increases and on the solution side when the ratio decreases.
[0133] ③ Weak particles
[0134] For weak particles, which correspond to solutions far from the optimal solution, a maximum fixed weight should be used to enhance global exploration capabilities. Therefore, the formula for the inertial weight w in the improved PSO algorithm is:
[0135] w = w max (twenty two)
[0136] Among them, the maximum inertia weight w max =0.9, to ensure that weak particles can quickly escape local optima and encourage such particles to explore new resource allocation schemes.
[0137] This invention utilizes the minimum weight w respectively min With the maximum weight w max Two thresholds. If the calculated weight value is greater than w max Then the weight value is set to w. max If the calculated weight value is less than w min Then the weight value is set to w. min To avoid algorithmic oscillations caused by extreme weights and ensure the stability of task unloading decisions, all inertial weight values in this invention are determined by boundary conditions (w). min ≤w≤w max )limit.
[0138] S37: Iteration
[0139] Repeat steps (S32) to (S36) until the predetermined number of iterations is reached. After each iteration, the particle swarm gradually converges to the vicinity of the optimal solution in the search space.
[0140] S38: Output Results
[0141] The final output is the optimal solution obtained.
[0142] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0143] 1. This invention designs a classification mechanism for strong, neutral, and weak particles to achieve fine-grained particle classification. During algorithm iteration, the classification status of particles can be dynamically updated based on their performance.
[0144] 2. This invention formulates differentiated inertial weight update strategies for the classification of strong particles, neutral particles, and weak particles, so as to achieve a dynamic balance between global exploration and local development.
[0145] 3. When the particle is a strong particle (the current particle's fitness is less than or equal to the global optimal fitness), the algorithm adopts an exponential decay weight strategy, while designing an intermediate inertia weight coefficient w. mid To ensure that the inertial weight of the dominant particle is from the intermediate weight w mid To the minimum weight w minSmooth decay reduces meaningless global exploration and enhances fine-grained local search. When the particle is a moderate particle (its fitness is between the global optimum and the average fitness), a polynomial-weighted linearly decreasing weight strategy is designed based on the relative distance of particle fitness. The polynomial part helps the particle escape local optima, while the linear part helps the algorithm converge gradually. When the particle is a weak particle (its fitness is greater than the average fitness), a maximum fixed weight strategy is adopted, giving the particle a larger inertia weight to enhance its global search ability, prompting the particle to escape local optima and preventing the algorithm from converging too early and causing a decrease in the utility function. Attached Figure Description
[0146] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.
[0147] Figure 1 This is a schematic diagram of the MEC application scenario in this invention.
[0148] Figure 2 This is a schematic diagram illustrating the time overhead growth rate of the method in this invention.
[0149] Figure 3 This is a schematic diagram comparing the user equipment utility function value in this invention with that of the traditional algorithm. Detailed Implementation
[0150] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. Of course, the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0151] Example 1
[0152] Scenes such as Figure 1 As shown in Table 1, the variables involved in the simulation are as follows. Task unloading was performed using both the traditional binary whale and particle swarm optimization algorithm (hereinafter referred to as the "traditional algorithm") and the improved binary whale and particle swarm optimization algorithm (hereinafter referred to as the "improved algorithm"), each running independently 19 times to obtain and compare the time cost performance of the two algorithms.
[0153] Regarding the time cost of the algorithms, the time cost TR is defined as the difference between the program's end time and its start time. To better compare the time costs of the two algorithms, an "algorithm time cost growth rate" metric is defined. This metric is calculated as follows: First, the time cost Tr_gai of the improved algorithm is subtracted from the time cost Tr_chuan of the traditional algorithm to obtain the difference in time costs; then, this difference is divided by the time cost Tr_chuan of the traditional algorithm to obtain the "algorithm time cost growth rate" metric.
[0154] Table 1. Relevant variables for system modeling
[0155]
[0156]
[0157] After 19 simulations, the algorithm's time overhead growth rate was as follows: Figure 2 As shown in the figure, in 19 independently run simulations, the algorithm's time cost growth rate was negative in 13 of them, indicating that the improved algorithm consumed less running time compared to the traditional algorithm; only 6 simulations showed a positive time cost growth rate, indicating that the improved algorithm consumed more running time compared to the traditional algorithm. Observing the specific values, it can be seen that the absolute value of the 13 negative time cost growth rates is relatively large, indicating that compared to the traditional algorithm, the improved algorithm's time cost is significantly reduced in these 13 independent simulations, greatly improving the algorithm's running time. The absolute values of the 6 positive time cost growth rates are all relatively small, indicating that compared to the traditional algorithm, the improved algorithm's time cost increased slightly in these 6 independent simulations, but the positive growth rate is less than 5%. In summary, because the improved algorithm incorporates a three-class particle swarm optimization mechanism, it can more accurately describe the performance of particle problem solving. Furthermore, by setting different inertia weight strategies for different particle swarms, it avoids the "exploration redundancy" or "underdevelopment" problems caused by a single inertia weight strategy, thereby reducing the overall iteration time and achieving better time cost performance. Traditional algorithms treat all particles indiscriminately, applying a single, exponentially decaying weight that continuously decreases throughout the iterations. On one hand, traditional algorithms assign higher weights to all particles in the early stages of iteration (representing strong exploration capabilities), potentially causing particles close to the optimal solution to waste time due to overexploration. On the other hand, they assign lower weights to all particles in the later stages of iteration (representing weaker exploration capabilities), causing particles far from the optimal solution to lose their exploration capabilities. This makes the algorithm prone to stalling at suboptimal solutions, forcing it into ineffective iterations.
[0158] Example 2
[0159] Based on Example 1, the system utility functions of the two algorithms were calculated. Value, such as Figure 3As shown in the figure, the utility function value of the improved algorithm is very close to that of the traditional algorithm, indicating that the improved algorithm also achieves the optimal decision for the task offloading problem, maximizing the coordination of sub-channel, energy consumption, and computational resource allocation. Combined with... Figure 3 and Figure 2 It can be seen that by dynamically classifying the particle swarm and setting different adaptive inertia weight strategies, the improved algorithm not only effectively speeds up the algorithm's running efficiency and shortens the algorithm's running time, but also maintains the quality of solving multi-objective problems.
[0160] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A resource allocation method during task unloading, characterized in that, Includes the following steps: S1: Task Unloading Problem Modeling Based on the definitions of task unloading latency and energy consumption, a mathematical model for multi-objective optimization of task unloading latency and energy consumption is derived. S2: Implementation of the unloading decision The binary whale optimization is used to make the offloading decision, and its input includes the number of user devices N. ul Sub-channel k and utility function Among them, utility function The problem of maximizing both latency and energy consumption is solved. S3: Design and Implementation of Resource Allocation Algorithm Based on Improved Particle Swarm Optimization (PSO) S31: Initialize the particle swarm; S32: Assess fitness; S33: Determine the particle's position based on its current fitness; S34: Update the individual's optimal position; S35: Update the global optimal position; S36: Set differentiated inertial weights for different particles; S37: Iteration; S38: Output results.
2. The resource allocation method in task unloading according to claim 1, characterized in that, The implementation of the S2 unloading decision includes the following stages: The first stage involves initialization and binary encoding, where "1" represents unloading and "0" represents not unloading, i.e., local computation. The second stage involves iterative search and location updates. In the third stage, when the convergence condition is met, the output optimal binary matrix is directly mapped to the unloading scheme.
3. The resource allocation method in task unloading according to claim 1, characterized in that, S1 includes the following steps: S11, Task Latency Modeling Define variables As a task unloading decision, when When, it represents user equipment n unloading tasks to edge node m through sub-channel k. When this occurs, it means that the computing task of user device n is executed locally; S111, User Equipment End Define the computational load C carried by user equipment n. n With local CPU processing power When the user equipment (UE) completes its task locally, the computation time for UE n to process the task locally is... for: S112, Edge Node End S113, Obtain the task latency model; S12, Energy consumption modeling; S121, User Equipment End Energy consumption at the user equipment end n for: Among them κ n It is the energy coefficient related to the UE chip architecture; S122, edge node end; S123, Obtain the total energy consumption model; S13. Optimize target modeling; S14, Constraints.
4. The resource allocation method in task unloading according to claim 1, characterized in that, In step S112, the edge node includes the following steps: S1121. Uplink Task Transmission Time Modeling According to Shannon's formula, the transmission rate R of user equipment n offloading tasks to edge node m on sub-channel k is... n,k,m for R n,k,m =B k log2(1+γ n,k,m ) (3); Among them, B k γ is the bandwidth of subchannel k. n,k,m Let S be the signal-to-interference-plus-noise ratio (SINR) of sub-channel k between user equipment n and edge node m; User equipment n's task data volume D n The transmission rate R of user equipment n to edge node m on sub-channel k n,k,m And the decision of user equipment n to offload tasks to edge node m through sub-channel k. m ul K is the number of edge nodes, and K is the number of sub-channels. When user equipment n unloads a task to edge node m, the task transmission time is... for: S1122, Task computation time modeling at edge nodes Based on the computing resources F allocated to user device n by edge node m nm And whether user equipment n uploads tasks to edge node m through sub-channel k. When edge node m processes the task offloaded by user device n, the task computation time of the edge node is... for: According to formulas (4) and (5), the total time required for the edge node to complete the task is... for:
5. The resource allocation method in task unloading according to claim 1, characterized in that, The task latency model obtained in S113 includes the following: Based on the different locations of the user device and edge node in the two task execution methods described above, the task latency T... n The expression is:
6. The resource allocation method in task unloading according to claim 1, characterized in that, The S122 edge node includes the following steps: S1221. Uplink transmission energy consumption modeling Define the transmit power p of user equipment n n and power amplifier efficiency ξ n The energy consumption required for user equipment n to transmit tasks for: S1222, Computational energy consumption modeling at edge nodes Computational energy consumption at edge nodes It equals the energy consumed during the mission transmission, expressed as: S123, Obtain the total energy consumption model Based on the different locations where the above two tasks are executed, namely user equipment and edge nodes, the total energy consumption E n The expression is S13, Optimize target modeling Define the utility function of user equipment n The formula is: in This is the time preference coefficient. Energy consumption preference coefficient; To achieve maximum utility, the dual-objective optimization of latency and energy consumption is expressed as:
7. The resource allocation method in task unloading according to claim 1, characterized in that, The constraints in S14 include the following steps: S141, Sub-channel constraints Assume a UE uses at most one subchannel k to offload tasks, and let N... ul It refers to the number of user devices. S142, Computational Power Constraints Since there is an upper limit to the total computing power of a single server, the total computing power of the m-th server for handling tasks follows the expression: in This represents the maximum computing power of the m-th server. S143, Power Constraint User equipment n has an upper limit on its maximum transmit power p. n The following constraints must be met: in This represents the UE's maximum transmit power.
8. The resource allocation method in task unloading according to claim 1, characterized in that, S2 includes the following steps: To obtain the optimal task unloading decision, the Binary Whale Algorithm (BWOA) is selected. The BWOA algorithm includes the following steps: The input to the Binary Whale Algorithm (BWOA) includes the number of user devices N. ul Sub-channel k and utility function Among them, utility function The problem of maximizing both latency and energy consumption is solved. The first stage involves initialization and binary encoding, where "1" represents unloading and "0" represents not unloading, i.e., local computation. The second stage involves iterative search and location updates. In the third stage, when the convergence condition is met, the output optimal binary matrix is directly mapped to the unloading scheme.
9. The resource allocation method in task unloading according to claim 1, characterized in that, With the objective function f as Step S3 includes the following steps: S31: Initialize the particle swarm. S311: Determine the number of particles N. Suppose there are N particles in a D-dimensional search space, each particle representing a solution; S312: Initialize particle positions Generate an initial position X for each particle i i =(x i1 ,x i2 ,…,x iD The location represents a potential solution; S313: Initialize particle velocity Generate an initial velocity V for each particle i i =(v i1 ,v i2 ,…,v iD Initially, the velocity is set to zero vector, and the velocity is limited to the range [-VelMax,VelMax] to prevent particles from flying too far away from the search space; S314: Initialize the optimal position of the individual Set the initial position of each particle i to its individual historical best position Pbest. i =X i ; S315: Initialize the global optimal position Evaluate the objective function value corresponding to the initial position of all particles, find the particle with the smallest objective function value, and set its position as the global historical best position Gbest for the entire swarm. S32: Assess fitness For each particle, calculate its fitness value based on its position, which is the objective function f. The fitness value is the objective function at position X. i The value of is used to determine the performance of the particle in the search space; The position of each particle is a potential solution, X i Substituting the objective function f, we obtain its fitness f(X). i ); S33: Determine the particle's position based on its current fitness. Based on differences in particle fitness, they are divided into three categories: dominant particles, neutral particles, and weak particles, and f is defined as follows. i f is the fitness of the i-th particle. gbest f is the current global optimal fitness. avg The average fitness of all current particles is given by ε, where ε is the floating-point comparison tolerance value. S331: Dominant Particle When the current fitness of a particle satisfies f i ≤f gbest If the value is +ε, it is defined as a dominant particle, which means that it is a solution that is close to the global optimum. For dominant particles, local development is strengthened to fine-tune the parameters. S332: Neutral Particle When the current fitness of a particle satisfies f gbest +ε <f i ≤f avg If the value is +ε, it is defined as a neutral particle, which means that it has the ability to solve the global optimal solution. For solutions that do not reach the optimal solution, the neutral particle balances global exploration and local development. S333: Weak Particle When the current fitness of a particle satisfies f i >f avg If the value is +ε, it is defined as a weak particle, which means that it is a solution far from the optimal solution. For weak particles, global exploration is strengthened to escape local optima. S34: Update individual optimal position For each particle, update its optimal position based on its current fitness value. If the fitness of the particle's current position is f... i Fitness f less than the individual's historical best position gbest Then f i Assigned the value f gbest ; S35: Update global optimal position Evaluate the objective function value corresponding to the current position of all particles, find the particle with the smallest objective function value, and set its position as the global historical best position Gbest for the entire swarm. S36: Set differentiated inertial weights for different particles. Design differentiated inertial weights for the three types of particles and make adaptive adjustments. S37: Iteration Repeat steps S32 to S36 until the predetermined number of iterations is reached. After each iteration, the particle swarm gradually converges to the vicinity of the optimal solution in the search space. S38: Output the result, finally outputting the optimal solution obtained.
10. The resource allocation method in task unloading according to claim 1, characterized in that, S36: For different particles, set differentiated inertial weights; for the three types of particles, design differentiated inertial weights and adaptively adjust them; including the following steps: S361: Powerful Particles For dominant particles, an exponential decay weighting strategy is adopted to enhance local exploitation capabilities. An intermediate inertia weighting coefficient w is designed in the inertia weighting expression. mid Then the inertia weight w of the improved PSO algorithm is: Among them, the minimum inertia weight w min =0.4, intermediate inertia weight w max =0.7, decay coefficient λ=13, it is the current iteration number, MaxIt is the maximum iteration number; By increasing the intermediate inertia weight coefficient w mid Formula (16) ensures that the inertial weight of the dominant particle changes from w during algorithm iteration. mid To w min Smooth decay enables gradual convergence and local optimization of the algorithm; S362: Neutral Particle For the neutral particle, a polynomial-weighted linearly decreasing weight strategy is designed, where the polynomial part enables the particle to escape local optima, and the linear part enables the algorithm to gradually converge, thus balancing exploration and development. The formula for the inertia weight w in the improved PSO algorithm is: Where it / MaxIt represents the linear part, the part within square brackets represents the polynomial part, and ratio represents the relative distance between the particle fitness and the global optimal fitness, calculated using the following formula: Formula (17) dynamically adjusts the inertial weight of the neutral particle. When the ratio increases, the algorithm focuses on exploration; when the ratio decreases, the algorithm focuses on development. S363: Weak Particle For weak particles, a maximum fixed weight is used to enhance global exploration capabilities. The formula for the inertial weight w in the improved PSO algorithm is: w=w max (18); Among them, the maximum inertia weight w max =0.9, ensuring that weak particles can quickly escape local optima and encouraging such particles to explore new resource allocation schemes; Using the minimum weight w respectively min With the maximum weight w max Two thresholds; if the calculated weight value is greater than w max Then the weight value is set to w. max If the calculated weight value is less than w min Then the weight value is set to w. min All inertia weight values are determined by the boundary condition w. min ≤w≤w max limit.
Citation Information
Cited By
Task offloading method, system and device oriented to long-term dependence and multi-user competition
CN122248472A