Research Article

Inverting the Truck-Drone Network Problem to Find Best Case Configuration

Algorithm 1

Evolutionary algorithm.
DATA: a population P matrix of initially randomly generated tours where tour  = P[1, :] Size of the population is m and the length of any tour is n.
The distance function Distance (launch, deliver, rendezvous) determines the total distance between the nodes in the
RESULT: an ∼ optimal tour for the nodes [1 : n].
FOR iter 1 to Budget LOOP
FOR p in m LOOP (for each population of tours)
   ⟵ P[p, :]; (a tour within the population of tours)
   ⟵ P[p, 1 : n, 1, 2, 3]; (add wrap back around to depot to tour)
   ⟵ 0; (initialize total tour time for this tour)
  WHILE i ≤ n DO (go through each of the nodes in tour)
   case ⟵ 1; (initialize default case: truck carries drone and delivers)
   launch ⟵  (i); (truck launch node)
   deliver ⟵  (i + 1); (drone delivery node)
   rendezvous ⟵  (i + 1); (truck and drone rendezvous node)
   launch fathom ⟵  (i + 1); (check next operation truck launch node)
   deliver fathom ⟵  (i + 2); (check next operation drone delivery node)
   rendezvous fathom ⟵  (i + 3); (check next operation truck/drone rendezvous node)
   drone dist ⟵ Distance (launch, deliver, rendezvous)
   truck dist ⟵ Distance (launch, , rendezvous)
   IF drone dist <range AND i + 1 ≤ n THEN
    case ⟵ 2;
    fathom 1 ⟵ max[(drone dist)/(drone speed), (truck dist)/(truck speed)]
    drone dist 2 ⟵ Distance (fathom launch, fathom deliver, fathom rendezvous)
    truck dist 2 ⟵ Distance (fathom launch, , fathom rendezvous)
    fathom 2 ⟵ max[(drone dist 2)/(drone speed), (truck dist 2)/(truck speed)]
    IF drone dist 2 < range AND fathom 2 < fathom 1 AND i + 2 ≤ n THEN
     case ⟵ 1; (save drone for next operation, set to truck deliver for this iteration)
     drone dist ⟵ 0; (no drone distance)
    END IF
   ELSE
     drone dist ⟵ 0; (out of drone range…)
   END IF
  SWITCH CASE
   CASE == 1 (truck delivers)
    truck dist := Distance (launch, , deliver); (find truck distance to next node)
    k ⟵ k + 1;
   CASE == 2 (truck and drone deliver)
    truck dist := Distance (launch, , rendezvous); (find truck distance to rendezvous)
    drone dist := Distance (launch, deliver, rendezvous); (find drone distance for operation)
    k ⟵ k + 2; (two nodes satisfied)
  END CASE
   =  + max[(drone dist)/(drone speed), (truck dist)/(truck speed)] (capture and record the total time for population member p)
  END WHILE LOOP
END FOR LOOP
P ⟵ randomly shuffle rows in population matrix P for a tournament (do not change tours)
FOR p = 5 : 5 : m LOOP (select groups comprised of 5 tours each from the population P of size m)
 Best time ⟵ Get Best Time (P[p, :]) for the group of the 5 tours
 Best Id ⟵ Find route id of the group of 5 having the best time (Best Time)
Pʹ[p1,2,3,4,5, :] ⟵ Replace all tours in population group P(p, :) with fittest tour of the 5 tours.
Pʹ [p1, :] ⟵ keep (do not mutate) the fittest tour of the group of 5 (keep for next iteration)
Pʹ[p2,3,4,5, :] ⟵ Mutate the other 4 less fit tours as follows:
  (1) tour 1: randomly select 2 points in the route Pʹ[p2, :] to swap
  (2) tour 2: randomly select 2 points Pʹ[p3, :]to reverse all nodes in between
  (3) tour 3: randomly select 2 points in route Pʹ[p4, :]to slide to left and replace last with first
  (4) tour 4: replace the first and last nodes Pʹ[p5, :]with two randomly selected nodes
END FOR LOOP
P ⟵ update P with all mutations P
END FOR LOOP
RETURN best and best route found in population