| |
| |
| FOR iterations in budjet LOOP |
| FOR each (i) population member LOOP |
| Routei ⟵ a tour within the populations of tours |
| launch ⟵ Routei (1) first node; |
| rendezvous ⟵ Routei (2) second node; |
| candidate ⟵ Routei (3) third node; |
| drone count ⟵ 0; |
| route time ⟵ 0; |
| WHILE candidate ≤ total delivery nodes DO |
| truck op time ⟵ get truck time (launch, rendezvous); |
| drone op time ⟵ get drone time (launch, candidate, rendezvous); |
| drone op dist ⟵ get drone distance (launch, candidate, rendezvous); |
| IF candidate ≥ total delivery nodes THEN |
| IF drone count ≥ number drones avail.OR drone op dist. > drone range THEN |
| Max op time = max (truck op time, drone op time, multiple drone op time); |
| route time ⟵ route time + max op time + truck op time; |
| route time ⟵ route time + get truck time (candidate depot); |
| ELSE (drone makes last delivery) |
| Max op time = max (truck op time, drone op time, multiple drone op time); |
| Route time ⟵ route time + max op time + get truck time (rendezvous, depot); |
| END IF |
| BREAKwhile loop; |
| END IF |
| IF drone count ≥ number drone avail OR drone dist. > drone range THEN |
| Max op time ⟵ max (truck op time, multiple drone op time); |
| Route time ⟵ route time + max op time; |
| Launch ⟵ rendezvous; |
| rendezvous ⟵ candidate; |
| candidate ⟵ min (Routei(candidate + 1), total number stops); |
| drone count ⟵ 0; |
| multi drone op time ⟵ 0; |
| ELSE (assign delivery to drone) |
| max op time ⟵ max (truck op time, drone op time, multiple drone op time); |
| route time ⟵ route time + max op time |
| candidate ⟵ Routei(candidate + 1); |
| drone count ⟵ drone count + 1; |
| multi drone op time(drone count) ⟵ drone op time; |
| END IF |
| List of all Route Times (p) route time; |
| END WHILE |
| END FOR (each population member) |
| Population randomly shuffle among the tours in population, keep routes intact |
| FOR each of five tours in population LOOP through, keep tournament winners, mutate losers |
| Best time, Id, Best Route Get Fittest Member tour of tournament of 5; |
| Overwrite each of the four less fit tours with the fittest member; |
| Mutate first of the four less fit tours by random swap; |
| Mutate second of the four less fit tours by random segment slide; |
| Mutate third of the four less fit tours by random segment flip; |
| Mutate fourth of the four less fit tours by swapping last node in tour with any other |
| Do nothing for fifth tour; keep the fittest tour intact; |
| END FOR mutations and tournament winners |
| Population update old Population with new Population mutations and winners |
| END FOR total budget exhausted |
| RETURN overall best tour in population (time, route) and graph route; |