Time-Efficient Allocation Mechanisms for Crowdsensing Tasks with Precedence Constraints

Crowdsensing has emerged as an efficient and inexpensive way to perform specialized tasks by leveraging external crowds. In some crowdsensing systems, different tasks may have different requirements, and there may be precedence constraints among them, such as the Unmanned Aerial Vehicle (UAV) crowdsensing systems. Moreover, minimizing the total execution time is a regular target for finishing the crowdsensing tasks with precedence constraints. As far as we know, only a few existing studies consider the precedence constraints among crowdsensing tasks, and none of them can minimize the total execution time simultaneously. To tackle this challenge, an efficient allocation mechanism for tasks with precedence constraints is first proposed, which can minimize the total execution time. Then, a case study is given to show how to fit our mechanism in the UAV crowdsensing system. Finally, the simulation results show that the proposed mechanisms have good approximate optimal ratios under different parameter settings and are efficient for the UAV crowdsensing system as well.


Introduction
With the emergence of various wireless technologies (4/5G, DSRC, and etc.), ubiquitous terminal equipment, such as smartphones, vehicles and UAVs, can collect real-time data from the environment and transmit the data to the IoT central server effectively [1][2][3]. As an important application of IoT, crowdsensing can leverage the power of large crowds to complete the complicated sensing tasks by using their smartphones or other mobile devices [4,5]. Compared with the conventional data collection methods, crowdsensing provides a low-cost and time-efficient solution for large-scale sensing tasks. With the dramatic proliferation of mobile devices, a set of crowdsensing systems have been implemented in recent year [6][7][8][9][10][11][12][13][14][15][16][17]. For instance, Kumar Rana et al. implemented an Ear-Phone system for monitoring the environmental noise pollution in urban areas through crowdsensing data collection [18].
Task allocation mechanism is crucial for crowdsensing, which directly decides the performance of the crowdsensing system. A variety of task allocation mechanisms have been proposed for crowdsensing systems [19][20][21][22][23][24][25][26][27][28][29][30][31]. For example, Reddy et al. proposed to maximize the spatial coverage with limited resource [19]. Jaimes et al. designed a budget-constrained incentive mechanism for task allocation [20]. He et al. took travel time into consideration and proposed to maximize the spatial coverage [21]. Considering that crowdsensing tasks may have various requirements (such as the type of data, sensing periods, etc.) and workers have different skills and reliability levels. Li et al. proposed to dynamically select appropriate workers for given tasks while keeping the constraints satisfied [22], Jin et al. incorporated quality of data to design the incentive mechanisms for MCS systems [25]. Iijima et al. considered the individual preference in distributed environments and proposed an adaptive task allocation mechanism that maximizes the social utility [32].
However, all these studies assume that the tasks in the crowdsensing system can be performed simultaneously and ignore that the sensing tasks may have precedence constraints in some applications. A crowdsensing task with precedence constraints cannot be executed before its pre-order tasks are finished. Actually, many crowdsensing applications have multiple steps, which will cause the precedence constraints of sensing tasks. UAV crowdsensing system is a typical system with precedence constraints, where exist mainly six types of tasks: WASD (Wide Area Search and Destroy), ISR (Intelligence Surveillance and Reconnaissance), CAS (Close Air Support), SEAD (Suppression of Enemy Air Defense), AR (aerial refueling), and PS (precision strike) [33,34]. In this system, there exists an execution sequence among tasks. Another example is the MCS based traffic congestion monitoring system, which monitors the traffic condition through collecting the sensing data of vehicles on different major roads. When a traffic jam occurs, the system will publish tasks to find out the reason that causes this congestion, to monitor the progress of the events that cause traffic congestion or to verify the effectiveness of the traffic grooming strategy. Obviously, these tasks have precedence constraints, i.e., the system needs to find out the congestion reason before monitoring the progress of the events.
Designing an efficient task allocation mechanism for tasks with precedence constraints meets more challenge than the existing ones. First, time efficiency, i.e., the total execution time of all the tasks, is usually important for these crowdsensing systems. Generally, task requesters want the total execution time as short as possible, such as in the UAV system [35][36][37][38]. However, different tasks may have different requirements for users, and each user can only meet the requirements of some tasks. The platform can only allocate tasks to the user who meets their requirements. Since all the constraints are taken into account, it is a hard job to allocate the tasks to users optimally, especially for the case users arrive online. As far as we know, only a few studies [39][40][41][42][43][44] have considered the precedence constraints among different tasks. For example, Schwarzrock et al. proposed a task allocation mechanism for UAV system, which can increase the amount of performed tasks [45]. However, none of these studies can minimize the total execution time of all the tasks at the same time.
To address this challenge, the crowdsensing task allocation problem with precedence constraints is studied in this paper, and an efficient allocation mechanism with the goal of minimizing the total execution time of tasks is designed. The NP-hardness of the studied problem can be proved by reducing the problem studied in this work to a classic NP-hard problem of multiprocessor scheduling problem (the details are as shown in Section 2.3), which means the studied problem does not exist a polynomial-time algorithm to get the optimal solution. Therefore, a near-optimal allocation mechanism is proposed to solve it. The designed mechanism includes four steps, which are task level division, final task set construction, allocation priority sequence construction, and task allocation. In order to minimize the total execution time of tasks, the mechanism first divides the level of tasks based on their precedence constraints and computes expected finish time of each task by assuming that there are enough users for all the tasks. Since the total execution time of the tasks is bounded by the critical task t c with the maximum expected finish time, the platform should first allocate a task to a user which can minimize the expected finish time of t c . Based on this principle, the algorithm constructs an allocation priority sequence for tasks. When a user arrives, it greedily chooses the task with the highest priority in the allocation priority sequence to allocate until all the tasks have been finished. Then, a case study is given to show how to fit the proposed mechanism in the UAV systems by considering the features of the UAV system. Finally, the simulation results show that the proposed mechanisms are efficient for crowdsensing systems with task precedence constraints. The main contributions of this work are listed as follows: • An efficient task allocation algorithm for tasks with precedence constraints is designed. As far as we know, this is the first work which considers the precedence constraints of tasks and the proposed algorithm can minimize the total execution time of all the tasks.

