#!/bin/bash

# Testujeme vsechny matice po dobu jedne hodiny (t=3600) pri pouziti discardingu

matice[0]="c1908"
matice[1]="s838_1"
matice[2]="s9234.1_1"

sel[0]="3"
sel[1]="4"
sel[2]="4"

pop[0]="3000"
pop[1]="1000"
pop[2]="150"

cros[0]="0.5"
cros[1]="0.7"
cros[2]="0.5"

mutation[0]="0.002"
mutation[1]="0.01"
mutation[2]="0.002"

pr[1]="0"
pr[2]="0.02"
pr[3]="0.5"

m=2
while [ "$m" -le 2 ];
do

  n=1
  while [ "$n" -le 3 ];
  do

    filename="6_pnt_${n}_${matice[$m]}"

echo "matrix-C                                matrix/${matice[$m]}_s.pat" > $filename
echo "matrix-T                                matrix/${matice[$m]}_d.pat" >> $filename
echo "estimate-population-size                0" >> $filename
echo "max-duration                            180" >> $filename
echo "population-size                         ${pop[$m]}" >> $filename
echo "max-generations                         10000" >> $filename
echo "bad-generations-to-terminate(pt)        5" >> $filename
echo "selection-parameter(ps)                 ${sel[$m]}" >> $filename
echo "use-threshold                           1" >> $filename
echo "crossover-method                        0" >> $filename
echo "crossover-probability(pc)               ${cros[$m]}" >> $filename
echo "use-discarding                          1" >> $filename
echo "mutation-matches-probability(pm)        ${mutation[$m]}" >> $filename
echo "mutation-rank1-probability(pr1)         0" >> $filename
echo "mutation-rank2-probability(pr2)         ${pr[$n]}" >> $filename
    

    mkdir "_$filename"
    ./gcma2 $filename
    
    n=$(expr "$n" + 1)

  done
  
  m=$(expr "$m" + 1)

done

