Skip to main content
. 2025 Aug 22;10(9):560. doi: 10.3390/biomimetics10090560
Algorithm 1 GPSPositiveBasis2N algorithm

Require:

   Objective function FObj

   Initial point x0Rn

   Lower bound LoB, upper bound UpB

   Initial step size Δ0>0, tolerance τ>0

   Maximum iterations Kmax

Ensure: Optimal solution x*, optimal value f*

  •  1:

    xbestx0

  •  2:

    fbestFObj(xbest)

  •  3:

    ΔΔ0

  •  4:

    Generate positive basis D=InInT

  •  5:

    for k=1Kmax do

  •  6:

          improvedfalse

  •  7:

          for each direction diD do

  •  8:

                xcandxbest+Δdi

  •  9:

                xcandclip(xcand,LoB,UpB)

  • 10:

               fcandFObj(xcand)

  • 11:

               if fcand<fbest then

  • 12:

                   xbestxcand

  • 13:

                   fbestfcand

  • 14:

                   improvedtrue

  • 15:

              end if

  • 16:

          end for

  • 17:

          if improved then

  • 18:

                Δ1.5Δ               ▷ Step expansion

  • 19:

          else

  • 20:

                Δ0.5Δ             ▷ Step contraction

  • 21:

          end if

  • 22:

          if Δ<τ then

  • 23:

                break

  • 24:

          end if

  • 25:

    end for

  • 26:

    return xbest,fbest