3. The proposed method

resource u and resource v. The grid computing environmental schematic is shown in Figure 2 (b). The workflow application can be represented with a directed acyclic graph (DAG) G(V, T), as shown in Figure 3, in which V = {Vi}, where i =1~ M is the set of all tasks and M is the total number of tasks. Precedence exists between certain tasks, and each task has a workload; wi represents the workload of task i. Figure 3 also indicates the precedence relationship between tasks such as the following: task 1 is the predecessor of tasks 3 and 4, and tasks 3 and 4 are the successors of task 1. Meanwhile, task 5 cannot be executed until task 2 is done, and task 6 has to wait till tasks 3, 4, and 5 are accomplished. Certain required data for execution on successors have to be transmitted to the successors when the predecessor is completed, i.e., transmission costs exist. TCij represents the amount of data transmitted between tasks i and j. If the predecessor and the successors are arranged to be executed with different resources, a transmission cost exists. On the contrary, if the predecessor and the successors are arranged to be executed with the same resource, there will be no transmission cost. Meanwhile, task 0 and task 8 in the figure are virtual tasks representing the start and the end, respectively. They have

The goals of workflow scheduling optimization are to appropriately match tasks to resources and to suitably assign execution priorities to tasks without precedence restriction in the same computing resource to reduce the makespan of the application execution. The cost includes the resource processing time of the path and the data transmission time. In Figure 3, for example,

Figure 2. Grid computing environment. (a) The composition of the grid environment. (b) The grid computing environ-

no workload and involve no data transmission costs.

44 Particle Swarm Optimization with Applications

Figure 3. Directed acyclic graph (DAG) of a workflow application on the grid.

mental schematic.

Many nature-inspired optimization algorithms have been proposed to find optimal solutions to workflow scheduling problems and metaheuristic algorithms that imitate the behaviors of biological creatures. Some that are extensively applied include ACO, GA, bee colony optimization (BCO), and the PSO adopted in this study. Among them, PSO requires fewer parameters and is easier to implement. Therefore, it has been well applied to solve diverse NP-complete problems, and the results have been rather remarkable. Meanwhile, PSO has also been employed to solve workflow scheduling problems with effectiveness.

As shown in Figure 3, if task 2 and task 6 are allocated to be computed by different resources, there will be a transmission time, and the makespan will be extended. On the contrary, if they are arranged to be executed by the same resource, there will be no transmission time, and the makespan will be shortened. Furthermore, if task 1 and task 2 are arranged to be executed by the same resource, executing task 1 before task 2 or vice versa will have an effect on the makespan of the workflow application on the grid. Hence, the study of minimization of the makespan in workflow scheduling involves two issues: task-resource matching and task execution priority determination. Figure 4 illustrates an example with two heterogeneous resources (R<sup>1</sup> and R2) with different abilities in the grid environment; these two subproblems need to be solved for the studied workflow application scheduling problem. Figure 4(a) displays the task-resource matching subproblem, and Figure 4(b) indicates some possible execution priorities of the tasks (tasks 1, 3, 4, and 5) assigned to resource 1 (R1).

best experience on the velocity of iteration. r1 and r2 are the random numbers between 0 and 1, adopted to increase the diversity of particle movement and prevent particles from moving

Stochastic Greedy-Based Particle Swarm Optimization for Workflow Application in Grid

http://dx.doi.org/10.5772/intechopen.73587

In this work, a constriction PSO is applied to solve the task execution priority problem. Similar to the inertia weight, a constriction factor χ was introduced into PSO to balance global and local searches, i.e., the constriction factor used to limit the movement size, and is named constriction PSO [18]. The velocity update rule used in constriction PSO is indicated in Eq. (5):

ij <sup>¼</sup> <sup>χ</sup> Vij <sup>þ</sup> <sup>c</sup>1r<sup>1</sup> gbest � Xij � � <sup>þ</sup> <sup>c</sup>2r<sup>2</sup> pbestij � Xij h i � �

The discrete PSO (DPSO) was proposed by Kennedy and Ebrhart in 1997 [19]. Unlike in conventional PSO, the particle position components of the discrete PSO are binary. In other words, Xij∈(0,1). The velocity update is similar to Eq. (5), but the constriction factor is set to 1. The position vector Xij is calculated with the sigmoid function S(Vij) in conjunction with velocity vector Vij, and the real valued velocity is converted into a probability. This probability is then compared with a random number to update the position component value either 0 or 1.

