Skip to content
Snippets Groups Projects
Commit 1cff850e authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Testes com plots melhores

parent 316387f3
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ tempo_max=10000 #10s
tams=(4 8 16 25 32 50 64 75 100 128)
# lista de cores
cores=(2 3 4 5 6 7 8)
cores=(2 3 4 5 6 7 8 16 32)
#-- Cores do terminal
RED='\033[0;31m'
......@@ -29,9 +29,12 @@ do
do
echo "Número de cores: ${cor}"
T_soma_cor=0
T_max_cor=0
for j in $(seq 1 $i)
do
echo -ne "Tabuleiro com ${i} linhas e ${cor} cores ${i}x${j}"\\r
echo -ne "Tabuleiro com ${i} linhas e ${cor} cores: ${i}x${j} (T max: $(($T_max_cor/1000000000))."
printf "%03d" $(($T_max_cor/1000000))
echo -ne ")"\\r
semente=$RANDOM
# echo "Usando semente: ${semente}"
./test $i $j $cor $semente
......@@ -44,6 +47,10 @@ do
S=$(($T_gasto/1000000000))
# tempo em milisegundos
M=$(($T_gasto/1000000))
# tempo máximo por cor
if [ $T_max_cor -lt $T_gasto ]; then
T_max_cor=$T_gasto
fi
if (($M>$tempo_max)); then
echo -e "\n${RED}Tabuleiro ${i} ${j} ${cor} ${semente} levou mais de ${tempo_max} milisegundos: ${S}.${M}s${NC}"
echo "${i} ${j} ${cor} ${semente}" >> tabuleiros.txt
......
set terminal png
set terminal png size 800,800
set output "tempos.png"
set xlabel "Cores"
set ylabel "Tempo (milisegundos)"
set title "Tempo médio para execução considerando número de cores e tamanho do tabuleiro"
filename="tempos.txt"
from=system('tail -n +2 '.filename. '| cut -f 1 | sort | uniq')
from=system('tail -n +2 '.filename. '| cut -f 1 | sort -n | uniq')
select_source(w) = sprintf('< awk ''{if ($1 == "%s") print }'' %s', w, filename)
from2=system('tail -n +2 '.filename. '| cut -f 2 | sort -n | uniq')
select_source2(w) = sprintf('< awk ''{if ($2 == "%s") print }'' %s', w, filename)
set grid
set key
set style data linespoints
set pointintervalbox 3
set multiplot layout 2,1
set title "Tempo médio para execução\n considerando número de cores"
set xlabel "Cores"
set ylabel "Tempo médio (milisegundos)"
plot for [f in from] select_source(f) using 2:3 title f
set title "Tempo médio para execução\n considerando tamanho do tabuleiro"
set xlabel "Tamanho do Tabuleiro"
plot for [f in from2] select_source2(f) using 1:3 title f
#plot "tempos.txt" using 1:3 with points lc rgb "#602b7d" lw 2 title "Tamanho do tabuleiro",\
# "tempos.txt" using 2:3 with points lc rgb "#19e287" lw 2 title "Número de cores"
unset multiplot
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment