Skip to main content
. 2025 May 14;27(5):524. doi: 10.3390/e27050524
Algorithm 2: SearchoptimalP
Input:
    popt: optimal solution in P
    pi: the i-th solution P
Optimization:
    1: popt⟵p1
    2: for i=2 to P do
    3:   if GRpi<GRpopt then
    4:     popt⟵pi
    5:   else if GRpi=GRpopt then
    6:     if GCDpi<GCDpopt then
    7:       popt⟵pi
    8:     else if GCDpi=GCDpopt then
    9:       if GCPDpi<GCPDpopt then
    10:          popt⟵pi
    11:       end if
    12:     end if
    13:   end if
    14: end for
Output:
         popt