Skip to main content
. 2021 Oct 15;21(20):6862. doi: 10.3390/s21206862
Algorithm 1 Online algorithm for sensor selection with sensing schedules.

Inputs:xlj, πl, Sm, Em, EGj, DGjaGi

 xlj: the current context state of the user contexts l=1,2,,L

  From CRM KB:

πl: the set of possible sensor groups G for each of the requested L contexts

Sm: the available sensors

Em: the energy consumption by each sensor Sm

  From LUT:

EGj: the pre-computed energy consumption for each group of sensors G in recognizing context state xlj

DGj: the pre-computed delay of each sensor group G in recognizing context state xlj

aGi: the pre-computed optimized sensing schedules for the sensor groups in πl in recognizing each context state.

Output:yG, aGi

  yG: The boolean variable representing the selected sensor groups to recognize multiple contexts states xlj

  aSmi: Sensing schedules corresponding to the sensors of the selected group including the synchronized schedules

  • 1:

    Derive all the possible union of sensor groups lG available in πl

  • 2:

    for each lG do

  • 3:

      for each SmlG do

  • 4:

        if SmG then

  • 5:

         Assign aGi obtained from the LUT to Sm of group G as aSmi

  • 6:

        else if SmGwl & Gql for wq then

  • 7:

         Synchronize sensing schedules aGwli & aGqli and assign to Sm as aSmi

  • 8:

        end if

  • 9:

      end for

  • 10:

      Calculate objective function values according to equation (2)

  • 11:

      Track sensors SmlG and sensing schedules aSmi with minimum objective function value according to equation (2)

  • 12:

    end for

  • 13:

    Return sensors SmlG with yG=1 and the corresponding sensing schedules aSmi having the minimum objective value

  • 14:

    if state xlj changes to xlj¯ then

  • 15:

      Record time spent in changed context state xlj

  • 16:

    end if