Tasks Scheduling using Ant Colony Optimization

: Problem statement: Efficient scheduling of the tasks to heterogeneous processors for any application is critical in order to achieve high performance. Finding a feasible schedule for a given task set to a set of heterogeneous processors without exceeding the capacity of the processors, in general, is NP-Hard. Even if there are many conventional approaches available, people have been looking at unconventional approaches for solving this problem. This study uses a paradigm using Ant Colony Optimisation (ACO) for arriving at a schedule. Approach: An attempt is made to arrive at a feasible schedule of a task set on heterogeneous processors ensuring load balancing across the processors. The heterogeneity of the processors is modelled by assuming different utilisation times for the same task on different processors. ACO, a bio-inspired computing paradigm, is used for generating the schedule. Results: For a given instance of the problem, ten runs are conducted based on an ACO algorithm and the average wait time of all tasks is computed. Also the average utilisation of each processor is calculated. For the same instance, the two parameters: average wait time of tasks and utilisation of processors are computed using the First Come First Served (FCFS). The results are tabulated and compared and it is found that ACO performs better than the FCFS with respect to the wait time. Although the processor utilisation is more for some processors using FCFS algorithm, it is found that the load is better balanced among the processors in ACO. There is a marginal increase in the time for arriving at a schedule in ACO compared to FCFS algorithm. Conclusion: This approach to the tasks assignment problem using ACO performs better with respect to the two parameters used compared to the FCFS algorithm but the time taken to come up with the schedule using ACO is slightly more than that of FCFS.


INTRODUCTION
The heterogeneous computing platform meets the computational demands of various problems. In such platforms the tasks can be executed in sequence or in parallel on two or more processors. One of the key challenges of such heterogeneous processor system is effective tasks scheduling (Srikanth et al., 2012). The problem of scheduling tasks to processing units has a major impact on the performance of a system (Shih-Tang et al., 2008). The scheduling problem is NP-Complete.
Scheduling of tasks is mapping of a set of tasks to a set of processors in order to achieve some goal. An efficient task scheduling avoids the situation in which some of the processors are overloaded while some others are idle (Mao, 2010). The goal is usually represented as some cost function which may consider the combination of several criteria: Fair load sharing between the processors, maximizing the degree of parallelism, reducing the average execution times of the program, minimizing the amount of communication among the processors, minimizing the makespan of the path and so on. In order to be of use in achieving a satisfactory solution, this cost function may include the constraints like tasks execution time, deadline of the tasks, inter-task communication time, precedence between tasks, speed of the processors, memory system properties. Several heuristic algorithms are proposed to solve the same problem. In (Braun et al., 2001) the author has compared eleven heuristics for mapping and scheduling a set of tasks onto the heterogeneous processors and the final goal is to minimize the makespan. Other categories of algorithms are also defined such as list-based scheduling (Radulescu and Gemund, 2002), cluster-based (Ucar et al., 2006) and duplication based scheduling heuristics. List based heuristics assigns priority level to the tasks and maps the highest priority task to the best fitting processors. Cluster based heuristics group consist of all tightly coupled tasks and assign them onto the same processor whereas the duplication based heuristics combines the above two heuristics. Ant Colony Optimization, inspired by the ants foraging behaviour, is a popular technique for approximate optimization (Blum and Roli, 2003). The core of this behaviour is the indirect communication between the ants by means of chemical pheromone trails which enables them to find short paths between their nest and food sources (Blum, 2005). A major advantage of ACO over other meta-heuristic algorithms is the problem instance may change dynamically. In this framework, the decisions made by all ants are purposeful and the experiences of all ants are utilised in each iteration to construct the new optimal solution.

MATERIALS AND METHODS
Task scheduling problem: Let Heterogeneous Multi Processors (HMP) = {P 1 , P 2 ,…, P m } denote m processors and each processor P j run at variable speed (Chen and Cheng, 2005). A Tasks Set (TS) = {T 1 , T 2 ,…,T n ) has n tasks. The utilisation matrix U of size n*m, where n is the number of tasks and m is the number of processors, whose elements are real numbers in (0,1) give the proportional utilisation of a processor by a task. In other words, the value u i,j denotes the fraction of the computing capacity of P j required to execute T i . u i,j is also referred as utilisation of T i on P j . The Task Scheduling Problem (TSP) can be formally described as follows: Given HMP and TS, determine a schedule that assigns each of the tasks in TS to a specific processor in HMP in such a way that the cumulative utilisation of the tasks on any processor is no greater than the utilisation bound of that processor which is 1.0 (Chen et al., 2011).

Processor characteristics:
The processors are assumed to be heterogeneous. The heterogeneity of the processors is defined by the varied proportional utilisation of the same task on different processors.

