Skip to main content
. 2024 Apr 9;24(8):2386. doi: 10.3390/s24082386
Algorithm 1 Solve TSP by using simulated annealing algorithm
  • Input: 

    The coordinates of CH nodes li

  • Output: 

    The sequence of CH nodes lnew

  •   1:

    Initialize maximum iteration temperature K0=50,000, the sequence of CH nodes li, and annealing coefficient q=0.98.

  •   2:

    KK0.

  •   3:

    while K>K0 do

  •   4:

       Swap the order of any two nodes to generate a new visiting sequence lnew.

  •   5:

       Calculating lnew, denoted as df.

  •   6:

       if df>0 then

  •   7:

         if exp(dfK0)>rand(0,1) then

  •   8:

            lflnew

  •   9:

         end if

  • 10:

       else

  • 11:

         K=K×q

  • 12:

       end if

  • 13:

    end while