From eac87a8c9c59e8f078e5cb10b27eaaba2fd24a75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Sun, 3 May 2015 22:35:50 +0200 Subject: [PATCH] Add simple script for generating plots. --- bin/generate-plots | 78 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 bin/generate-plots diff --git a/bin/generate-plots b/bin/generate-plots new file mode 100755 index 0000000..e7d9099 --- /dev/null +++ b/bin/generate-plots @@ -0,0 +1,78 @@ +#!/bin/sh + +limit=100 + +test -d ./auto || mkdir auto +test -d ./auto/data || mkdir auto/data +test -d ./auto/plots || mkdir auto/plots + +i=1 +size=648 # 6*6*6*3 = 216 + +echo "[+] Generating data" +for m in 0 0.01 0.05 0.1 0.5 1; do #6 +# echo " * Mutation chance: $m" + for c in 0.01 0.05 0.1 0.5 0.75 1; do #6 +# echo " ** Crossover chance: $c" + for g in 10 20 50 100 200 500; do #6 +# echo " > Generations: $g" + for ch in 10 20 30; do #3 + FILENAME="$limit-$g-$ch-$c-$m" + FILE="./auto/data/$FILENAME" +# echo " > Chromosomes: $ch" +# echo "./genetic --chromosome-size=$ch --generation-size=$g --generation-limit=$limit --crossover=$c --mutation=$m > ./../../genetic-materialy/auto/$limit.$g.$ch.$c.$m" + ./genetic --chromosome-size=$ch --generation-size=$g --generation-limit=$limit --crossover=$c --mutation=$m > $FILE + + gnuplot <<- EOF + set xlabel "Pokolenia" + set ylabel "Dostosowanie" + set term png + set samples 50 + set ticslevel 0 + set title "Wykres średniego dostosowania populacji i najlepszego osobnika \n Genów:$ch, Osobników:$g, Krzyżowanie:$c, Mutacja:$m" + set key autotitle columnheader + set output "./auto/plots/${FILENAME}.png" + plot "${FILE}" using 1:2 with lines, "" using 1:3 with lines + EOF + + echo -n " > (" $i/$size ")\r" + i=$((i+1)) + done + done + done +done + +echo "[+] Generating comparison charts" + +test -d ./auto/comparisons || mkdir auto/comparisons +test -d ./auto/comparisons/genes || mkdir auto/comparisons/genes + +i=1 +size=216 # 6*6*6 = 216 +for m in 0 0.01 0.05 0.1 0.5 1; do #6 + for c in 0.01 0.05 0.1 0.5 0.75 1; do #6 + for g in 10 20 50 100 200 500; do #6 + FILENAME="$limit-$g-$c-$m" + + gnuplot <<- EOF + set xlabel "Pokolenia" + set ylabel "Dostosowanie" + set term png + set samples 50 + set ticslevel 0 + set title "Wykres wpływu ilości genów na szybkość dostosowania populacji \n Osobników:$g, Krzyżowanie:$c, Mutacja:$m" + set key autotitle columnheader + set output "./auto/comparisons/genes/${FILENAME}.png" + plot "./auto/data/$limit-$g-10-$c-$m" using 1:2 with lines title "10 Genów", \ + "./auto/data/$limit-$g-20-$c-$m" using 1:2 with lines title "20 Genów", \ + "./auto/data/$limit-$g-30-$c-$m" using 1:2 with lines title "30 Genów" + EOF + + echo -n " * Genes (" $i/$size ")\r" + i=$((i+1)) + done + done +done + +echo "[+] Done! \n" +echo "Check: ./auto/ directory for generated data and plots" -- 2.30.2