A Game-Based Scheme for Resource Purchasing and Pricing in MEC for Internet of Things

Mobile edge computing (MEC) is emerging as a promising paradigm to support the applications of Internet of +ings (IoT). +e edge servers bring computing resources to the edge of the network, so as to meet the delay requirements of the IoTdevices’ service requests. At the same time, the edge servers can gain profit by leasing computing resources to IoTusers and realize the allocation of computing resources. How to determine a reasonable resource leasing price for the edge servers and how to determine the number of resource purchased by users with different needs is a challenging problem. In order to solve the problem, this paper proposes a game-based scheme for resource purchasing and pricing aiming at maximizing user utility and server profit. +e interaction between users and the edge servers is modeled based on Stackelberg game theory. +e properties of incentive compatibility and envy freeness are theoretically proved, and the existence of Stackelberg equilibrium is also proved. A game-based user resource purchasing algorithm called GURP and a game-based server resource pricing algorithm called GSRP are proposed. It is theoretically proven that solutions of the proposed algorithms satisfy the individual rationality property. Finally, simulation experiments are carried out, and the experimental results show that the GURP algorithm and the GSRP algorithm can quickly converge to the optimal solutions. Comparison experiments with the benchmark algorithms are also carried out, and the experimental results show that the GURP algorithm and the GSRP algorithm can maximize user utility and server profit.


Introduction
With the rapid development of Internet of ings (IoT) technology, various IoT devices such as smart phones and vehicles have been connected to the Internet [1,2]. Service requests generated by IoT devices usually have strict requirements for computing resources and real-time processing [3]. Because IoT devices usually do not have enough computing resources [4], they usually offload service requests to the cloud for computing [5]. Generally speaking, large data processing centers or cloud servers are usually built in remote areas away from users. erefore, when the service requests are offloaded to the cloud for computing, it will result in a lot of transmission costs and service delay. is is intolerable for IoT services that require high real-time performance.
To solve this problem, mobile edge computing (MEC) is proposed. MEC provides users with short-range cloud computing services by deploying edge servers [6]. In MEC, users can offload service requests to the network edge for calculation [7]. e edge servers are close to users and have rich computing resources. Compared with the public cloud, the edge cloud is closer to the IoT devices, which can meet the requirements of IoT applications for low latency [8]. Because the user service request does not need to be transmitted to the remote cloud for calculation through the Internet, the transmission delay is reduced. In recent years, with the development of the IoT, a huge number of service requests have been offloaded to edge servers for computing [9]. erefore, more and more edge cloud service providers came into being [10].
Although MEC can help provide resources for IoT applications, it faces unprecedented challenges. With the development of the IoT market, more and more different types of users will access the IoT networks [11]. Different users have different purchasing needs for resources. Compared with the public cloud, there are some restrictions on the computing resources on the edge servers, which cannot meet the resource needs of all users. erefore, how to reasonably allocate resources is a main challenge faced by MEC.
Reasonable pricing of resources can be used to solve the above problems. e servers price the provided computing resources and publish it to the users. Users choose appropriate resources to purchase according to the resource price of the servers and process the service request on the servers, so as to realize the reasonable allocation of resources. erefore, the current resource pricing scheme in MEC needs to balance and meet the needs of different types of users.
In this work, we focus on resource purchasing under the condition of maximizing user utility and server profit. Its operation mechanism is as follows: the servers publish the resource leasing price, and then the users determine the number of resource purchasing.
e servers obtain the resulting profit and repeatedly modify the leasing price in game. When the game equilibrium is reached, both the pricing of the servers and the resource purchasing of the users will be optimal.
Our contributions are summarized as follows: (i) We consider the scenario of an MEC system with multiple IoT device users and an edge server. Each user can purchase computing resources from the edge server and offload the service requests to the edge server for computing. We study the problem of resource purchasing and resource pricing from the perspective of users and servers and establish both the user utility function and the server profit function. e goal is to optimize both the user utility and the server profit together. (ii) We establish a Stackelberg game model to represent the interaction process of resource purchasing and resource pricing between multiple users and the server. e existence of Stackelberg equilibrium point is theoretically proved. It is also proved that the properties of incentive compatibility and envy freeness are satisfied. en, we propose a game-based user resource purchasing algorithm (GURP) and a game-based server resource pricing algorithm (GSRP) which can obtain the optimal solution of Stackelberg equilibrium. We propose the theorem that the individual rationality property is satisfied. (iii) In order to verify the performance of our GURP and GSRP algorithms, we carry out simulation experiments. Experimental results show that the algorithms can eventually converge to the optimal solution. In addition, in terms of resource pricing and resource purchasing, two groups of comparison experiments with the benchmark algorithms are carried out. e results show that the GURP and GSRP algorithms can obtain the maximum user utility and server profit. e remainder of this paper is organized as follows. We present the system model and relevant problem formulation in Section 2. We construct Stackelberg game model to analyze the interaction between users and servers and propose the GURP and GSRP algorithms in Section 3. We evaluate the performance of our GURP and GSRP algorithms in Section 4. e related works are reviewed in Section 5. e conclusion is given in Section 6.

