Research Article

Construction Example for Algebra System Using Harmony Search Algorithm

Algorithm 4

The pseudocode of the proposed algorithm INGHS.
  %%% worst is the index of the worst harmony in HM
For to D
  If rand(0, 1)  <  
    % Random playing: randomly select any pitch within bounds
    
  Else
    If rand(0, 1)  <  HMCR
      % Memory considering: randomly select a note stored in HM
      
      If rand(0, 1)  <  PAR
       % Pitch adjusting: randomly adjust the pitch slightly
       
      EndIf
    ElseIf rand(0, 1)  <  NGP %
       
       
    EndIf
  EndIf
EndFor% Finished improvising a new harmony