Skip to main content
. 2023 Jul 2;23(13):6095. doi: 10.3390/s23136095
Algorithm 4 Genetic-Algorithm-Based Allocation.
  • 1:

    Find |M| clusters and centroid

  • 2:

    Init-UAV-placement(xm,ym,zm) ← centroid

  • 3:

    LB ← [xmrnggymrngghmin]

  • 4:

    UB ← [xm+rnggym+rngghmax]

  • 5:

    Genetic algorithm’s parameters ← default

  • 6:

    Find UAVs’ placement using the genetic algorithm with the objective to maximize the total throughput, which is the output of the following function.

  • 7:

    7:

  • 8:

    Function Throughput-calculation

  • 9:

    Throughput = zeros(|M|+1,|U|)

  • 10:

    for  m=1to|M|  do

  • 11:

        Throughput(m,:) = NLoS throughput Formula (8), using positions given by one generation of the genetic algorithm.

  • 12:

    end for

  • 13:

    Throughput(|M| + 1, :) = LoS throughput Formula (5), using positions given by one generation of the genetic algorithm

  • 14:

    A = zeros(|M|+ 1, U), Throughput-temp = Throughput

  • 15:

    while sum(A)<|U| do

  • 16:

        Find max(Throughput-temp) & its index-x and index-y

  • 17:

        A(index-x,index-y) = 1

  • 18:

        Delete Throughput-temp(:,index-y)

  • 19:

        if index-x ≤ |M|& sum(A(index-x,:)) = Nmax then

  • 20:

            Delete Throughput-temp(index-x, :)

  • 21:

        end if

  • 22:

    end while

  • 23:

    Total-throughput = sum(Throughput ⊙ A)

  • 24:

    return Total-throughput

  • 25:

    Endfunction