0,SVnew

8 ><

>:

1, SVnew

The sigmoid function is applied to convert the velocity value into a probability between 0 and 1. However, to prevent the value of S(Vij) from becoming too close to 0 or 1, the value of Vij is normally limited to between [-Vmax and Vmax]. In this study, DPSO is applied to solve the taskresource matching problem. The particle positions are designed as a two-dimensional matrix M�N. M represents the number of tasks, and N is the number of binary bits, which is the floor function of log2(resource quantity) plus 1. If the number of resources is R, N ¼ b c log <sup>2</sup>ð Þ R þ 1. In other words, Xi = [Xipq], p =1~ M, and q =1~ N. The combination of number (N) of binary numbers (after the binary values are converted to metric values) of the p row is the resource allocated for the task p. Suppose that the number of resources is 3 (R = 3), then two bits

Stochastic greedy is greedy by chance; it has been well applied in constructing the path of ants in ant colony optimization. Ant colony optimization, which was initially introduced by Dorigo et al. in 1996 [20], imitates the foraging behavior of ants. The ACO was first applied to solve the traveling salesman problem [16, 21]. In ACO, ants lay down pheromones on the foraging paths. The deposited pheromone is the stigmergy used to communicate with ants. The amount of pheromone deposited on a particular foraging path increases with the number of ants traveling along the path. An ant foraging path corresponds to a feasible solution to the studied

ij � � <sup>&</sup>lt; rand

ij � � <sup>≥</sup> rand

(5)

47

(6)

only toward the individual best experience or the global best experience.

ij

Vnew

8 < :

(N ¼ b c log <sup>2</sup>ð Þ3 þ 1 ¼ 2) are required.

3.2. Stochastic greedy in ant colony optimization (ACO)

Xnew

ij <sup>¼</sup> Xij <sup>þ</sup> <sup>V</sup>new

The position update rule for discrete PSO is displayed in Eq. (6):

Xnew ij ¼

To deal with these issues, the constriction PSO is used to solve the task execution priority issue and the discrete PSO to cope with the task-resource matching issue.

#### 3.1. Used PSOs

PSO was first introduced by Kennedy and Ebrhart in 1995 [17]. After observing birds flying, fish seeking food, and other social behaviors of animals, they discovered that each particle would move to their next position according to information (experience) shared among the members of the swarm. Restated, when particles move, they refer to individual experience (pbest) and global experience (gbest). At each moving step, a particle will refer to both kinds of experience to make the next move. The particle represents the solution of the problem to be solved. Hence, the movement of particles is regarded as a solution search in a solution space. The position update equation of PSO is as shown in Eq. (4):

$$\begin{cases} V\_{\vec{\eta}}^{new} = \omega V\_{\vec{\eta}} + c\_1 r\_1 \left( pbest\_{\vec{\eta}} - X\_{\vec{\eta}} \right) + c\_2 r\_2 \left( gbest\_{\vec{\eta}} - X\_{\vec{\eta}} \right) \\\ X\_{\vec{\eta}}^{new} = X\_{\vec{\eta}} + V\_{\vec{\eta}}^{new} \end{cases} \tag{4}$$

Each particle of a swarm has its own velocity V. The Vij represents the jth velocity component of the particle i. X is the position of the particle and Xij the jth position component of particle i. pbestij is the jth component of the best individual experience of the particle i. The gbestj is the jth component of the best global experience. w is the inertia weight adopted mainly for controlling the level of influence of the previous velocity on the velocity of the current iteration. c1 and c2 are the learning factors for controlling the influence of individual best experience and global

Figure 4. Two subproblems of a workflow application in grid. (a) The task-resource matching subproblem and (b) the task execution priority subproblem.

best experience on the velocity of iteration. r1 and r2 are the random numbers between 0 and 1, adopted to increase the diversity of particle movement and prevent particles from moving only toward the individual best experience or the global best experience.

makespan of the workflow application on the grid. Hence, the study of minimization of the makespan in workflow scheduling involves two issues: task-resource matching and task execution priority determination. Figure 4 illustrates an example with two heterogeneous resources (R<sup>1</sup> and R2) with different abilities in the grid environment; these two subproblems need to be solved for the studied workflow application scheduling problem. Figure 4(a) displays the task-resource matching subproblem, and Figure 4(b) indicates some possible