System
Model. An MEC system for the IoTconsidered in this paper consists of one edge server, denoted by S, and a set of users, denoted by U. Users can lease and purchase computing resources on the edge server and offload service requests to the edge server for computing. is can overcome the problem of insufficient local computing power of users. e edge server provides computing resource leasing services to users within their signal coverage in order to obtain profit. In this paper, we assume that the resources on the edge server can meet the needs of all users in its coverage.
We consider a game-based scene for resource purchasing and pricing in MEC shown in Figure 1. As mentioned earlier, at different times, users accessing the IoT have different needs and satisfactions with resources [12]. If the edge server always adopts a single resource pricing, it will have an impact on resource allocation and market economy. erefore, from the perspective of users and server, based on game theory, this paper determines the resource purchasing and resource pricing scheme that can optimize user utility and server profit.

User Utility.
ere are totally N users who propose the service requests, denoted by U � u 1 , u 2 , u 3 , . . . , u N . We assume that each user u i proposes a service request. e service request of user u i is specified as a tuple (C i , T m i ). C i represents the calculated size of u i service request. T m i indicates the longest service request completion time acceptable to u i .
We consider that all user's service requests must be transmitted before starting computing.
us, the transmission time of the service request from user i to server is where b is the transfer rate. According to the source price p published by the edge server, user i determines its resource purchasing strategy, which is denoted by a i . e computing time of the service request from user i is where β represents the cycles per bit for computing one sample data of user and f represents the CPU frequency of a single resource in the edge server. We define T i as the actual completion time of the user's service request: Security and Communication Networks e user utility of u i is defined as where α i indicates user's u i satisfaction with renting server resources. e higher the user satisfaction is, the more the users tend to purchase more server resources for service request calculation [13]. pa i represents the cost of user purchases edge server's resource.

Edge Server Profit.
In addition to leasing computing resources to users, the edge server also needs to maintain computing resources. e edge server profit function can be defined as where q denotes the maintenance cost of the server to a single computing resource. For the server, it only needs to maintain the resources leased to users. Other computing resources not leased to users will not incur maintenance costs.
e main notations and their definitions used in the following discussion are given in Table 1.

Problem Formulation.
We formulate the scheme for resource purchasing and pricing as a Stackelberg game. We divide the whole game process into two stages. In the first stage, the edge server determines its own resource pricing scheme. In the second stage, each user determines its resource purchasing strategy to maximize its own user utility. erefore, in the process of this game, the edge server is a leader and users are followers. e strategy of the edge server is the source price p and the strategy of user is the number of resource purchasing, which is denoted by a i . For the arbitrary pricing p of the edge server, user i will determine an optimal resource purchasing strategy to optimize its user utility, i.e., e edge server will also update the pricing information according to users' resource purchasing strategies to pursue maximum profit, i.e., max M s ,

