Skip to main content
. 2025 Jul 30;25(15):4705. doi: 10.3390/s25154705
Algorithm 1 Workflow scheduling Based on HEFT
Input: the workflow Dag=(T,E), W[i][k], B[k][l]
Output: A task_list sorted in descending order of Upward rank, the allocation of task to VM
       for each task ti in T do
               rank_u[ti] ← 0
       end for
       for each task ti in reverse topological order of Dag do
               Obtain the average computation time wi¯ using Equation (17)
               if succ(ti) is empty then
                      rank_u[ti] wi¯
               else
                      Obtain the maxtjsucc(ti)(ci,j¯+ranku(tj)) by Equations (18)–(20)
                      Update the ranku(tj) by Equation (21)
               end if
          end for
       task_list ← []
       temp_list ← sort T by ranku(tj) in descending order
       while temp_list is not empty do
               for each task ti in temp_list do
                       all_pred_scheduled ← true
                       for each predecessor task tk of ti do
                               if tk not in task_list then
                                    all_pred_scheduled ← false
                                    break
                               end if
                       end for
                       if all_pred_scheduled then
                               task_list.append(ti)
                               temp_list.remove(ti)
                               break
                       end if
               end for
       end while
return task_list
       allocation ← {}
       machine_ready_time ← [0, 0, …, 0]
       for each task ti in task_list do
               earliest_finish_time ← ∞
               selected_machine ← −1
               for each machine k in Machines do
                       Calculate Sta_Tk,i of ti on VMk
                       Calculate Fin_Tk,i of ti on VMk
                       Update the selected_machine based on earliest completion time
               end for
               Assign ti to the selected_machine VMk
               Add this assignment to the allocation
               update the ready time of VMk
       end for
       return allocation