Research Article

State-Based Switching for Optimal Control of Computer Virus Propagation with External Device Blocking

Algorithm 1

Algorithm of the optimal control.
Input: , , , , , , , , , , and
Output: and
Divide the into subintervals for .
for    to    do
,
if  
  break
else
  for    to    do  % find index of for
   if    and  
    
    break
   end if
  end for
   for
  
  do
   ,
   
   Calculate , , , , with and   %  forward
   Calculate with for   %  backward
   Calculate , with
  until    or  
   % is a given sufficiently small positive constant
   % is the maximum number of iterations
end if
end for