•
A case study is given to show how to fit the proposed mechanism in the UAV system, by considering the features of UAV task allocation problem.

•
Extensive simulations are conducted to evaluate the performance of the proposed algorithm, and the results show that the proposed algorithm has good approximate optimal ratios under different parameter settings.
The remainder of the paper is organized as follows. The description of the system model is presented in Section 2. Then, the details of the proposed approximation algorithm are given in Section 3. Next, a case study is given to show how to fit the proposed mechanism in the UAV system in Section 4. Afterward, a variety of simulations are conducted to evaluate the mechanism in Section 5. Lastly, the conclusion of the whole work is presented in Section 6.

Preliminaries
In this section, the system model is first introduced in Section 2.1, and then, the formal formulation of the task allocation problem is in Section 2.2. After that, the NP-hardness of the studied problem is proved in Section 2.3.

System Model
The crowdsensing system studied in this work is shown in Figure 1, which including a crowdsensing platform, a task requester and a set of mobile device users U = {u 1 , u 2 , ..., u n }. At the beginning of the task allocation, the requester will submit a set of tasks, which is denoted as T = {t 1 , t 2 , t 3 , . . . , t m }, to the crowdsensing platform. Each task t j ∈ T can be presented as t j = {C j , h j , l j , D j }, where C j denotes the conditional task set of t j , h j is the expected performing time of task t j , l j is the location of task t j , D j is the description of t j . Due to the precedence constraints among tasks, only when all the tasks in the conditional task set C j have been finished, can the task t j be assigned to a user to perform. However, if the conditional task set C j = φ (i.e., the task t j has no conditional task), the task t j can be allocated by the platform at any time. After receiving the task request from the requester, the platform will publish all the description of tasks to the users. The users arrive online, and each available user u i will submit a set of interested tasks T i to the platform. Based on the requirement of tasks and users, the platform will allocate the tasks to users one by one. Assume that each task only needs to be performed by one user, and the platform will allocate no more than one task to each user at each round. After finishing the allocated task, the platform will add the still available users to the waiting list, and treat it as a new arrival user. Use u i = {T i , PH i } to present user u i , where PH i is the expected execution time set of u i , and each ph i,j ∈ PH i is the expected execution time of u i for performing task t j .
In the UAV crowdsensing system, the task requester is the carrier, and each user is a UAV. The flight duration from the location of one task to another for different UAVs may be varied, which is an essential factor for the expected execution time of UAVs. Consider a UAV u i has finished task t j at the location l j and is assigned to perform next task t k at the location l k . The travel duration of u i can be presented as td i,k = TD(u i , l j , l k ), where TD(u i , l j , l k ) is a function to calculate how long it generally takes for u i to fly from l j to l k . Furthermore, if a UAV u i is going to finish its first task t k , the travel duration starts from its initial location l i and it is denoted as td i,k = TD(u i , φ, l k ) = TD(u i , l i , l k ). Notice that h k is the expected performing time of task t k . Then, ph i,k is mainly decided by td i,k and h k in the UAV system.