To deal with these issues, the constriction PSO is used to solve the task execution priority issue

PSO was first introduced by Kennedy and Ebrhart in 1995 [17]. After observing birds flying, fish seeking food, and other social behaviors of animals, they discovered that each particle would move to their next position according to information (experience) shared among the members of the swarm. Restated, when particles move, they refer to individual experience (pbest) and global experience (gbest). At each moving step, a particle will refer to both kinds of experience to make the next move. The particle represents the solution of the problem to be solved. Hence, the movement of particles is regarded as a solution search in a solution space.

� �

Each particle of a swarm has its own velocity V. The Vij represents the jth velocity component of the particle i. X is the position of the particle and Xij the jth position component of particle i. pbestij is the jth component of the best individual experience of the particle i. The gbestj is the jth component of the best global experience. w is the inertia weight adopted mainly for controlling the level of influence of the previous velocity on the velocity of the current iteration. c1 and c2 are the learning factors for controlling the influence of individual best experience and global

Figure 4. Two subproblems of a workflow application in grid. (a) The task-resource matching subproblem and (b) the

þ c2r<sup>2</sup> gbestj � Xij � �

(4)

execution priorities of the tasks (tasks 1, 3, 4, and 5) assigned to resource 1 (R1).

and the discrete PSO to cope with the task-resource matching issue.

The position update equation of PSO is as shown in Eq. (4):

ij <sup>¼</sup> Xij <sup>þ</sup> <sup>V</sup>new

ij ¼ ωVij þ c1r<sup>1</sup> pbestij � Xij

ij

Vnew

8 < :

task execution priority subproblem.

Xnew

3.1. Used PSOs

46 Particle Swarm Optimization with Applications

In this work, a constriction PSO is applied to solve the task execution priority problem. Similar to the inertia weight, a constriction factor χ was introduced into PSO to balance global and local searches, i.e., the constriction factor used to limit the movement size, and is named constriction PSO [18]. The velocity update rule used in constriction PSO is indicated in Eq. (5):

$$\begin{cases} V\_{ij}^{new} = \chi \left[ V\_{ij} + c\_1 r\_1 \left( \text{gbest} - \text{X}\_{ij} \right) + c\_2 r\_2 \left( \text{pbest}\_{ij} - \text{X}\_{ij} \right) \right] \\\ X\_{ij}^{new} = \text{X}\_{ij} + V\_{ij}^{new} \end{cases} \tag{5}$$

The discrete PSO (DPSO) was proposed by Kennedy and Ebrhart in 1997 [19]. Unlike in conventional PSO, the particle position components of the discrete PSO are binary. In other words, Xij∈(0,1). The velocity update is similar to Eq. (5), but the constriction factor is set to 1. The position vector Xij is calculated with the sigmoid function S(Vij) in conjunction with velocity vector Vij, and the real valued velocity is converted into a probability. This probability is then compared with a random number to update the position component value either 0 or 1. The position update rule for discrete PSO is displayed in Eq. (6):

$$X\_{ij}^{new} = \begin{cases} 0, & \mathcal{S}\left(V\_{ij}^{new}\right) < \text{rand} \\ 1, & \mathcal{S}\left(V\_{ij}^{new}\right) \ge \text{rand} \end{cases} \tag{6}$$

The sigmoid function is applied to convert the velocity value into a probability between 0 and 1. However, to prevent the value of S(Vij) from becoming too close to 0 or 1, the value of Vij is normally limited to between [-Vmax and Vmax]. In this study, DPSO is applied to solve the taskresource matching problem. The particle positions are designed as a two-dimensional matrix M�N. M represents the number of tasks, and N is the number of binary bits, which is the floor function of log2(resource quantity) plus 1. If the number of resources is R, N ¼ b c log <sup>2</sup>ð Þ R þ 1. In other words, Xi = [Xipq], p =1~ M, and q =1~ N. The combination of number (N) of binary numbers (after the binary values are converted to metric values) of the p row is the resource allocated for the task p. Suppose that the number of resources is 3 (R = 3), then two bits (N ¼ b c log <sup>2</sup>ð Þ3 þ 1 ¼ 2) are required.

