| Input: order , current state S, optimal matched group . | | Output: single move plan , set of exchange demands D. | (1) | Initialize, , | (2) | whiledo | (3) | ifthen | (4) | Item type qi in is unmatched, type(d) = qi | (5) | = MPOCS(S, ip, next(ip), 1), = MPOCS(S, ip, previous(ip), -1) | (6) | | (7) | , , update , | (8) | elseifandandthen | (9) | foreach | (10) | = MPOCS(S, slot(s), ip, 1), = MPOCS(S, slot(s), ip, −1) | (11) | , , | (12) | , , update , | (13) | end foreach | (14) | end if | (15) | | (16) | end while | (17) | return , D |
|