Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
FIG. 1 is a flow chart of a reliability-based edge computing offloading and resource allocation method according to an embodiment of the present invention, as shown in FIG. 1, the method includes:
s1: establishing a reliability edge computing system frame according to an edge computing network scene comprising a plurality of devices, an Internet of things repeater and an edge server;
in the embodiment of the invention, as shown in fig. 2, in an industrial internet outdoor monitoring scene, a terminal device generates a large number of tasks with intensive computation and time delay sensitivity, an edge server provides computation resources for the tasks, and the computing capacity, battery energy and storage capacity deficiency of the terminal device are relieved through sharing idle resources; in the invention, considering the edge computing system in the outdoor environment monitoring scene of the industrial Internet, the scenes of a plurality of Internet of things devices and a single base station, the data volume generated by the industrial Internet of things devices is very huge, the chip overheat can be caused to affect the performance when the task is processed, and the communication capacity can be reduced due to the instability of the communication link, as in the industrial Internet of things device with a plurality of time delay sensitive and computation intensive tasks is assumed in fig. 1And an internet of things relay N, a single edge server M. Simultaneous computing tasks are expressed asWherein D represents the task input size, C represents the number of CPU cycles required to calculate each bit of task, T max Indicating that the task is tolerant of latency.
S2: under the system architecture in the step S1, a communication model is built according to the transmission delay and the transmission energy consumption during task unloading; establishing a calculation model according to the calculation time delay and the calculation energy consumption;
in the embodiment of the invention, when the local calculation cannot meet the performance requirement required by the task, part of the task is uploaded to the edge server by the local equipment for parallel processing, and the calculation unloading process is expressed as that the local equipment firstly unloads the task to the edge server for processing, and then the calculation result is returned to the terminal equipment after the calculation of the task is completed. Thus, according to shannon's formula, the task transfer rate can be expressed as:
wherein B represents the channel bandwidth; p (P) i Representing the transmit power of device i; sigma (sigma) 2 Representing noise power; g i =d i -α |h 1 | 2 Representing the power gain caused by channel fading; d, d i Representing the distance between the Internet of things equipment and the edge server; h is a 1 Representing rayleigh fading channel coefficients; alpha is the path loss index.
Therefore, based on the task transmission power, a communication model in which the transmission delay and the transmission energy consumption at the time of task unloading are expressed as:
wherein T is i tr Representing the transmission delay of the device i during task unloading; lambda (lambda) i Representing the task ratio size of device i, i.e., the task ratio size of device i offloaded to the edge server; d represents the task input size; r is R i Representing the task transmission rate of device i;representing the transmission energy consumption of the equipment i during task unloading; p (P) i tr Representing the transmit power of device i at task offloading;
likewise, for the computational model of the present invention:
(1) Local computing model
The number of CPU cycles for a device to perform a computational task depends on various factors, in order to trade off the task offload ratio to meet the reliability requirements of the task, assume f i l Representing the CPU cycle frequency at which device i is, and may be based on dynamic voltage and frequency scaling techniquesWithin the range of selection>Representing the maximum CPU cycle frequency of the device, the CPU frequency constraint of the device can therefore be expressed as:
considering that the chip calculation energy consumption mainly comprises application processing energy consumption, and meanwhile, the chip heating power is equal to the chip calculation energy consumption, the power consumption generated by an application processor of the Internet of things equipment is k (f i l ) 3 The time delay and energy consumption generated by processing the task locally are respectively expressed as:
where k represents the effective capacitance coefficient, which depends on the chip structure, λ i Representing the task ratio size of the device offloaded to the edge server.
(2) Edge calculation model
After receiving the offloaded tasks from the devices, the edge servers schedule their computing resources to process the tasks in parallel. Edge serverIs defined by the maximum CPU frequency ofRepresenting that the task computation latency offloaded to the ith device of the edge server is:
wherein f i m The CPU cycle frequency of the edge server m of the device i is the computing resource allocated to the offload task by the edge server m. In addition, since the calculation result is small, the delay and power consumption from the edge server to the device are also ignored. Thus, the total delay and total energy consumption of the device can be expressed as follows:
wherein T is i mec Representing task computation latency of device i offloaded to the edge server; t (T) i l Representing the time delay generated by the local processing of the device i; c represents the number of CPU cycles required for calculating each bit task; f (f) i l Representing the CPU cycle frequency of device i;representing the energy consumption generated by the local processing of the equipment i; k represents an effective capacitance coefficient; t (T) total Representing the total time delay of the device; u represents a device set; e (E) total Representing the total energy consumption of the device.
S3: according to the temperature and the signal-to-noise ratio, a calculation model and a communication model are established as a calculation reliability model and a communication reliability model;
(1) Computational reliability model
When the task is at the presentWhen processing on a local device, the irreversible computation on the chip logic increases the thermodynamic entropy of the environment, and the processing of a large amount of data on the local device can cause the CPU of the device to be severely loaded so as to emit heat. According to the heat transfer theory, the heat generated by processing data can lead the surface temperature of equipment to rise sharply, and considering that the temperature of an equipment chip can rise when a task performs local calculation, the system performance can be influenced when the temperature reaches a certain threshold value, and the task can fail to process. The power consumption generated by the application processor is denoted as P AP =k(f i l ) 3 And the variation in chip temperature is equal to the variation in device surface temperature, can be expressed as:
z(T chip -T env )=h air A(T sur -T env )
the surface temperature expression of the equipment can be obtained according to the one-dimensional unsteady state heat conduction process:
if the initial temperature of the chip isThe probability that the calculated reliability is defined as the chip temperature does not exceed the threshold temperature is:
wherein the parameter h air ,A,T chip ,T sur ,T safe ,T env ,c chip M, t represents the air convection heat transfer coefficient, the area of the radiating fin, the chip temperature, the equipment surface temperature, the safety temperature, the environment temperature, the initial temperature, the chip specific heat, the chip quality and the task calculation time. Thus, the task computation reliability is expressed as:
(2) Communication reliability model
Successful task transmission refers to an event that the received signal-to-noise ratio exceeds a certain threshold. Transmission reliability is defined as the signal-to-noise ratio exceeding a signal-to-noise ratio threshold, which is defined in this section as γ, when a task needs to be offloaded when it is computationally difficult for the task to meet the required performance at the local device, where the communication link may have insufficient channel capacity to offload the task due to fading th According to the definition above, the transmission reliability in the worst case of channel fading is Pr (gamma. Gtoreq. Gamma th ) Assuming that the channel gain obeys an exponential distribution with a parameter of γ, the probability density function is f (x) =e -x/γ /gamma. Thus, transmission reliability may be expressed as a probability that the signal-to-noise ratio is greater than or equal to a signal-to-noise ratio threshold, and its expression may be expressed as:
wherein P is reliable Representing a calculation reliability model, pr (·) representing a probability function; f (f) i l Representing the CPU cycle frequency of device i; parameter h air ,A,T chip ,T sur ,T safe ,T env ,c chip M and t are sequentially expressed as an air convection heat transfer coefficient, a radiating fin area, a chip temperature, an equipment surface temperature, a safety temperature, an environment temperature, an initial temperature, a chip specific heat, a chip quality and a task calculation time; z represents a control parameter, which is a constant; gamma represents the channel gain compliance parameter, gamma th Representing a signal to noise ratio threshold.
S4: according to the calculation reliability model and the communication reliability model, establishing an optimization problem with time delay and reliability as constraint conditions and with energy consumption of all equipment minimized as an optimization target;
after modeling the communication model, the calculation model and the reliability model, the section establishes an optimization problem by jointly considering task unloading decisions, local CPU frequency scheduling, transmitting power and edge calculation resources so as to minimize the energy consumption of all users and ensure the reliability requirement and the time requirement when the tasks are completed, and the established optimization problem is as follows:
C6:Pr[T sur (t)<T safe ]·Pr(γ≥γ th )≥ψ
C7:max{T i l ,T i tr +T i mec }≤T max
wherein P represents transmission power; λ represents the task off-load ratio; f represents CPU cycle frequency;representing a set of devices;representing the energy consumption generated by the local processing of the equipment i; />Representing the transmission energy consumption of the equipment i during task unloading; c1 denotes a user transmit power constraint, P i Representing the transmit power of device i; p (P) i max Representing the maximum transmit power of device i; c2 represents the local computing power constraints of the device, f i l CPU cycle frequency of device i, +.>The maximum CPU cycle frequency of device i; c3 and C4 represent edge server computing power constraints, f i m CPU cycle frequency of edge server representing device i,/-, is->Representing the maximum CPU cycle frequency of the edge server m; c5 denotes the user unloading ratio constraint, lambda i A task ratio size representing device i; c6 represents the overall reliability constraint of the task, pr (·) represents the probability function, T sur (T) represents the surface temperature of the device i, T safe Representing the safe temperature of device i, gamma represents the channel gain compliance parameter, gamma th Representing a signal-to-noise ratio threshold, ψ representing a reliability threshold; c7 represents task tolerance delay constraint, T i l Representing the delay generated by the local processing of the device i, T i tr Representing the transmission delay of the device i during task offloading, T i mec Representing task computation latency of device i offloaded to edge server, T max Representing the maximum delay.
S5: decomposing the optimization problem into an unloading ratio sub-problem, a power control sub-problem and a computing resource sub-problem, and adopting the steps S6 to S7 to carry out alternate iteration solution;
in the embodiment of the invention, in consideration of the fact that coupling variables exist in constraint and objective functions, and various variables and constraint conditions are non-convex, an original problem optimal solution is difficult to directly solve, and in order to decouple the variables, the original problem P is decomposed into three sub-problems: 1) Unloading the ratio sub-problem; 2) A power control sub-problem; 3) The computational resource allocation sub-problem converts the above expression into the original problem P1 as follows, and proposes an alternate iterative scheme of joint computation and communication resource allocation.
Wherein D represents the task input size; c represents the number of CPU cycles required for calculating each bit task; parameter h air ,A,T chip ,T env ,c chip M and t are sequentially expressed as an air convection heat transfer coefficient, a radiating fin area, a chip temperature, an ambient temperature, an initial temperature, a chip specific heat, a chip quality and task calculation time; z represents a control parameter and is a constant.
For the offload ratio sub-problem, given the transmission power P, the resource allocation f is calculated i l ,f i m The optimization objective can be expressed as:
s.t.C2.1:0≤λ u ≤1
the first order partial derivative function of the P2 problem is thatWhen solving for the unloading ratio, the unloading ratio can be obtained by comparing the boundary points provided by the unloading ratio, and the optimal unloading ratio can be obtained according to the first-order partial derivative function. When (when)When the offload rate increases, the total energy consumption increases, which means that the smaller the offload rate, the more energy-efficient, i.e. the user is more willing to calculate his data locally, but when the local calculation is enabledWhen the force is very limited, there is a tendency to offload more data to the edge server for execution; when->When the off-load ratio increases, the total energy consumption is reduced, which means that it is more energy efficient to off-load more tasks to the edge than to compute locally, while the larger the off-load ratio, the more energy efficient, i.e. the user is willing to off-load tasks to the edge. Thereby, an optimal unloading ratio can be obtained.
For the power control sub-problem: given computing resource allocation f i l ,f i m Unloading ratio lambda i In the case of (2), transmission energy consumption is minimized by optimizing the transmission power under the constraints of time delay and reliability, and the original problem can be converted into:
because the problem is in a split form and is a non-convex problem, the improved hybrid whale optimization algorithm is adopted to solve the current optimal value P of the transmitting power * 。
For the computational resource sub-problem: when the offload ratio λ and transmit power P are fixed, the total device energy consumption is minimized by optimizing local and edge computing resource allocation under latency, reliability, and computing resource constraints. Taking into account the problem of coupling and the delay constraint is relatively complexThe energy consumption in the task unloading process is minimum when the maximum time delay constraint is met, so that the optimization problem is deformed, and the time delay constraint is rewritten into T i tr +T i mec =T max At this time, the energy consumption in the task unloading process is minimum, and thus, the computational resource allocation sub-problem can be expressed as:
wherein lambda is u A task ratio size representing offloading of device u to edge server;representing the optimal unloading ratio of the device u; sigma (sigma) 2 Representing noise power; b represents the channel bandwidth; d represents the distance between the device and the edge server; alpha represents path loss fingerA number; h is a 1 Representing rayleigh fading channel coefficients.
Because the objective function has the partial formula and the constraint condition is coupled, the direct solution is more complex, and then the current computing resource allocation optimal value is obtained by adopting the improved hybrid whale optimization algorithm of the invention to solve by introducing the penalty function.
As shown in fig. 3, the performing the alternate iterative solution by adopting the steps S6 to S7 specifically includes:
initializing initial solutions of transmitting power, computing resources and communication resources, and then solving three sub-problems by adopting convex optimization and improved hybrid whale optimization algorithms respectively;
for the unloading ratio distribution process, firstly fixing the transmitting power and calculating the resource distribution, and then solving the unloading ratio through the Lagrangian theory and convex optimization;
for the communication resource allocation process, firstly fixing the unloading ratio and calculating the resource allocation, and then solving by improving a hybrid whale optimization algorithm to obtain the transmitting power;
for the calculation resource allocation process, firstly, the unloading ratio and the transmitting power are fixed, then, the calculation resource allocation is obtained by solving through improving a hybrid whale optimization algorithm, and finally, whether the optimal solution is reached is determined through judging the energy consumption.
S6: solving the unloading ratio sub-problem through a convex optimization theory and a Lagrangian method to obtain an optimal unloading decision;
it will be appreciated that solving the unloading ratio sub-problem by convex optimization theory and Lagrangian method may be a common approach to those skilled in the art, and the invention is not limited in any way.
S7: and solving a power control sub-problem and a computing resource sub-problem by improving a hybrid whale optimization algorithm to obtain optimal transmitting power, a local computing resource allocation decision and an edge computing resource allocation decision.
Because of the coupling relation among different variables, the intelligent optimization algorithm is an effective method for solving a global optimal solution, two searching modes exist in the whale optimization algorithm, and an optimal value can be better explored, but because the algorithm jumps out of the local optimal value, the global searching capability of the bat algorithm is considered to be stronger, and the improved hybrid whale optimization algorithm is provided by combining the bat algorithm with the whale algorithm.
Whales are considered a social mammal and they generally chase predatory prey by cooperating with each other. Thus, based on the behavior of the whale-trap, combining it with optimization problems led to a whale optimization algorithm in which the possible solutions are mapped with whale positions, and the optimal possible solutions are achieved by optimizing the whale positions. During each renewal, whales randomly choose to prey in two ways, namely surrounding prey and air bubble net predation, and the prey surrounding mode is adopted in two ways: the current optimal position is selected for predation, or a whale position is randomly selected and is close to the whale position, and the algorithm mainly comprises two steps, as shown in fig. 4.
Initializing: the whale adjusts its position continuously according to the distance from the prey, and the value of the optimization variable can be expressed as:
update mechanism: the whales can be surrounded by continuously contracted bubbles so that the whales can float on the water surface before hunting, and the bubble net feeding process is divided into a contraction surrounding mechanism and a spiral updating position. The contraction surrounding mechanism is divided into optimal utilization and random exploration, when the convergence coefficient |A| is less than or equal to 1, an optimal value is selected for calculation, and at the moment, an optimal utilization updating formula is as follows:
when the convergence coefficient |A| >1, selecting a random value for calculation, and randomly exploring and updating the formula as follows:
wherein X is * Is the position vector of the current optimal solution;is the position vector of the current solution, and X needs to be updated when there is a better solution in each iteration process * . Wherein->Is the absolute value of the distance between the current best position and the current position;is a coefficient vector, and C represents a random coefficient; t (T) max Is the maximum number of iterations. Wherein the convergence coefficient vector->And convergence factor a 1 The expression is as follows:
a 1 =2-2t/T max
the spiral predation mode of whales is mainly measured by a spiral equation established between whales and prey, and the expression is as follows:
wherein b is a constant of logarithmic spiral shape, l is an interval random coefficient having a value of [ -1,1]Between, l=a 2 Rand+1 and a 2 =-1-t/T max For a constant coefficient, two search mechanisms are chosen by the random number p=0.5, so the update strategy can be expressed as:
in the algorithm, firstly, a feasible solution is randomly initialized, the position of a search agent (namely the feasible solution) can be updated according to the predation mechanism of whales in each iteration, and the position can be updated by the optimal solution of the current iteration, and one search agent position can be randomly selected for updating. In the algorithm, the convergence factor a 1 The number of iterations gradually decreases from 2 to 0, the whale will initially move around continuously to obtain more prey (i.e. the exploring stage), and the whale will select the optimal position to move (i.e. the utilizing stage) continuously as the convergence factor becomes smaller. By constantly switching between spiral motion and surrounding mechanism, constantly taking optimal or random position to update in surrounding mechanism, the optimal solution of the algorithm is achieved.
The bat algorithm is an intelligent optimization algorithm which is proposed by connecting algorithm optimization with the detection and positioning capability of the bat on obstacles or the prey according to the habit that the bat detects the prey by utilizing sonar and avoids danger. The basic principle of the algorithm is that the number of bat populations is mapped onto the feasible solution of the problem, the bat positions are continuously optimized to achieve the optimal feasible solution, the individual fitness function is used for measuring the advantages and disadvantages of the bat positions, the target function in the problem is optimized through the fitness function mapping, the bat individuals are continuously optimized, the survival of the fittest is continuously carried out, and the positions are updated by searching for better feasible solutions.
If the bat is at random speedIn position->Flying while at a fixed frequency r i Sound wave loudness +.>Searching for prey and bat continuously adjusts the wavelength (or frequency) and pulse frequency of the transmitted pulse to approach the target according to the distance from the target position, so the position update mechanism can be expressed as:
f i =f min +(f max -f min )e
wherein, the local optimal solution x in the position updating mechanism * Pulse rate r i t And sound wave loudnessThe updating mode is as follows:
r i t+1 =r i 0 (1-e -rt )
because the exploration stage in the whale algorithm is easy to sink into local optimum, is easy to converge too early, is difficult to achieve optimum performance, and has excellent global searching capability, but the iterative process can only be updated by means of the current optimum individual, and the diversity is lacking, so that the contraction surrounding mechanism in the whale algorithm is replaced by the updating mechanism of the bat algorithm to achieve the jump-out local optimum. Based on the design thought, the invention provides an improved hybrid whale optimization algorithm based on the updating rules of whale algorithm and bat algorithm.
In the embodiment of the present invention, as shown in fig. 4, the improved hybrid whale optimization algorithm specifically includes initializing a viable whale population with the hybrid whale optimization algorithm, and initializing a location of the viable whale population; judging whether a termination condition is met, if not, calculating an adaptability value of a viable whale solving group, and calculating to obtain a convergence coefficient A, a random coefficient C, a spiral coefficient l and a random number p according to the adaptability value; if the random number p is smaller than a first preset threshold, continuing to judge whether the convergence coefficient A is larger than or equal to a second preset threshold, if so, selecting a random search agent and then updating the position of the whale solving individual through a bat algorithm updating mechanism; if the position of the whale solving individual is not greater than or equal to a second preset threshold value, the position of the whale solving individual is updated through a bat algorithm updating mechanism after the optimal searching agent is selected; if the first coefficient rand is larger than the second coefficient r, wherein both rand and r are random numbers generated randomly, updating the position of a local feasible whale solving individual; if the sound wave loudness eta is larger than the first coefficient rand and the fitness value of the position of the current feasible whale solving group is larger than the fitness value of the position of the previous feasible whale solving group, updating the pulse generation rate and the sound wave loudness; if the random number is not smaller than a first preset threshold value or after updating the pulse generation rate and the sound wave loudness, updating the position through a spiral surrounding mechanism, judging whether the current fitness value is smaller than the previous fitness value, if so, selecting to update the position of the current feasible whale solving group, otherwise, selecting the position of the previous feasible whale solving group; until the final optimal transmitting power, the local computing resource allocation decision and the feasible solution of the edge computing resource allocation decision are determined.
It may be understood that, in the embodiment of the present invention, for convenience of presentation, the first preset threshold value is 1, and the second preset threshold value is 0.5, and in actual situations, a person skilled in the art may appropriately adjust the values.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: ROM, RAM, magnetic or optical disks, etc.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.