/* HM initialization */
for (; ;  ++)
for (; ; ++)
  Randomly initialize in HM.
endfor
endfor
/* End of HM initialization */
Repeat
 /* Construction and evaluation of new solution candidate   */
for (; ; ++)
if (rand(0, 1) < HMCR)
  Let in be the jth dimension of a randomly selected HM member.
    if (rand(0, 1) < PAR)
    Apply pitch adjustment distance bw to mutate :
     .
    endif
else
  Let in be a random value.
endif
endfor
 Evaluate the fitness of : .
 /* End of construction and evaluation of new solution candidate   */
 /* HM update */
if ( is better than the fitness of the worst HM member)
  Replace the worst HM member with .
else
  Disregard .
endif
 /* End of HM update */
Until a preset termination criterion is met.
Algorithm 1: Pseudocode of HS method.