#### 3.2. Stochastic greedy in ant colony optimization (ACO)

Stochastic greedy is greedy by chance; it has been well applied in constructing the path of ants in ant colony optimization. Ant colony optimization, which was initially introduced by Dorigo et al. in 1996 [20], imitates the foraging behavior of ants. The ACO was first applied to solve the traveling salesman problem [16, 21]. In ACO, ants lay down pheromones on the foraging paths. The deposited pheromone is the stigmergy used to communicate with ants. The amount of pheromone deposited on a particular foraging path increases with the number of ants traveling along the path. An ant foraging path corresponds to a feasible solution to the studied scheduling problem; an ant establishes a path by using a transition rule to choose nodes to visit, i.e., each movement is determined by stochastic greedy rule as displayed in Eq. (7):

$$j = \begin{cases} \arg\max\_{l \in \mathcal{J}\_k(i)} \left\{ [\pi(i,l)]^\alpha [\eta(i,l)]^\beta \right\}, & q \le q\_0 \\ J, & q > q\_0 \end{cases} \tag{7}$$

Vnew

Xnew

Figure 5. Operation procedures of the proposed scheme.

ij <sup>¼</sup> Xij <sup>þ</sup> <sup>V</sup>new

Guidanceij ¼

ij

8 < :

gbestj

ij <sup>¼</sup> <sup>χ</sup> � Vij <sup>þ</sup> <sup>c</sup><sup>1</sup> � <sup>r</sup><sup>1</sup> � Guidanceij � Xij � � � �

where q is a random number between 0 and 1. When q is larger than SGP, the particle velocity is updated in accordance with the individual best experience (pbestij); when it is smaller than SGP, the particle velocity is updated in accordance with the global best experience (gbestj). Restated, a particle has an SGP probability to search following the global experience (exploitation search) and a (1-SGP) probability to search according to individual experience distributed in solution space (exploration search). Restated, the search behavior of particles is driven by the stochastic greedy rule. The PSO using this new velocity update rule is named stochastic greedy PSO (SGPSO) herein. This SGPSO is applied only in the constriction PSO (Eq. (8)) to solve the task execution priority problem, not in the DPSO that deals with the task-resource

, q ≤ SGP exploitation � �

Stochastic Greedy-Based Particle Swarm Optimization for Workflow Application in Grid

http://dx.doi.org/10.5772/intechopen.73587

(8)

49

pbestij, q <sup>&</sup>gt; SGP exploration � �

where τ(i, l) denotes the pheromone left on edge (i, l) and η(i, l) is the heuristic value. α and β are used to determine the relative importance between the pheromone and the heuristic value. Jk(i) represents the set of neighborhood nodes, which can be visited at node Vi by ant k. And, q0 is a predefined probability usually set to a higher value, and q is a random number between 0 and 1. The next node j to be visited is chosen from Jk(i). When q ≤ q0, the node with the highest pheromone times heuristic value is selected as the next node Vj (exploitation). If q > q0, Vj is usually determined from Jk(i) by the roulette wheel selection rule. Restated, an ant has a q0 probability to visit the node with the highest pheromone times the heuristic value and has a (1 � q0) probability to visit a node other than the node with the highest pheromone times the heuristic value (exploration).

#### 3.3. Stochastic greedy PSO (SGPSO)

