### 3.1 System model

This paper discusses the scenario that MDs in a particular area offload their computational tasks to specific edge servers. Each MDs has a computational-intensive task need to be computed. The set of MDs can be denoted as *N*={1,2,…,*n*}. *C*={*c*_{1},*c*_{2},…,*c*_{n}} is used to represent the CPU cycles needed to finish the task, and *D*={*d*_{1},*d*_{2},…,*d*_{n}} is used to represent the data size of computational tasks, where *i* is corresponding to the mobile device *i* in MDs set *N*. The combination of set *C* and set *D* are to describe the tasks on each MD. Communication, including computational data transmission between mobile devices and edge servers, is performed through the wireless access point. It is assumed that each task can be partial or fully offload to the edge server. The set *X*={*x*_{1},*x*_{2},…,*x*_{n}} is used to represent the offloading decisions, where *x*_{i} belongs to [0,1]. If *x*_{i}=0, it means mobile devices *i* compute the task through its CPU locally. On the contrary, the mobile device *i* completely offload its task to be computed at the edge servers if *x*_{i}=1. If *x*_{i}>0 and *x*_{i}<1, it means MD *i* offloads *x*_{i}×100*%* of tasks to be computed at the edge servers, and the rest (1−*x*_{i})×100*%* is computed at local. In the scenario, the computation resource capacity on edge servers is considered. The computation offloading model is a joint optimization of time delay, energy consumption, and price for edge service.

#### 3.1.1 Local computing model

For the situation that computes the task at local, the model can be described in this section. We let \(t_{i}^{l}\) as the local execution time, which only includes the processing time for the local CPU and \(e_{i}^{l}\) as the corresponding energy consumption of processing the task. \(F_{i}^{l}\) is denoted as the maximal CPU cycle frequency of device *i* due to its hardware. \(F_{i}^{l}\) is denoted as the current CPU cycles available for the task according to the run-time situation of mobile device *i*. When mobile device *i* process its task locally, the time delay \(t_{i}^{l}\) can be defined as:

$$ t_{i}^{l}=\frac{{{c}_{i}}}{f_{i}^{l}} $$

(1)

And the energy consumption can be expressed as:

$$ e_{i}^{l}=\kappa {{\left(f_{i}^{l}\right)}^{2}}{{c}_{i}} $$

(2)

where *κ* means the effective switched capacitance that is determined by the chip architecture, according to the reference [26], *κ* is set as 10^{−27} in this paper.

#### 3.1.2 Edge computing model

The model can be described in this section for the situation that computes the task at the edge server.

As the communication is through the wireless channel, the communication rate should be considered. *W* is defined as the bandwidth of the wireless channel, assuming that it would be equally allocated to mobile devices if more than one device chooses to offload the task simultaneously. Under this setting, *θ*_{i} is the wireless channel bandwidth allocated to mobile device *i*. The communication rate of mobile device *i* can be denoted as [14]:

$$ {{R}_{i}}={{r}_{i}}{{\theta }_{i}}=W\log \left(1+\frac{{{p}_{i}}{{h}_{i}}}{W{{N}_{0}}}\right){{\theta }_{i}} $$

(3)

where *p*_{i} represents the transmission power of mobile device *i*, *h*_{i} represents the channel gain of mobile device *i*, *N*_{0} denotes the background channel noise.

Under this circumstance, the time delay can be divided into two parts: transmission time and process time. \(t_{i}^{o}\) is used to represent the transmission time, and it can be defined as:

$$ t_{i}^{o}=\frac{{{d}_{i}}}{{{R}_{i}}} $$

(4)

The whole computing resources of the edge servers can be represented as *F*. And \(f_{i}^{e}\) denotes the CPU cycle frequency allocated to the mobile device *i* to finish its task at the edge server. \(t_{i}^{e}\) denotes the processing time needed on the edge server for the task from mobile device *i*. It can be defined as:

$$ t_{i}^{e}=\frac{{{c}_{i}}}{f_{i}^{e}} $$

(5)

The time for computation results to be transmitted back to the mobile device is ignored due to the data size of the result is much smaller. The total time for the mobile device *i* to complete its task fully through the edge server should be calculated by:

$$ t_{i}^{p}=t_{i}^{o}+t_{i}^{e} $$

(6)

And corresponding energy consumption \(e_{i}^{p}\) can be defined as:

$$ e_{i}^{p}=P_{i}^{o}t_{i}^{o}+P_{i}^{e}t_{i}^{e} $$

(7)

where \(P_{i}^{o}\) is the power needed to transmit data from mobile device *i* through the wireless access point, and \(P_{i}^{e}\) is the power when the mobile device *i* is waiting for the result.

#### 3.1.3 Edge service pricing model

