Skip to main content
. 2018 Feb 25;18(3):685. doi: 10.3390/s18030685
Algorithm 1 Algorithm for appliance scheduling
Variables:
 R: collection of requests
 k: request where k∈R
 I(k): theoretical appliance power consumption corresponding to request k
 pwr: total power consumption of accepted requests
 L: maximum power consumption threshold
Goal: Initialize the request set (R) in descending order of heuristic value
  pwr=0
  for all k∈R do
   if task is non-preemptive and operational then
    accept request k
    remove request k from R
    pwr=pwr+I(k)
   end if
  end for
  for all k∈R do
   if pwr+I(k)≤L and request k is operational then
    accept request k
    remove request k from R
    pwr=pwr+I(k)
   end if
  end for
  for all k∈R do
   if pwr+I(k)≤L then
    accept request k
    remove request k from R
    pwr=pwr+I(k)
   end if
  end for