Research Article

Reoptimization Heuristic for the Capacitated Vehicle Routing Problem

Pseudocode 2

Local search reoptimization algorithm.
1 For each route in routes do:
2     mov = NULL; node1 = NULL, node2 = NULL, delta = +inf
3     For each  n1, n2 in routes  do:
4           if  cost-insertion(n1, n2) < delta,  then
5             mov = insertion; node1 = n1; node2 = n2; delta = then cost-insertion(n1, n2)
6           if  cost-swap(n1, n2) < delta,  then
7             mov = swap; node1 = n1; node2 = n2; delta = then cost-insertion(n1, n2)
8             if  temporal dispersion < initial dispersion  then:
9     if  delta <= 0 and mov == insertion,  then
10       apply-insertion(node1, node2)
11    if  delta <= 0 and mov == swap,  then
12        apply-swap(node1, node2)
13 End