(1) if    then
(2) return
(3) else
(4) 
(5) while    do
(6)  swap(, )
(7)  for each action plan of the th unit
(8)   execute the current plan
(9)   call  
(10)   cancel this plan and rollback to the previous state
(11)  end for
(12)  swap(, )
(13)  
(14) end while
(15) end if
Algorithm 5: Recursive enumeration algorithm: (search action plans from th to the last unit).