User Utility Optimization.
User i needs to determine appropriate resource purchasing strategy according to the resource price of the edge server to maximize its own user utility. e problem is defined as follows: e first derivative of V i with regard to a i is given by  Actual completion time of the u i service request a i u i purchases the number of resources from the server β Cycles per bit for computing one sample data of user C i Calculated size of u i service request p Price of a single server resource f CPU frequency of an edge server's single resource b Service request transfer rate q Maintenance cost of a server to a single resource Edge server S profit e second derivative of V i with regard to a i is given by Because the second derivative of V i with regard to a i is always negative, the function of V i is a convex function. Q 1 can be regarded as a convex optimization problem, and its optimal solution is i.e., When the resource unit price p is fixed, in order to obtain the maximum utility, the user purchases the number of resources as shown in (12). When the user utility value V i ≥ 0, the user chooses to purchase server resources and offload the service request to the server for calculation. Otherwise, the user will calculate the service request locally.
Theorem 1 (incentive compatibility). Users can truly report resource purchasing strategies. Users cannot obtain higher user utility by reporting false strategies.
Proof. As proved earlier, user u i determines the resource purchasing strategy a * i according to the resource unit price p formulated by the edge server. a * i is the unique maximizer of the user utility in equation (4). en, its utility function satisfies erefore, user will not obtain better user utility through false reporting strategy. e user has no incentive to misreport its strategy. So, there exists incentive compatibility. □ Theorem 2 (envy freeness). e user always prefers its own purchased number of resources to that of others.
Proof. In the system model proposed in this paper, users are independent of each other. All users can determine their resource purchasing strategies according to the price of edge server, so as to obtain the optimal user utility. e utility function of users only depends on their own resource purchasing strategies and resource unit price formulated by the edge server. Each user's resource purchasing strategy is optimal for itself. erefore, users will not envy the strategies of other users.

Edge Server Profit
Maximization. An edge server makes profit by leasing its computing resources. e server achieves the goal of maximum profit by adjusting its resource unit price. e problem is defined as follows: where the value of a i is determined by equation (12). e first derivative of M s with regard to p is given by e second derivative of M s with regard to p is given by Because the second derivative of M s with respect to p is always negative, the function of M s is a convex function. p ⟶ 0, M s < 0; p ⟶ ∝ , M s � 0. us, Q 2 can be regarded as a convex optimization problem, and it has a unique optimal solution p * . e optimal solution p * is related to the satisfaction of leasing resources of each user (α i ).

Stackelberg Equilibrium.
For users and the edge server, in the game model, the existence of Stackelberg equilibrium can be proved by the existence of optimal solutions for problems Q 1 and Q 2 . is not only ensures that the edge server can get the optimal profit but also ensures that users can get the optimal utility. Theorem 3. For the edge server, there is an optimal resource price p * , which makes the server profit optimal. u i has an optimal resource purchasing strategy a * i , which makes the user utility optimal. en, it can be explained that the game model has a Stackelberg equilibrium, i.e., Proof. It can be obtained from formula (16) that the edge server profit M s is a convex function with regard to resource price p. erefore, the edge server can get an optimal resource pricing strategy, so as to maximize the server profit. For a certain resource price, according to (12), user can make an optimal source purchasing strategy to maximize personal utility. erefore, there is Stackelberg equilibrium in the game model. We propose the game-based user resource purchasing (GURP) algorithm as shown in Algorithm 1. For each user, in each game with the server, they will first accept the resource price p information published by the server. e user determines the resource purchasing strategy that maximizes the user's utility according to formula (12). Due to individual rationality, each user will judge whether its utility value is greater than 0. If the utility value is less than 0, the user will give up purchasing computing resources. On the contrary, the user determines the resource purchasing strategy and reports the strategy information to the server. e specific process is as follows. In line 2, we initially set the user utility values of all users to 0. In lines 4-14, each user sets resource purchasing strategy according to (12). Finally, user will make a resource purchasing strategy to maximize its user utility and report the resource purchasing strategy to the edge server.

Game-Based Server Resource Pricing Algorithm.
We propose the game-based server resource pricing (GSRP) algorithm as shown in Algorithm 2. For the server, at the beginning of the game, set a small resource pricing information and publish the information to the user. en, the server accepts the purchase information of users and calculates its own profit. Next, the server sets an appropriate resource price update step. It continuously updates the resource pricing information and publishes it to users and accepts the user's purchase information and calculates the profit. In the iterative process of game between the server and the users, the server's pricing strategy will converge to the price that maximizes the profit of server. e specific process is as follows. In lines 1-5, we initialize the variable values in the Algorithm 2. In lines 6-12, the edge server will constantly update the resource price to maximize the server profit and record the optimal resource price. Finally, the edge server will get the resource price which can maximize the profit.
Both Algorithm 1 and 2 have high computational efficiency. For GURP, as shown in Algorithm 1, for line 4, because of n users participating, it needs to cycle n times for calculation. erefore, the computational complexity of Algorithm 1 is O(N). For GSRP, as shown in Algorithm 2, for lines 6-12, the number of iterations for the convergence of server profit is limited. We use M to represent the number of iterations, so its computational complexity is O(M).
en, from line 10, the computational complexity is O (N). erefore, the computational complexity of Algorithm 2 is O(MN).

