#!/bin/bash

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

matice[0]="c2670_x1"
matice[1]="c2670_x2"
matice[2]="c7552_x1"
matice[3]="c7552_x2"
matice[4]="s13207_x1"
matice[5]="s13207_x2"
matice[6]="s38417_2"
matice[7]="s838_x1"
matice[8]="s838_x2"
matice[9]="s9234_x1"
matice[10]="s9234_x2"

pop[0]="300"
pop[1]="500"
pop[2]="150"
pop[3]="150"
pop[4]="15"
pop[5]="4000"
pop[6]="30"
pop[7]="500"
pop[8]="800"
pop[9]="15"
pop[10]="500"

sel[0]="4"
sel[1]="4"
sel[2]="4"
sel[3]="4"
sel[4]="3"
sel[5]="4"
sel[6]="4"
sel[7]="4"
sel[8]="4"
sel[9]="3"
sel[10]="4"

cros="0.6"

mutation="0.01"

m=4
while [ "$m" -le 10 ];
do

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

    filename="2_final_${n}_${matice[$m]}"

    touch $filename
        
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)        4" >> $filename
echo "selection-parameter(ps)                 ${sel[$m]}" >> $filename
echo "use-threshold                           1" >> $filename
echo "crossover-method                        0" >> $filename
echo "crossover-probability(pc)               ${cros}" >> $filename
echo "use-discarding                          1" >> $filename
echo "mutation-matches-probability(pm)        ${mutation}" >> $filename
echo "mutation-rank1-probability(pr1)         0" >> $filename
echo "mutation-rank2-probability(pr2)         0.1" >> $filename
    

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

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

done