Problem Formulation
The goal of this work is to minimize the total execution time of the tasks with the precedence constraints.
For facilitate reading, we summarize some symbols that are used in this paper in Table 1. Table 1. The descriptions of notations used in this paper.

Notation Description
U a set of mobile device users u i a mobile device user i T i interested tasks submitted by user i PH i the expected execution time set of user i ph i,j the expected execution time of user i for performing task j T the task set submitted by requester t j a task j C j the conditional task set of task j h j the expected performing time of task j l j the location of task j D j the description of task j td i,k the travel duration of user i to the location of task k y j binary variable to represent whether task j is finished a j binary variable to represent if task j is permitted to be allocated x i,j binary variable to represent whether task j is allocated to user i s j the earliest time that the platform can allocate the task j to a user L j the level of task j F the final task set f j the order of task j in allocation priority sequence h e j the expected finishing time of task j c t j the recorded task with maximum expected finishing time in C j Let y j = {0, 1} represent whether the task t j is finished. If the task t j is a finished task, y j = 1, otherwise, y j = 0. Use a j = {0, 1} to denote if the task t j is permitted to be allocated, and it has a j = ∏ t k ∈C j y k . If task t j satisfies the constraint a j = 1, t j can be allocated to a user. Further use x i,j = {0, 1} to indicate whether the platform allocates task t j to user u i . If t j is assigned to the user u i , x i,j = 1, otherwise, x i,j = 0. Suppose s j is the expected beginning time of task t j , (i.e., the earliest time that the platform can allocate task t j to a user). Obviously, each s j should satisfy that s j ≥ max t k ∈C j (s k + ∑ u i ∈U ph i,k x i,k ). Define the total time that the users finish the tasks in the task set as the execution time of a task set. Then, the goal of this work is to minimize the execution time of the task set T . Definition 1 (The Studied Task Allocation Problem(STAP)). The studied crowdsensing task allocation problem can be defined as follows: . . .
The first constraint shows that the studied allocation mechanism should satisfy the precedence constraints of tasks. Therefore, t j can be performed only when all the tasks in its conditional task set have been finished.

Analysis of the NP-Hardness
In the following, it will prove that the studied task allocation problem can be reduced to the multiprocessor scheduling problem, which is a well-known NP-hard problem [46]. The description of the multiprocessor scheduling problem is as follows: given a set of jobs and m processors, the goal of the multiprocessor scheduling problem is to find the minimum possible time required to schedule all jobs in the job set on m processors such that there is none overlap, where each job has a fixed processing time.

