Skip to main content
. 2022 Dec 1;8:e1170. doi: 10.7717/peerj-cs.1170

Algorithm 3. GA-based dynamic route planning algorithm.

Input: d, edvd, P, c, DR, c_rate, m_rate;
Output: TDD, DR, ddk, k1,2,,K;
for i in range(len(DR)):
  chrome=DR[i].
  for k in range(len(chrome)):
    Obtain real-time road congestion coefficient matrix: conMatrix.
    if (conMatrix[chrome[k]-1,chrome[k+1]-1]<= β):
      continue.
    pop = [ ].
    Initialize the population.
    j=1
    while j <= (len(chrom)-k) * 2:
      selection, crossover and mutation
      Obtain driving distances of all individuals and calculate their driving times according to c.
      fitness evaluation: calculate the fitness of all individuals in the population.
      if fitness of the optimal individual in each generation is greater than the global optimal.
        Update the information of the global optimal individual.
      Update the population.
      j++
    obtain the next stop of the ith EDV.
  obtain the DRi of the i-th EDV.
return TDD, DR, ddk