4.3 Bi-objective Evolutionary Algorithm
5.1.1.2 Mutation operators
The two basic functions SelectCustomer() and InsertCustomer() described above are used by the following new mutation operators.
Reallocate(rk, R) This operator removes a sequence of customers from route rk = hv1, . . . , vNki and allocates them to any other route rj ∈ R. First, function
SelectCustomer(rk) is used to choose two customers vi and vj from route rk. These are removed from the route, along with the sequence hhvi+1, . . . , vj−1ii of
all those customers in between them, and collected in q = hhvi, vi+1, . . . , vj−1, vjii.
Then, InsertCustomer(vi) attempts to reallocate all removed customers vi ∈ q
into any of the existing routes rj ∈ R. If customer vi ∈ q could not be reallocated,
it is reinserted into route rk. This operation is shown in Algorithm 5.2.
An example of this operator is illustrated in Figure 5.1. In this example, customers 5 and 8 were selected from the route on the right and the sequence hh5, 6, 8ii was removed from the route. Then, the operator attempted to insert those customers into the route on the left, however, due to capacity or time constraints, the insertion of customer 5 was the only successful move. Customers 6 and 8 were reinserted into their original route.
Figure 5.1: Example of the reallocate mutation operator: It selects customers 5 and 8, and removes the sequence hh5, 6, 8ii from the route on the right. Then, attempts to reinsert them into the route on the left, however, only customer 5 is successfully inserted. Customers 6 and 8 are returned to their original route.
Exchange(rk, rl) In this operation, two sequences of customers qk and ql extrac- ted from routes rk and rl, respectively, are swapped. First, SelectCustomer(rk)
chooses two customers vi and vj from route rk. These customers and the sequence of
customers hhvi+1, . . . , vj−1ii in the middle of them are then removed from rk and col-
lected in qk = hhvi, vi+1, . . . , vj−1, vjii. The same procedure is performed for route
rl. Then function InsertCustomer(vi, rl) attempts to reallocate all customers
vi ∈ qk into route rl. If customer vi cannot be inserted into the other route due to
the capacity or time constraints, InsertCustomer(vi, rj) is applied to attempt to
insert them into the other existing routes rj ∈ R. The same process is repeated for
all customers vi ∈ ql and route rk. Algorithm 5.3 presents this operator.
An example is shown in Figure 5.2, where customers 5 and 8 are selected from the route on the right and customers 10 and 2 from the route in the left. Then, sequences hh5, 6, 8ii and hh10, 1, 2ii are removed from their routes. After the attempt to insert customers 5, 6 and 8 into the route on the left, and customers 10, 1 and 2 into the route on the right, the only feasible insertions were customers 5 and 10, all other customers were returned to their original routes.
Algorithm 5.3: Exchange(rk, rl, R)
Input: Routes rk = hv1, . . . , vNki, rl= hu1, . . . , uNli ∈ R which are going to exchange customer 1: for m = k, l do
2: vi← SelectCustomer(rm)
3: vj← SelectCustomer(rm)
4: Remove qm= hhvi, vi+1, . . . , vj−1, vjii from rm
5: end for 6: for m = k, l and n = l, k do 7: for allvi∈ qmdo 8: InsertCustomer(vi, rn) 9: end for 10: end for 11: for m = k, l do 12: for allvi∈ qmdo 13: inserted ← false
14: for allrj ∈ R \ {rm} and while inserted = false do
15: inserted ← InsertCustomer(vi, rj)
16: end for
17: if inserted = false then 18: InsertCustomer(vi, rm)
19: end if
20: end for 21: end for
Figure 5.2: Example of the exchange mutation operator: It selects customers 5 and 8 from the route on the right and customers 10 and 2 from the route on the left. Then, it removes sequences hh5, 6, 8ii and hh10, 1, 2ii from their routes. After the attempt to insert customers 5, 6 and 8 into the route on the left, and customers 10, 1 and 2 into the route on the right, the only feasible insertions are customers 5 and 10, all other customers are returned to their original routes.
Figure 5.3: Example of the reposition mutation operator: It selects customer 7 to be repositioned. Then, customer 7 is removed from the route and reinserted between customers 6 and 8.
Reposition(rk) This operation makes use of function SelectCustomer(rk) to select one customer vi from route rk, and calls InsertCustomer(vi, rk) to reinsert
viinto rk in the position where the shortest distance is achieved. Note that customer
vi can always be reinserted into route rk, since route rk was feasible before vi was
removed. Figure 5.3 presents an example of this operator. Here, customer 7 was selected to be repositioned. Then, it was removed from the route and reinserted between customers 6 and 8.
The overall mutation stage is described in Algorithm 5.4 and proceeds as follows. First, two routes rk and rl are chosen using function SelectRoute(R). If the se-
lected routes are the same, i.e. rk = rl, Reallocate(rk, R) is performed, otherwise
function Exchange(rk, rl, R) is called. Finally, rk = SelectRoute(R) and then
Reposition(rk) are executed.
These were the modifications made to the mutation stage of the redesigned MOEA, with the aim of enhancing this process and, consequently, the algorithm’s perfor- mance. The new mutation, which operates according to the inherent objective functions values of the solutions, represents one of the main contributions of this thesis.
Algorithm 5.4: Mutate(R)
Input: Solution R to be mutated Output: Mutated solution R′
1: R′← R 2: rk← SelectRoute(R′) 3: rl← SelectRoute(R′) 4: if rk = rl then 5: Reallocate(rk, R′) 6: else 7: Exchange(rk, rl, R′) 8: end if 9: rk← SelectRoute(R′) 10: Reposition(rk) 11: return R′