Theorem 4. Both GURP and GSRP mechanisms satisfy individual rationality.
Proof. Individual rationality means that no one will suffer from participating in the sale mechanism. For resource purchasers (users), in GURP, as shown in Algorithm 1, for line 6, users will purchase resources on the premise that their user utility is greater than 0. For resource seller (edge server), in GSRP, as shown in Algorithm 2, for line 6, the resource price set by the edge server must make its profit greater than 0. erefore, both GURP and GSRP mechanisms satisfy individual rationality.

Setup.
We conduct simulation experiments and use simulation data to verify the game algorithm proposed in this paper. In the experimental scenario, there are six users and an edge server. We set the maintenance cost of a server to a single resource q as 1 [14] and set the CPU frequency of an edge server's single resource f as 4 GHz [15]. e satisfaction of u i is set to 50-100 [16].
To be specific, the main parameters involved in this experiment are shown in Table 2.

Parametric Analysis.
e first set of experiments is to investigate the change of edge server profit in the game. From the result shown in Figure 2, we can know that the profit of the server will converge to the equilibrium point of the game with the increase of the number of games. e convergence rate is related to the update step of p. When step Δp is small, the server profit will have to go through multiple rounds of iteration to reach the convergence point. When step Δp is big, the server profit value may miss the convergence point. e game iteration between users and the server takes some time and energy. Too many iterations may cause users to give up resource purchasing because they cannot stand the consumption of time and energy. Too few iterations may cause the server to miss the optimal pricing strategy and damage the profit of the service provider. erefore, in an actual scenario, the update step size of the server resource pricing strategy will have an impact on the final profit of the server. e server needs to formulate a reasonable resource unit price update step. Figure 3 shows the change of user's utility value with the number of iterations. We study and analyze the change of utility value of six users with different satisfaction and different service request sizes. e user's satisfaction relationship is α 1 < α 2 < α 3 < α 4 < α 5 < α 6 . At the beginning, the server makes the price of resources very low, so users will have high user utility. With the progress of the game, the server will gradually formulate optimal resource price, so user's utility will gradually decrease and reach the equilibrium point of the game. e higher the user's satisfaction with the leased resources is, the more the user tends to purchase more edge computing resources to obtain greater user utility. e higher the satisfaction of users, the higher the user's utility after reaching the equilibrium point of the game.
We specifically study the impact of satisfaction on user's utility and server's profit. From the result shown in Figure 4, for users, users with high satisfaction tend to buy more computing resources at the edge server, so as to obtain greater user's utility. For the server, simultaneously, providing more resources to the group of users with high satisfaction can bring in higher profits.
Finally, Figure 5 illustrates the impact of service request transfer rate and CPU frequency on server's profit. It is shown that as the service request transfer rate and CPU frequency increase, the server's profit becomes higher. e server provides high transmission rate channel and high Security and Communication Networks computing power resources, which can attract users to purchase more computing resources, so as to improve the profit of the server.

Comparison Experiment.
In this part, aiming at the problem of resource pricing and resource purchasing, we compare and analyze many different resource pricing and resource purchasing algorithms and further evaluate the performance of the game algorithm (GURP and GSRP) proposed in this paper.

Resource Pricing.
e server leases resources to users, determines the resource leasing price, and obtains profit by charging users a fee. For server's resource pricing, we compare three pricing strategies: (i) Random resource pricing: the server randomly makes a resource leasing price. (ii) Historical optimal resource pricing: the server queries the historical optimal resource pricing and takes it as the current resource pricing scheme.
Input: p Output: optimal a * i for each u i (1) for each u i in U do (2) ALGORITHM 1: Game-based user resource purchase algorithm (GURP).  (iii) Game-based server resource pricing (GSRP): in the process of game with users, the server continuously updates the price until the optimal resource pricing scheme is given. Figure 6 shows the server's profit with different resource pricing strategies. e experimental result shows that the profit of the server is different for the user groups with different satisfaction. With the increase of user satisfaction, the profit of server also increases. e game-based pricing algorithm proposed in this paper is superior to the other two kinds of pricing algorithms in maximizing server profit. e GSRP algorithm can find the most suitable resource price for the current user group and obtain the maximum profit in the process of game with users.

