Skip to main content
. 2022 Sep 19;22(18):7085. doi: 10.3390/s22187085
Algorithm 1: Genetic algorithm-based device association strategy
  • 1:

    Input: Device set I, UAV set U, ground 5G base station set B and channel state information.

  • 2:

    Output: Optimal device association strategy {xu(t),xb(t)}.

  • 3:

    Initialize: Population size Nnumber, crossover probability pCrossover, mutation probability pMutation, maximum number of iterations Niteration and f=1.

  • 4:

    Random generate initial population Jf.

  • 5:

    repeat

  • 6:

    for each population individual in Jf do

  • 7:

       Calculate the fitness function using (12).

  • 8:

    end for

  • 9:

    Selective manipulation of individuals using elitist retention strategies and roulette wheel strategies.

  • 10:

    Replication of elite individuals into the next generation of populations.

  • 11:

    For all parental chromosomes that are selected, a set of two is used, and each set is crossed over according to the crossover probability pCrossover to generate new offspring to be added to the next generation population.

  • 12:

    According to pMutation, genes in the chromosomes of non-elite individuals of the parent are mutated, and the mutated individuals are inserted into the next generation population.

  • 13:

    Combining lines 8–11 yields the new generation of populations Jf+1.

  • 14:

    f=f+1.

  • 15:

    until f>Niteration.

  • 16:

    Return {xu(t),xb(t)}.