Theorem 1. The studied task allocation problem (STAP) is NP-hard.
Proof. Consider a simple case of the studied problem, where there is no precedence constraint among tasks, and each user is interested in all the tasks. Then, the task set in this problem can be viewed as the job set in the multiprocessor scheduling problem, and the users in the studied problem can be viewed as the processors in the multiprocessor scheduling problem. The performing time of tasks in this problem is equal to the processing time of jobs in the multiprocessor scheduling problem. Then, the goal of the problem is equivalent to find the minimum possible time required to schedule all jobs on the processors such that there is none overlap. As is known to all, the multiprocessor scheduling problem is NP-hard. Therefore, the problem studied in this work is also NP-hard, which finished the proof.

Algorithm Design
It has been proved that the studied task allocation problem (STAP) is NP-hard, which means an approximation mechanism with polynomial-time is demanded to solve it. The proposed mechanism includes four steps, which are task level division, final task set construction, allocation priority sequence construction, and task allocation. In the first step, the levels of tasks are divided based on their conditional task sets. Define a task that is not in any conditional task set of other tasks as a final task. The total execution time of all the tasks is determined by the finishing time of final tasks. Thus, the second step of the mechanism is the construction of the final task set. Next, the mechanism achieves its design goal by sorting the tasks in descending order based on their expected finishing time. Finally, the tasks are allocated to users according to the allocation priority sequence constructed in the third step.

Task Level Division
The level in the algorithm is used to denote the precedence constraints among tasks. In the studied model, tasks can be allocated to users only when all the tasks in their conditional task set have been finished. Thus, the level of all the tasks in C j should be less than the level of t j . Symbol L j is used to denote the level of t j . Obviously, each task t j with C j = φ is in the lowest level ( i.e., L j = 1 ). The details of how to divide the level of tasks are as shown in Algorithm 1.

Algorithm 1 task level division
Require: the task set T Ensure: 6: for each task t j ∈ T do 7: if C j = φ then 8: Set L j = k; 9: for each task t j ∈ T do 10: for each task t q ∈ C j do 11: if L q = k then 12: Delete t q from set C j ; 13: if L j = k then 14: Delete t j from set T ; 15: k + +; 16: In Algorithm 1, it first makes a copy for each conditional task set C j , which is denoted as C j . Initially the current task level k = 1. The task level division algorithm runs in an iterative way. In each iteration, it scans all the tasks in temporary task set T . When t j is scanned, it will check whether the temporary conditional set C j = φ or not. If C j = φ, set the task level of t j equal to k (i.e., set L j = k). After all the tasks in T have been scanned, it will delete the tasks with level k from the temporary conditional set of other tasks and delete t j from the temporary task set T . Finally, the algorithm sets k = k + 1, and starts the next iteration until the task set T = φ.
The following instance is given to express the algorithm more clearly. Suppose the task set T = {t 1 , t 2 , t 3 , . . . , t 6 } in Figure 2.
According to Algorithm 1, the level of each task in the task set T is gotten. Apparently, tasks are divided into three levels. t 1 , t 2 , t 3 are in the first level, t 4 , t 5 are in the second level and t 6 is in the last level.

Final Task Set Construction
Definition 2. Define the tasks that don't exist in any other tasks' conditional task set as final tasks. There exists at least one final task t j in T . If t j is a final task, then t j / ∈ C k stands for all the t k ∈ T .
Since the total execution time of the tasks is bounded by final tasks, construction of the final task set is performed before sorting the allocation priority of tasks. In Algorithm 2, all the tasks in T are firstly assumed as final tasks. Then, they are checked one after another. When task t j is checked, it will be deleted from the final task set F if it exists in the conditional task set of at least one task. The details are as shown in Algorithm 2.

