## 4 Simulations and Results
### Results and Analysis  
The algorithm was implemented using Matlab 2012a. In the first evaluation, the maximum population iteration number for GA was set to 200. The values of user number \(N\) and task type \(K\) were set to 20 and 5, respectively. Each user is supposed to submit one task. The cache capacity of the edge cloud is 5000 MB, the amount of data transferred by all subtasks follows the normal distribution. In order to intuitively evaluate the complexity of the algorithm, we recorded the running time of the simulation program. The running time was around 11 seconds in a Windows 10 Operating System with Intel Core i7 CPU and 8 GB memory. In order to analyze the impact of the task cache on task execution performance, we compared the task completion time and energy consumption in two scenarios, with a cache policy and without a cache policy. The results are shown in Figures 3 and 4.  
User 2 decreased by 95.23%, and the task execution energy consumption for User 3 decreased by 85.84%. The cache strategy has a great influence on task execution time and energy consumption. Caching tasks on the edge cloud can reduce the time and energy consumption required for task data transmission.  
In the second evaluation, we also set 20 users and 5 different type of tasks. The average data size means the average size of data transmissions for all tasks performed by 20 users. The amount of data transferred by all subtasks also follows the normal distribution.  
As shown in Figure 5, in terms of energy consumption, using the cache policy outperforms using the non-cache policy, the energy consumed by the task is much less when using the cache policy. As the task data volume increases, the rate of increase in energy consumed by task execution using the non-cache policy is much faster than using the cache policy. When the average data size was 9600 MB, the energy consumption decreased by 55.38% when using the cache policy. This indicates that the energy saving effect brought by the caching strategy becomes more and more obvious for tasks with a large amount of task data transmission.  
We updated the cache capacity of the edge cloud, and the number of users was 60 and the types of task was set to 8. As is shown in Figure 6, as the cache capacity of the edge cloud increased, the energy consumption of the 60 users was reduced. The average data sizes were set to 3600 MB and 5400 MB, respectively, and when the edge cloud size was 4500 MB, the energy consumption decreased by 33.29%. The reduction in task execution energy consumption is due to the support of the cache capacity on the edge cloud. At the same time, it can be seen that the greater the amount of task data transmission, the more energy is consumed.  
We compared the energy consumption in terms of three strategies, (a) cache-based subtask migration algorithm (GA); (b) all tasks executed in the edge cloud (Edge); and (c) all tasks only executed on mobile devices (Local). As can be seen from Figure 7, the cache-based subtask migration algorithm outperformed the others. Using cache and task offloading can effectively reduce the energy overhead of mobile devices. At the same time, it can be seen that when the amount of data for a task is small, the difference in energy consumption between strategy GA and Edge are also small. In addition, with an increase in the amount of data transmission, the energy consumed is gets closer and closer for the Edge and Local strategies. Compared with the Edge and Local strategies, the maximum improvement in energy consumption for the GA strategy is21.16% (when the average data size is 144000 MB) and 31.6% (when the average data size is 5400 MB).  
Figure 5: Energy consumption as the average size of data transmission increases when two strategies are adopted.