Research Article

Weighted Constraint Satisfaction for Smart Home Automation and Optimization

Algorithm 1

Recursive search for optimized plan.
Result:
Upper bound (global variable) ;
Current cost ;
Sequence index ;
State initialized;
Activity sequence set to empty;
Store all relevant activities in ;
note: Recursion starts
Function ;
if    then
     if    then
     Update ;
     ;
     ;
     end
else
     for      do
     if  
     then
       ;
       note: Store the estimated lower bound if activity is applied.
           returns the weight of activity ;
      else
       ;
       note: Or else set the lower bound to ;
     end
     end
     ;
     note: Sort in ascending order based on their lower bound;
     for  Loop through    do
     note: Looping through the sorted list;
      ≔ Lower bound of current selection;
      ≔ Activity of current selection;
      ≔ State after the effect of ;
     ;
     if    then
           Break the loop;
     else
           ;
           ;
     end
     end
end