Skip to main content
. 2022 Nov 4;19(21):14469. doi: 10.3390/ijerph192114469
Algorithms 1. Airport shuttle bus route based on dynamic programming.
Input N: Number of selected stations, C: Coordinates of selected stations, dispatch center and airport.
Output Shortest airport shuttle bus route.
Algorithm
flowchart
  yield selected station collection T and visited station collection V
  //calculate the distance between the dispatch center and each selected station and store the
  results in array D
  for t ∈ T do
    D [1<<(t−1)][t] ← Distance(dispatch center to t)
  end for
  //calculate the distance when all remaining selected stations are visited.
  For V ∈ [0, 1, 2,…, (2N − 1)] do
    for t ∈ T do
      if t has not already visited then
        for previous ∈T do
          if previous has been already visited then
            D[V|(1<<(t − 1))][t] ← min(D[V][previous]+Distance(previous to t),
            D[V|(1<<(t − 1))][t]
          end if
        end for
      end if
    end for
  end for
  //calculate the distance between the last selected station and airport
  min_D ← Infinite
  for previous ∈T do
    min_D ← min(D[2N − 1][previous]+Distance(previous to airport),min_D)
  end for