This section will introduce the proposed PSO using a new velocity update rule in this study and the design philosophy behind it. In PSO, the particles always move and search for optimums in the solution space in accordance with the best individual experience and the global best experience. In this work, the global best experience in PSO is similar to the path with the highest pheromone level in ACO. Restated, gbestj in PSO is regarded as the max{[τ(i,j)]<sup>α</sup> [η(i,j)]<sup>β</sup> } in ACO. Without other guidance, PSO can lead other particles to move toward the current global best experience. As a result, the particles can achieve local optimums at an early iteration and become trapped there (local optimum). This indicates that PSO may converge quickly (premature convergence), but trapping on local optimums is likely to happen. The same situation occurs with ACO, if the ants always choose the path with the highest pheromone times the heuristic value (exploitation), it can also lead to the path of local optimum. Hence, ACO retains a certain probability and uses the roulette wheel selection rule (Eq. (7)) to allow ants to explore paths other than that with the highest pheromone so as to prevent from trapping on local optimum. In ACO, a default parameter SGP is adopted to determine the relative importance of exploitation and exploration. When the SGP value is large, exploitation of the global best path tends to occur, whereas small SGP values are more likely to result in individual exploration. To be with the adequate diversity during search, it is important for PSO to find the optimal solution. Hence, to strengthen the exploration capacity of PSO in the solution search process to keep diversity and avoid getting trapped on local optimums, the search mechanism of ACO based on the stochastic greedy rule was implemented in PSO, and hence a new velocity update rule was designed to replace the velocity update rule of referring to both experiences in Eq. (5). Thus, as a stochastic greedy probability (SGP) for global search, SGP is designed. Meanwhile, the roulette wheel selection rule used in ACO is modified, i.e., a particle references its own experience rather than using roulette wheel selection rule to reference other particle's experiences. The design of the proposed velocity update rule is as shown in Eq. (8):

Stochastic Greedy-Based Particle Swarm Optimization for Workflow Application in Grid http://dx.doi.org/10.5772/intechopen.73587 49

$$\begin{aligned} V\_{\vec{ij}}^{new} &= \chi \times \left[ V\_{\vec{ij}} + c\_1 \times r\_1 \times \left( \text{Guidance}\_{\vec{ij}} - \mathbf{X}\_{\vec{ij}} \right) \right] \\ X\_{\vec{ij}}^{new} &= \mathbf{X}\_{\vec{ij}} + V\_{\vec{ij}}^{new} \\ \text{Guidance}\_{\vec{ij}} &= \begin{cases} gbest\_{\vec{j}} & q \leq \text{SGP (expolitation)} \\ pbest\_{\vec{ij}} & q > \text{SGP (explotation)} \end{cases} \end{aligned} \tag{8}$$

where q is a random number between 0 and 1. When q is larger than SGP, the particle velocity is updated in accordance with the individual best experience (pbestij); when it is smaller than SGP, the particle velocity is updated in accordance with the global best experience (gbestj). Restated, a particle has an SGP probability to search following the global experience (exploitation search) and a (1-SGP) probability to search according to individual experience distributed in solution space (exploration search). Restated, the search behavior of particles is driven by the stochastic greedy rule. The PSO using this new velocity update rule is named stochastic greedy PSO (SGPSO) herein. This SGPSO is applied only in the constriction PSO (Eq. (8)) to solve the task execution priority problem, not in the DPSO that deals with the task-resource

scheduling problem; an ant establishes a path by using a transition rule to choose nodes to visit, i.e., each movement is determined by stochastic greedy rule as displayed in Eq. (7):

½ � <sup>τ</sup>ð Þ <sup>i</sup>; <sup>l</sup> <sup>α</sup>

where τ(i, l) denotes the pheromone left on edge (i, l) and η(i, l) is the heuristic value. α and β are used to determine the relative importance between the pheromone and the heuristic value. Jk(i) represents the set of neighborhood nodes, which can be visited at node Vi by ant k. And, q0 is a predefined probability usually set to a higher value, and q is a random number between 0 and 1. The next node j to be visited is chosen from Jk(i). When q ≤ q0, the node with the highest pheromone times heuristic value is selected as the next node Vj (exploitation). If q > q0, Vj is usually determined from Jk(i) by the roulette wheel selection rule. Restated, an ant has a q0 probability to visit the node with the highest pheromone times the heuristic value and has a (1 � q0) probability to visit a node other than the node with the highest pheromone

This section will introduce the proposed PSO using a new velocity update rule in this study and the design philosophy behind it. In PSO, the particles always move and search for optimums in the solution space in accordance with the best individual experience and the global best experience. In this work, the global best experience in PSO is similar to the path with the highest

