Skip to main content
. 2025 Apr 16;25(8):2502. doi: 10.3390/s25082502
Algorithm 4 Generate  Tasks
Input:
  • M: Number of existing tasks to be generated.

  • Q: Number of new tasks to be generated.

  • mpS: Width of the simulation map.

  • dist: Task distribution across the map, which can be random, concentrated, or predetermined.

Output:
  • T: Set of defined tasks, including their coordinates, arrival time, reward, and duration.

  • 1:

    for j=1 to M do

  • 2:

        Generate initial coordinates (xj,yj,zj) for Tj based on mpS and dist.

        coordj(xj,yj,zj).

  • 3:

        Generate arrival time, end time, duration, and reward for Tj:

         [tsj,tej] Random arrival time and end time.

        Dj Random duration.

        Rj Random reward.

  • 4:

    end for 

  • 5:

    for q=1 to Q do

  • 6:

        Generate initial coordinates (xq,yq,zq) for nTq based on mpS and dist.

         coordq(xq,yq,zq).

  • 7:

        Generate arrival time, end time, duration, and reward for nTq:

         [tsq,teq] Random arrival time and end time.

         Dq Random duration.

         Rq Random reward.

  • 8:

    end for

  • 9:

    Set nT as global data.