Skip to main content
. 2021 Jan 14;23(1):108. doi: 10.3390/e23010108
Algorithm 1. High-level pseudo-code of the genetic-hierarchical algorithm.
Genetic_Hierarchical_Algorithm Procedure;
/ input: n—problem size, A, B—data matrices,
/     PS—population size, Ngen—total number of generations,
/    InitPopVar—initial population variant, SelectVar—parents selection variant, CrossVar—crossover variant,
/     MutVar—mutation variant, RepVar—population replacement variant,
/    σ—selection factor, DT—distance threshold, Lidle_gen—idle generations limit
/ output: p—the best found solution (final solution)
begin
 / create a starting population P of size PS, depending on the initial population variant
InitPopVar
 switch (InitPopVar)
  1: create the initial population P by applying the algorithm
           k-Level_Hierarchical_Iterated_Tabu_Search;
  2: create the initial population P by applying a copy of
           Genetic_Hierarchical_Algorithm using InitPopVar = 1
endswitch;
p = GetBestMember(P); / initialization of the best so far solution
for i := 1 to Ngen do begin / main loop
  sort the members of the population P in the ascending order of the values of the
         objective function;
  select parents p′, p″ ∈ P for reproduction (crossover), depending on the selection
         variant SelectVar and the selection factor σ;
  perform the crossover operator on the solution-parents p′, p
         and get the offspring p″′, taking into account the crossover variant CrossVar;
  apply improvement procedure k-Level_Hierarchical_Iterated_Tabu_Search
         to the offspring p″′, get the (improved) offspring p;
  get new population P from the union of the existing parents’
         population and the offspring P ∪ {p} (such that |P| = PS)
         (the minimum distance criterion and population replacement variant RepVar
         are taken into account);
  if z(p) < z(p) then p = p; / the best found solution is memorized
  if number of idle generations exceeds the predefined limit Lidle_gen then begin
    perform the population restart process;
    if z(GetBestMember(P)) < z(p) then p = GetBestMember(P)
   endif
  endfor;
  return p
end.