Without other guidance, PSO can lead other particles to move toward the current global best experience. As a result, the particles can achieve local optimums at an early iteration and become trapped there (local optimum). This indicates that PSO may converge quickly (premature convergence), but trapping on local optimums is likely to happen. The same situation occurs with ACO, if the ants always choose the path with the highest pheromone times the heuristic value (exploitation), it can also lead to the path of local optimum. Hence, ACO retains a certain probability and uses the roulette wheel selection rule (Eq. (7)) to allow ants to explore paths other than that with the highest pheromone so as to prevent from trapping on local optimum. In ACO, a default parameter SGP is adopted to determine the relative importance of exploitation and exploration. When the SGP value is large, exploitation of the global best path tends to occur, whereas small SGP values are more likely to result in individual exploration. To be with the adequate diversity during search, it is important for PSO to find the optimal solution. Hence, to strengthen the exploration capacity of PSO in the solution search process to keep diversity and avoid getting trapped on local optimums, the search mechanism of ACO based on the stochastic greedy rule was implemented in PSO, and hence a new velocity update rule was designed to replace the velocity update rule of referring to both experiences in Eq. (5). Thus, as a stochastic greedy probability (SGP) for global search, SGP is designed. Meanwhile, the roulette wheel selection rule used in ACO is modified, i.e., a particle references its own experience rather than using roulette wheel selection rule to reference other particle's experiences. The design of the

pheromone level in ACO. Restated, gbestj in PSO is regarded as the max{[τ(i,j)]<sup>α</sup> [η(i,j)]<sup>β</sup>

J, q > q<sup>0</sup>

<sup>½</sup>ηði; <sup>l</sup>Þ�<sup>β</sup> � �, q <sup>≤</sup> <sup>q</sup><sup>0</sup>

(7)

} in ACO.

<sup>j</sup> <sup>¼</sup> arg max <sup>l</sup> <sup>∈</sup>Jk ð Þ<sup>i</sup>

8 < :

times the heuristic value (exploration).

48 Particle Swarm Optimization with Applications

3.3. Stochastic greedy PSO (SGPSO)

proposed velocity update rule is as shown in Eq. (8):






Figure 5. Operation procedures of the proposed scheme.

matching problem. The operation procedures of the proposed scheme of applying SGPSO and DPSO to solve the interested workflow application scheduling problem in the grid are listed in Figure 5.

## 3.4. The diversity of SGPSO

The diversity of the swarm during moving in the solution space impacts the solution quality. High diversity of the particles in the initial stage is desired for possible most solution space to find a good seed of search. Conversely, in the latter stage, the particles ought to proceed fine search for the better solution, i.e., low diversity of the population should be provided. To analyze the diversity of the SGPSO, the diversity (DIV) of a particle swarm is defined by the average absolute distance of whole particles as given in Eq. (9) [22]:

$$\begin{aligned}DIV &= \sum\_{i=1}^{N-1} \sum\_{j=i+1}^{N} \frac{Dis(X\_i, X\_j)}{C\_2^N} \\ Dis(X\_i, X\_j) &= \sum\_{k=1}^{D} |X\_{ik}, X\_{jk}| \end{aligned} \tag{9}$$

Devð Þ¼ % <sup>X</sup>

Avg:Devð Þ¼ %

Table 1. Grid environment example.

15 0 0

Table 2. A workflow application example of J14.

i∈ instances

X t¼1�T FITi � besti besti

Devð Þ %

Resources MIPS Bandwidth

Task No. Workload No. of successors Successors Communication cost

 0 3 123 000 35,000 2 4 5 14 12 7000 2 5 9 5 3 5000 2 9 13 7 2 28,000 3 6 7 11 11 17 6 20,000 3 8 11 14 13 11 13 18,000 3 9 10 14 11 16 13 4000 2 8 14 7 13 27,000 2 10 12 3 3 4000 1 12 17 19,000 1 13 3 32,000 2 12 13 4 4 31,000 1 15 13 16,000 1 15 11 22,000 1 15 3

T

R<sup>1</sup> 450 8 R<sup>2</sup> 1000 2 R<sup>3</sup> 650 10 R<sup>4</sup> 1500 8 R<sup>5</sup> 800 10 R<sup>6</sup> 4000 2 R<sup>7</sup> 2000 15 R<sup>8</sup> 1250 6 R<sup>9</sup> 250 20 R<sup>10</sup> 750 5

� 100% � �=∣instances<sup>∣</sup>

Stochastic Greedy-Based Particle Swarm Optimization for Workflow Application in Grid

http://dx.doi.org/10.5772/intechopen.73587

(10)

51

where Dis(Xi, Xj) is the absolute distance between particles Xi and Xj. D is the dimension of the particle, and N is the number of particles.