Algorithm 2 Final task set construction
Require: the task set T Ensure: the final task set F 1: Set F = T ; 2: for each task t j ∈ F do 3: for each task t k ∈ T do 4: for each task t q ∈ C k do 5: if t j = t q then 6: Delete task t j from the final task set F ; 7: return the final task set F ; Consider the instance in Section 3.1. There is no conditional task set C k (k ∈ [1,6]) in this example contains task t 6 . Thus, the constructed final task set F = {t 6 }. Obviously, all the tasks in T should be done when all the final tasks in F have been finished, and it is the feature of the final task.

Allocation Priority Sequence Construction
The optimization objective is bounded by the final tasks with the maximum expected finishing time. Thus, all the expected finishing time of the final tasks should be computed when tasks are allocated to users. To achieve the designed goal, the algorithm sorts the tasks with their expected finishing time and constructs an allocation priority sequence. In the following, some important definitions are given first. Definition 3. Task Sequence: A task sequence is sequence of tasks which satisfies the l-th task in the sequence should be in the conditional task set of the l + 1-th task and this sequence ends in a final task.
Since the tasks can only be performed one by one in the task sequence, the expected finishing time of a task sequence is equal to the expected finishing time of the final task in the sequence.

Definition 4.
The Critical Task Sequence: The critical task sequence is defined as the task sequence with maximum expected finishing time.
The allocation priority sequence construction algorithm runs in iterations. In each iteration, the critical task sequence of the task set T has to be found first, then the algorithm puts the task with the lowest level in the critical task sequence into the allocation priority sequence. The details are as shown in Algorithm 3.
Suppose f j is the order of task t j in the allocation priority sequence. In each iteration, the algorithm aims to find a task sequence and its value is greater than any other task sequences. Note that the value of a task sequence is equal to the expected finishing time of the final task in the sequence. To get the expected finishing time of the final tasks, the expected finishing time of the tasks in their conditional task set should be calculated. Thus, Algorithm 3 first computes the expected finishing time of each task in T .
Let h e j be the expected finishing time of task t j . Note that the expected execution time of different users for the same task may be different. However, users arrive online in this work. Thus, it hardly to get the expected execution time of tasks before allocating. In order to solve this problem, the mechanism assumes the expected execution time of task t j is h j in this step. Then, it has h e j = h j when L j = 1. When L j ≥ 2, h e j = h j + max{h e p } t p ∈C j . Notice that the algorithm computes the expected finishing time of tasks from low level to high level, and the levels of tasks in C j are lower than t j . Thus, {h e p } t p ∈C j are known when it computes h e j . c t j is used to record the task with maximum expected finishing time among tasks in C j , which can help to construct the critical task sequence.
After computing the expected finishing time of all the final tasks at the start of the algorithm, the mechanism begins to construct the priority sequence in iterations. As the expected finishing time of all the final tasks is calculated, the task t q with maximum expected finishing time can be found, and construction of the critical task sequence of task t q is available with the help of recorded c t j . Suppose t p is the task with lowest level in the critical task sequence of final task t q , t p is put into the allocation priority sequence by setting f p = l. Then, t p is deleted from task set T . If t p is a final task, t p should also be deleted from the final task set F . Afterward, the algorithm finds tasks that are directly or indirectly related with the deleted t p and computes their expected finishing time. Finally, the next iteration begins until T = φ.
Based on the information of tasks in Figure 2, the allocation priority sequence is gotten by continuously finding a new critical task sequence for a changed task set T . Figure 3a is the situation of task set T when the first task in allocation priority sequence has been found, and Figure 3b corresponds to the second task in the sequence. In Figure 3a, the task sequence < t 3 , t 5 , t 6 > is the critical task sequence, then, the task t 3 is the first task in allocation priority sequence. In Figure 3b, the task sequence < t 2 , t 4 , t 6 > is the critical task sequence in the changed task set T − {t 3 }, and the task t 2 is the second task in the allocation priority sequence. Furthermore, in order to find the third task in the allocation priority sequence, the mechanism ought to find the critical task sequence in the changed task set T − {t 2 , t 3 }.