The price of servicing charging mainly has two kinds of patterns. One is charging for the usage of time, and the other is charging for the resource usage. In this model, charging price based on resource usage is considered. In real life, the price is set on a certain unit. So, the baseline CPU frequency cycles *f*_{base} is defined. And according to the baseline set, the charge for the baseline *V*_{base} is defined as 1. The cost incurred for the task of each mobile device can be defined as:

$$ {{u}_{i}}=t_{i}^{e}\times {{V}_{{base}}}\times \frac{f_{i}^{e}}{{{f}_{{base}}}} $$

(8)

#### 3.1.4 Problem formulation

In the problem, it is assumed that n mobile devices are included. Moreover, each device has a different amount of tasks, which means that each device’s workload varies. The decision set *X* is calculated according to the given set of computation complexity *C* and data size *D*. The model should consider time delay, energy consumption, and pricing. However, these three targets describe different metrics, and they can not be simply added to form the final target function. Otherwise, it may cause problems. For example, the quantity difference may force the target function only to focus on a specific target. To solve the problem mentioned, normalization is applied in the model.

The total time latency can be calculated as:

$$ T=\sum\limits_{i=1}^{n}{\frac{\left[\left(1-{{x}_{i}}\right)t_{i}^{l}+{{x}_{i}}t_{i}^{p}\right]-{{T}_{\min }}}{{{T}_{\max }}-{{T}_{\min }}}} $$

(9)

where *T*_{min} means the minimum time delay calculated in the mobile device set, and *T*_{max} means the maximum time delay calculated in the mobile device set.

The total energy consumption can be calculated as:

$$ E=\sum\limits_{i=1}^{n}{\frac{\left[\left(1-{{x}_{i}}\right)e_{i}^{l}+{{x}_{i}}e_{i}^{p}\right]-{{E}_{\min }}}{{{E}_{\max }}-{{E}_{\min }}}} $$

(10)

where *E*_{min} means the minimum energy consumption calculated in the mobile device set, and *E*_{max} means the maximum energy consumption calculated in the mobile device set.

The total price of edge service can be calculated as:

$$ U=\sum\limits_{i=1}^{n}{\frac{{{x}_{i}}{{u}_{i}}-{{U}_{\min }}}{{{U}_{\max }}-{{U}_{\min }}}} $$

(11)

The improved calculation method has eliminated the influence of dimensions and makes the objective function easier to reflect the change of the result when adjusting the decision. As a consequence, the objective function can be expressed as below:

$$ \begin{aligned} & Q=T+\eta E+\gamma U \\ & \quad =\sum\limits_{i=1}^{n}{\frac{\left[\left(1-{{x}_{i}}\right)t_{i}^{l}+{{x}_{i}}t_{i}^{p}\right]-{{T}_{\min }}}{{{T}_{\max }}-{{T}_{\min }}}}+\eta \sum\limits_{i=1}^{n}{\frac{\left[\left(1-{{x}_{i}}\right)e_{i}^{l}+{{x}_{i}}e_{i}^{p}\right]-{{E}_{\min }}}{{{E}_{\max }}-{{E}_{\min }}}} \\ & \quad \quad +\gamma \sum\limits_{i=1}^{n}{\frac{{{x}_{i}}{{u}_{i}}-{{U}_{\min }}}{{{U}_{\max }}-{{U}_{\min }}}} \\ \end{aligned} $$

(12)

where *η* and *γ* is used as the coefficients. The coefficients are used to adjust the relationship of the three targets, which can be seen as the weights of targets in the final formulation. In the equation, the time latency target is regarded as a baseline whose coefficient is 1. The coefficients of the other two targets are adjusted, and the proportion of these three parts becomes different. In this way, the wanted weight consideration for the three targets is achieved.

The optimization problem to be solved can be given by:

$$ \begin{aligned} & \quad \quad \quad {{\min }_{{{x}_{i}},{{\theta }_{i}},f_{i}^{e}}}Q \\ & s.t.\text{ }0\le f_{i}^{e}\le {{x}_{i}}F,\text{ }\forall i\in N \\ & \quad \quad \sum\limits_{i=1}^{n}{f_{i}^{e}\le F,\text{ }\forall i\in N} \\ & \quad \quad 0\le {{\theta }_{i}}\le {{x}_{i}}L,\text{ }\forall i\in N \\ & \quad \quad \sum\limits_{i=1}^{n}{{{\theta }_{i}}\le L,\text{ }\forall i\in N} \\ & \quad \quad {{x}_{i}}\in [0,1],\text{ }\forall i\in N \\ \end{aligned} $$

(13)

The optimization problem has three targets, including time latency, energy consumption, and service price. The goal of the optimal problem is to reach the minimum value of the Q function under limited conditions.