Tasks characteristics:
Tasks are assumed to be independent and thus there are no precedence constraints among them. Also there is no inter-task communication. The utilisation of a processor by a task is known a priori and it does not change with time. All the tasks are assumed to arrive at the same instant at 0 time units.
Problem formulation: TSP can be represented by a bipartite graph with two classes of nodes: TS and HMP. A task is mapped to a TS node and a processor is mapped to a HMP node. The graph is directed graph with the edges leaving from the class of tasks nodes to the class of processor nodes. There is a directed edge from a TS node to a HMP node if and only if the corresponding task can be assigned to that processor without exceeding its available computing capacity. More than one task can be scheduled on the same processor.
A sample utilisation matrix is shown in Table 1. The number of rows is equal to the number of tasks and the number of columns is equal to the number of processors. A typical entry u i,j specifies the proportional time of the processor P j used by the task T i.
A schedule can be represented as a n*m binary matrix where n represents number of tasks and m denotes the number of processors. A typical entry of this matrix is denoted as s i,j . The entry s i,j =1 if task T i is scheduled on processor P j . Note that there are no two 1's in the same row. This means that a task is assigned to only one processor. A column can have many 1's indicating that all the corresponding tasks are scheduled on that processor. But the proportional utilisation of all the tasks on a processor should not exceed 1. In other words: Applying ACO to TSP: Given a set of HMP and TS, the artificial ant stochastically assigns each task to one processor until each of the tasks is assigned to some specific processor. We introduce an artificial pheromone value τ i,j with an edge between T i and P j , that indicates the favourability of assigning the task T i to the processor P j . Initially τ i,j is the same for all i, j. After each iteration, the pheromone value of each edge is reduced by a certain percentage to emulate the reallife behaviour of evaporation of pheromone count over time. The fraction ρ specifies the percentage of the τ value after evaporation. (i.e.,) 1-τ is the evaporation rate. We use n a artificial ants. Each ant behaves as follows: From a node i in TS an ant choose a node j in HMP with a probability given by: After all the tasks are considered and scheduled by an ant, the feasibility of the schedule is verified using the utilisation value of individual processors. If any processor's utilisation exceeds 1.0, that schedule is infeasible. This procedure is repeated for all n a ants. The quality q of a feasible schedule S generated by an ant is computed by considering the total utilisation of all the processors. This quality is used in the pheromone update of the next iteration. This is given by: For our experiment ρ=0.7 and the utilisation matrix is generated randomly. The same utilisation matrix is used for all the trials and the FCFS algorithm. The parameters considered in our experiment are the utilisation of each processor, the average waiting time of all the tasks and the time taken for generating a feasible schedule. For each problem instance, ten trials are run for ACO and the average values of the parameters are taken which are then compared with those of the FCFS scheduling algorithm and the results are tabulated. The iterations continue till all the ants come up with the same schedule. Then the solution is said to converge.

Procedure: Tasks Scheduling Algorithm:
do while (solution not converged) for each ant k for each task i select the processor stochastically using the τ matrix If the schedule is feasible, compute its quality. Update the pheromone based on the quality of each feasible schedule Generate the τ matrix for the next iteration

RESULTS
A scheduling algorithm based on ACO is implemented and the algorithm is run for 8 problem instances with the number of processors as 8 and number of tasks as 80, 90, 100, 110, 120, 130, 140 and 150. The number of ants used for ACO is 100 and ρ = 0.7. Ten trials are done for each problem instance with ACO and the average value of wait time of tasks and utilisation of each processor are obtained. For each problem instance, FCFS is run with the utilisation matrix used by ACO algorithm. The wait time of tasks and utilisation of each processor are computed and compared with that of ACO and the results are tabulated. Table 2 and 3 indicate the individual processor utilisation obtained for ten trial runs for tasks sets of size 80 and 150 respectively. Similar results are generated for the other tasks sets but are not shown here. The average utilisation of each of the eight processors using ACO is shown in Table 4, for all problem instances. Table 5 shows the same for the FCFS algorithm. Figure 1 pictorially depicts this fact. Table 6 shows the average waiting time of all the tasks and Table 7 the average time taken for generating the schedule using ACO for all the eight problem instances. Table 8 gives a comparison of the two parameters, average waiting time and scheduling time of both the algorithms. Figure 3 and 4 pictorially represent the average waiting time and average scheduling time of the tasks using ACO and FCFS algorithms respectively.

DISCUSSION
It is seen from Table 5 that the number of processors not utilised by the FCFS scheduling algorithm varies from 1 to 4. But all the processors are utilised by the ACO algorithm as shown in Table 4. The last row of Table 4 and Table 5 give the standard deviation of the utilisation across all the 8 processors for the respective algorithms. Figure 2 shows the comparison of the standard deviation of the utilisation of all the processors using the two algorithms. This substantiates our claim that the load is fairly shared among all the processors in ACO. It is shown from Figure 3 that the average waiting time for the tasks is more in the case of FCFS compare to ACO. There is however a marginal increase in the scheduling time in case of ACO wih respect to FCFS as shown in Figure 4.

CONCLUSION
A different approach to task scheduling on heterogeneous processors based on ACO is presented. Our approach attempts to find a feasible task assignment with the objective of keeping all the processors more or less equally loaded. On comparison with the FCFS approach, the ACO method balances the load fairly among the different processors. The average waiting time of the tasks is also found to be less than that of FCFS algorithm. But there is a slight increase in the scheduling time for the ACO algorithm.