Algorithm 3 Allocation priority sequence construction
Require: the task set T , the final task set F , the refresh task sequence R; Ensure: the allocation priority sequence { f j } t j ∈T ; 1: for k = 1 to max{L j } t j ∈T do 2: for each task in T do 3: if L j = k then 4: Set c t j is the task with the maximum expected finishing time among all the tasks in C j .

5:
Compute the expected finishing time h e j ; 6: Set l = 1; 7: while T = φ do 8: Find the final task t q ∈ F with maximum expected finishing time; 9: Construct the critical task sequence of task t q ; 10: Set f p = l; 11: Find the task t p with the lowest level in the critical task sequence of task t q ; 12: Delete t p from T ; 13: if t p ∈ F then 14: Delete t p from F ; 15: Gather all the rest tasks that have priority relationship with t p in the sequence R; 16: for each task t j in R do 17: Set c t j is the task with the maximum expected finishing time among all the tasks in C j . 18: Compute the expected finishing time h e j ; 19: Add all the rest tasks that have priority relationship with t j to the back of sequence R;

Task Allocation
After constructing the allocation priority sequence, the platform allocates tasks to users according to the order in the constructed allocation priority sequence. The proposed task allocation mechanism runs iteratively. In each iteration, the platform greedily allocates one task to a user, which will minimize the expected total execution time of all tasks. The details are as follows: Step 1: Sort the tasks in T according to the allocation priority sequence.
Step 2: In each iteration, the task with the highest priority in the sorted task list should be found first, and its conditional task set is φ. Assume this task is t j . Next, compute the expected execution time of all users interested in task t j . Then, the user u i who interested in t j with the minimum pt i,j can be found. The platform allocates t j to u i in this iteration. After that, the platform deletes u i from the available user set and deletes t j from the task set T . Then, the next iteration begins until the task set T = φ. In the case of there is no task can be allocated to users, and all the tasks and users remain in T and W should wait for new arrive users or some of the allocated tasks finished.
Step 3: When an allocated task t j has finished by u i , the platform deletes t j from all the conditional task sets that include t j . If u i is still available, the platform adds u i into the available user set, and views it as a new arrival user. Then, run step 2.
Note that the expected total execution time will be minimized if the tasks are performed in the order of the constructed allocation priority sequence. The proposed allocation mechanism greedily choose the task with the highest priority to allocate in each iteration, which means the mechanism can achieve a near-optimal total execution time.

A Case Study: Task Allocation Mechanism for UAV System
This section is to show how to fit the proposed task allocation mechanism in the UAV system. Consider a Crowdsensing based UAV system, there exists a carrier, a control platform and a group of UAVs embedded with different kinds of sensing devices. At the beginning of each round allocation, the carrier first submits the tasks to the platform. The platform has an available UAV list, and each available UAV submits a set of tasks that it can perform to the platform. Then, the platform runs Algorithms 1 and 2 to compute the level of each task and construct the final task set.
As is introduced in Section 2.1, the expected execution time of a UAV for task t j is mainly decided by the flight duration from the current location to L j and the expected performing time of t j in the UAV system. Although the flight time of different UAV may be varied, the expected performing time of different UAVs is similar for a fixed task. Therefore, the expected performing time of t j can be assumed to equal to h j for all the UAVs that have ability to perform t j . In the step of constructing the allocation priority sequence, set h e j = h j + max{h e p } t p ∈C j . By running Algorithm 3, the platform can get the allocation priority sequence of tasks.
Then, the platform adds the UAVs in a waiting list, and allocates the tasks to them based on the allocation priority sequence. In each iteration of allocation, the platform allocates a task to a user that can minimize the total execution time of all the tasks, i.e., allocates a task with the lowest level in the critical sequence to the user with minimal expected execution time. Based on the proposed mechanism of constructing the allocation priority sequence, the task with the lowest level in the critical sequence is the task with the highest priority in the sequence. Assume t j is this specific task. The expected execution time of a UAV u i for performing t j is ph i,j = td i,j + h j .
When a UAV has finished an allocated task t j , it will be added to the waiting list again. Moreover, the platform will delete t j from all the conditional task sets that include t j . This process goes on, until all the tasks have been finished.