Resource
Purchasing. In order to maximize user utility, users purchase appropriate edge computing resources to calculate service requests. For user's resource purchasing, we compare three resource purchasing strategies: (i) Random resource purchasing: user randomly purchases a certain number of resources on the edge server. (ii) Fixed resource purchasing: user purchases a fixed number of resources on the edge server according to the size of its service request. User with larger service request will purchase more edge server resources for calculation. (iii) Game-based user resource purchasing (GURP): in the process of game with server, user determines the resource purchasing strategy to maximize its user's utility according to the resource pricing of the edge server. Figure 7 shows the utility values of users with different resource purchasing strategies. e experimental result shows that the user's utility is different for the users with different satisfaction. e more satisfied the users are, the more inclined they are to participate in the resource purchasing market, so as to obtain greater utility. e gamebased resource purchasing algorithm proposed in this paper is superior to the other two kinds of resource purchasing     e GURP algorithm can determine the best resource purchasing strategy according to the real-time resource price and obtain the optimal user utility.

Related Works
In recent years, with the development of the IoT, many research studies focus on its resource allocation and resource pricing problems [17].
In [18], the authors adopt the machine learning method for the first time and obtain a market model by using big data. rough the model, servers can get an optimal resource pricing scheme. Siew et al. [19] mainly studied the resource allocation in MEC. From the perspective of maximizing servers' profits, the authors designed two dynamic resource pricing mechanisms for resource allocation. In [20], from the perspective of users, users can independently select server resources by judging the acceptable service request price and time cost to realize resource allocation. In [21], the authors introduced a Petri net and proposed a resource allocation strategy based on pricing time. In [22], the authors studied a fog calculation scene. By judging the priority of users requests, the servers formulate relevant pricing schemes and resource allocation schemes.
Due to the resource leasing and resource purchasing behavior between servers and users, some studies focus on the economic problems in MEC. In [23], in order to solve the resource allocation problem in MEC, the authors proposed two dynamic pricing double auction algorithms. From the perspective of maximizing social welfare, the authors in [24] introduced a broker between users and servers to manage market purchasing and pricing behavior and proposed an iterative bilateral auction scheme. In [25], Stackelberg game was applied to the task offloading for mobile blockchain. e authors proposed a dual auction game mechanism to obtain the optimal resource price and equipment resource demand.
e Stackelberg game theory is widely used to solve the problem of resource management. e authors in [16] studied a scenario of Internet of vehicles, and the real-time pricing problem of computing resources in Internet of vehicles was solved by using Stackelberg game. In [26], the authors studied the allocation of computing resources in multiple edge clouds and ToT devices and proposed a computing offload mechanism based on two-stage Stackelberg game. Zhang et al. [27] proposed a distributed algorithm for resource allocation based on Stackelberg game.
However, few studies pay attention to the problem that users actively determine the number of resources to purchase according to the real-time resource pricing of servers in MEC.
is paper studies the resource purchasing and resource pricing scheme in MEC from the perspective of Stackelberg game theory.
e Stackelberg game theory is used to model the interaction between edge servers and users, and the existence of Stackelberg equilibrium is proved. In addition, the resource purchasing and resource pricing algorithms based on game theory are proposed.

Conclusion
In this paper, we investigate a game-based scheme for resource purchasing and pricing in MEC for IoT. Based on Stackelberg game, the server and users can update their resource pricing strategy and their resource purchasing strategies continuously during the game. e models of optimal user utility and server profit are given. We propose a game-based scheme for resource purchasing and pricing, and the existence of Stackelberg equilibrium is proved. Finally, the algorithm is evaluated by simulation experiments.
e experiment results demonstrate that user utility value and edge server profit obtained by this algorithm are better than other basic resource purchasing and resource pricing algorithms. For our future work, we will consider unloading part of the user's service request to the edge server for calculation. Service requests will be calculated in parallel on local and edge servers. Users can maximize their user utility values by determining the size of offloading service requests and the number of resource purchasing.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.