Simulation
In this section, the settings of all the parameters are introduced first, and then extensive simulations are conducted to evaluate the proposed mechanisms.

Simulation Setting
A task is not always allocated immediately once it is available. More in details, when a task is available to be allocated, it might wait some time before being allocated. Furthermore, the total execution time of all the tasks is not likely to equal the theoretically optimal value of the allocation for the task set. Thus, the approximate optimal ratio is related to the performance of the algorithm in simulations.

Definition 5.
The parameter Alg denotes the execution time of task set T under the allocation of an algorithm, and Opt represents the theoretically optimal value of the allocation for the task set T . Then, the approximate optimal ratio: η = Alg Opt .
The setup of the simulation is as follows. In order to show the performance of the proposed algorithm, it varies the number of the released tasks, the number of the involved mobile device users and the level of the tasks set T with the symbol of m, n, l. Besides, m = |T |, n = |U | and l = max {L j } t j ∈T . The number of total tasks in each level is uniformly distributed in [m/l − 5, m/l + 5].
For any task t j in task set T , it has attributes of expected performing time h j , conditional task set C j , and its location l j . The size of C j is always distributed in [1,4] at random. In Figures 4-9, the parameter h j appears to follow the uniform distribution in U [20,40]. And in Figures 10 and 11 simulations, the parameter h j can also be U(30, 50) uniformly distributed. Each user u i submits a set of tasks T i that he is interested in performing, and the size of T i is randomly generated in [4,10] or [8,14] in different experiments. Furthermore, in Figures 4, 5, 8-11, the parameter |T i | always follows U[4, 10] uniform distribution. And in Figures 6 and 7 simulations, the parameter |T i | is also set as U(8, 14) uniformly distributed. What's more, to show that the proposed mechanism is available to be applied to the UAV system, settings about both tasks and users' location are also made. In Figures 4-7, 10 and 11, both the locations of tasks and users are uniformly distributed in U(0, 100). And in Figures 8 and 9, the location can also be normally distributed in N(50, 3). If a user u i is assigned to finish the task t j , calculate the Euclidean distance of the user and task, and relate it to the travel duration of the user u i for the task t j . After that, the requested performing time of a user u i to perform task t j is determined.
In each case of < m, n, l >, the simulation generates 2000 instances and takes the average value of them. The average value is the outcome of the case finally. The settings of all cases and the outcomes of simulations are shown in Tables 2 and 3.              Figure 11. The approximate optimal ratio of the proposed algorithm vs. different l when h j ∼ U (20,40) or U(30, 50).

Simulation Results
In Figures 4, 6, 8 and 10, the performance of the proposed algorithm is validated by changing the number of released tasks in different parameter settings. Regardless of other parameters' settings, it is obvious that when the number of involved users increases, the approximate optimal ratio decreases. As the theoretically optimal value of the allocation for the task set T is only in connection with the structure of the task set T , and the theoretically optimal value is fixed no matter how involved users change. When the number of involved users increases, the time of task's waiting to be allocated is likely to decrease, which would make the execution time of the task set T decrease. Then, the approximate optimal ratio decreases. Therefore, the approximate optimal ratio decreases as the number of involved users increases.
In Figures 5, 7, 9 and 11, the performance of the proposed algorithm is shown by changing the level of the tasks set in different environment setting. Apparently, the approximate optimal ratio will decrease if the levels of the task set increases. It is because more levels of task set make the number of tasks in each level less, the tasks are more likely to be allocated once they are available, and the waiting time of tasks in task set T is likely to decrease, which would make the execution time of the task set T closer to the theoretically optimal value of the allocation for the task set. Thus, the approximate optimal ratio decreases as the level of task set increases.
In Figures 4 and 5, the performance of the algorithm is illustrated by changing the number of released tasks. In both two settings, the number of released tasks m ranges in {200, 300, 400}. In Figure 4, it changes the value of involved users n from 50 to 110 while the level of task set l is set to be 6. And in Figure 5, it changes the level of the task set l from 6 to 16 while the number of involved users n is set to be 70. Both two simulations show that the approximate optimal ratio increases with the increasing number of released tasks. As the theoretically optimal value of the allocation for the task set T is only in connection with the structure of the task set T , and the theoretically optimal value is fixed no matter how the number of released tasks changes. When the number of released tasks increases, the time of each task waiting to be allocated is likely to increase, and the execution time of the released task set is also to increase, which would increase the execution time of the task set T .
In Figures 6 and 7, the size of involved users' interested task set T i is in different range. In these two simulations, the performance of the algorithm is validated by changing the size of user's submitted task set. Furthermore, the size of user's submitted task set is uniformly distributed in U(4, 10) or U (8,14). In both two settings, the number of released task m is fixed in 400. In Figure 6, the number of involved users n is changed from 50 to 110 while the level of task set l is set to be 6. And in Figure 5, it changes the level of task set l from 6 to 16 while the number of involved users n is set to be 70. Both two simulations show that the approximate optimal ratio decreases with the increasing number of user's submitted tasks. As the theoretically optimal value is fixed no matter how the number of released tasks changes. When the number of submitted tasks increases, and there exists some users in the available user list, the time of each task's waiting to be allocated is more likely to decrease, and the execution time of the released task set is also to decrease, which would make the execution time of the task set T decrease.
In Figures 8 and 9, the performance of the algorithm is shown by changing the area of region that the released tasks and involved users locate in. In both two settings, the number of released task m is fixed to 300. In Figure 8, the number of involved users n ranges from 50 to 110 while the level of task set l is set to be 6. And in Figure 9, the level of task set l ranges from 6 to 16 while the number of involved users n is set to be 70. Both two simulations show that the approximate optimal ratio increases with the increasing of the area of regions. It is because when the area of region increases, the performing time of released tasks increases, then the time of each task waiting to be allocated is likely to increase, and the execution time of the released task set is also to increase, which would increase the execution time of the task set T .
In Figures 10 and 11, the performance of the algorithm is illustrated by changing the expected performing time of released tasks. In both two settings, the number of released task m is fixed to 300. In Figure 10, the number of involved users n is changed from 50 to 110 while the level of task set l is set to be 6. And in Figure 11, it changes the level of task set l from 6 to 16 while the value of involved users n is set to be 70. Both two simulations show that the approximate optimal ratio increases with the increasing expected performing time of released tasks. When expected performing time of released tasks increases, the time users have to wait for each task to be allocated may increase, and the execution time of the released task set is also to increase, which would make the execution time of the task set T increase.

Conclusions
In this paper, the precedence constraints of tasks are considered, and an efficient task allocation algorithm is designed for crowdsensing systems with the goal of minimizing the total execution time of the tasks. The proposed algorithm first divides tasks into multiple levels and finds all the final tasks. Then, it constructs an allocation priority sequence according to the expected finishing time of tasks, and allocates the tasks to users based on the constructed allocation priority sequence. Finally, a case study is given to show how to fit the designed mechanism in the UAV system. The simulation results verify the efficiency of the designed mechanism.
In future work, the deadlines of tasks and the available time intervals of users will be taken into consideration when designing an efficient task allocation mechanism for tasks with precedence constraints. Moreover, the plans for designing a mobile crowdsensing based traffic congestion monitoring system and exploring real-world experimentation for the proposed task allocation mechanism also deserve to be carried out.