feat: add generation plkots to report

This commit is contained in:
Krzysztof Rudnicki 2023-04-17 21:57:20 +02:00
parent 9c02b7e035
commit 1b13f315e0
20 changed files with 186 additions and 17 deletions

View File

@ -284,9 +284,10 @@ def user_input():
return arguments
def print_output(print_info, save_results, summary):
for population, file_name, generation_number in print_info:
for population, generation_number, file_name in print_info:
output(population, generation_number, file_name, save_results)
print_summary(summary)
summary_file_name = file_name
print_summary(summary, summary_file_name, save_results)
# Ran first in the code
if __name__ == "__main__":

BIN
lab3/report/0.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
lab3/report/10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
lab3/report/12.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
lab3/report/14.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
lab3/report/16.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
lab3/report/18.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
lab3/report/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
lab3/report/20.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
lab3/report/4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
lab3/report/6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
lab3/report/8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -15,7 +15,21 @@
\HyPL@Entry{0<</S/D>>}
\@writefile{toc}{\contentsline {section}{\numberline {1}Exercise Variant 2 - "Rastrigin function"}{1}{section.1}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {2}Implementation}{1}{section.2}\protected@file@percent }
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Exemplary plot halfway through generation with parameters \\ nop 250 sop 1000 ms 0.1 nog 500 min max (-5.12, 5.12) noo 10 }}{2}{figure.1}\protected@file@percent }
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Exemplary summary plot with parameters\\ nop 250 sop 1000 ms 0.1 nog 500 min max (-5.12, 5.12) noo 10 }}{3}{figure.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3}Results}{3}{section.3}\protected@file@percent }
\gdef \@abspage@last{3}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Exemplary plot halfway through generation with parameters nop 250 sop 1000 ms 0.1 nog 500 min max (-5.12, 5.12) noo 10 \relax }}{3}{figure.caption.1}\protected@file@percent }
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Exemplary summary plot with parameters nop 250 sop 1000 ms 0.1 nog 500 min max (-5.12, 5.12) noo 10 \relax }}{4}{figure.caption.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3}Results}{4}{section.3}\protected@file@percent }
\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces First 10 Generation plots with parameters nop-250:sop-1000:ms-0.1:nog-20:min-max-(-5.12, 5.12):noo-10 \relax }}{6}{figure.caption.3}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(a)}{\ignorespaces {0 generation}}}{6}{subfigure.3.1}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(b)}{\ignorespaces {2 generation}}}{6}{subfigure.3.2}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(c)}{\ignorespaces {4 generation}}}{6}{subfigure.3.3}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(d)}{\ignorespaces {6 generation}}}{6}{subfigure.3.4}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(e)}{\ignorespaces {8 generation}}}{6}{subfigure.3.5}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(f)}{\ignorespaces {10 generation}}}{6}{subfigure.3.6}\protected@file@percent }
\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces Last 10 Generation plots and summary plot with parameters nop-250:sop-1000:ms-0.1:nog-20:min-max-(-5.12, 5.12):noo-10 \relax }}{7}{figure.caption.4}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(a)}{\ignorespaces {12 generation}}}{7}{subfigure.4.1}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(b)}{\ignorespaces {14 generation}}}{7}{subfigure.4.2}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(c)}{\ignorespaces {16 generation}}}{7}{subfigure.4.3}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(d)}{\ignorespaces {18 generation}}}{7}{subfigure.4.4}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(e)}{\ignorespaces {20 generation}}}{7}{subfigure.4.5}\protected@file@percent }
\@writefile{lof}{\contentsline {subfigure}{\numberline{(f)}{\ignorespaces {Summary}}}{7}{subfigure.4.6}\protected@file@percent }
\gdef \@abspage@last{8}

View File

@ -1,11 +1,11 @@
# Fdb version 4
["xdvipdfmx"] 1681757884 "EARIN_LAB_3_RUDNICKI_KLISZKO.xdv" "EARIN_LAB_3_RUDNICKI_KLISZKO.pdf" "EARIN_LAB_3_RUDNICKI_KLISZKO" 1681757884 0
"EARIN_LAB_3_RUDNICKI_KLISZKO.xdv" 1681757884 33124 09e315a7c52dfa256c17b04adeecd4ac "xelatex"
["xdvipdfmx"] 1681761425 "EARIN_LAB_3_RUDNICKI_KLISZKO.xdv" "EARIN_LAB_3_RUDNICKI_KLISZKO.pdf" "EARIN_LAB_3_RUDNICKI_KLISZKO" 1681761425 0
"EARIN_LAB_3_RUDNICKI_KLISZKO.xdv" 1681761425 54184 8821a93d69deac25b2ffe66805704041 "xelatex"
(generated)
"EARIN_LAB_3_RUDNICKI_KLISZKO.pdf"
(rewritten before read)
["xelatex"] 1681757884 "/home/kuchy/earin/EARIN/lab3/report/EARIN_LAB_3_RUDNICKI_KLISZKO.tex" "EARIN_LAB_3_RUDNICKI_KLISZKO.xdv" "EARIN_LAB_3_RUDNICKI_KLISZKO" 1681757884 0
"/home/kuchy/earin/EARIN/lab3/report/EARIN_LAB_3_RUDNICKI_KLISZKO.tex" 1681757883 3477 8ed5d7943c9fec7b536ad469925926ad ""
["xelatex"] 1681761425 "/home/kuchy/earin/EARIN/lab3/report/EARIN_LAB_3_RUDNICKI_KLISZKO.tex" "EARIN_LAB_3_RUDNICKI_KLISZKO.xdv" "EARIN_LAB_3_RUDNICKI_KLISZKO" 1681761425 0
"/home/kuchy/earin/EARIN/lab3/report/EARIN_LAB_3_RUDNICKI_KLISZKO.tex" 1681761425 6607 75561c07df640700770be5e2235d7a60 ""
"/usr/share/texmf-dist/fonts/map/fontname/texfonts.map" 1679564905 3524 cb3e574dea2d1052e39280babc910dc8 ""
"/usr/share/texmf-dist/fonts/tfm/adobe/zapfding/pzdr.tfm" 1679564905 1528 f853c4d1b4e0550255e02831fdc8496f ""
"/usr/share/texmf-dist/fonts/tfm/public/cm/cmmi12.tfm" 1679564905 1524 4414a8315f39513458b80dfc63bff03a ""
@ -38,6 +38,8 @@
"/usr/share/texmf-dist/tex/latex/base/atveryend-ltx.sty" 1679564905 2462 8ce5f9a9c63002f2c1af03c262cf29af ""
"/usr/share/texmf-dist/tex/latex/base/size10.clo" 1679564905 8448 c33a4e1cb35cee9b33c2b21033b73e39 ""
"/usr/share/texmf-dist/tex/latex/base/ts1cmr.fd" 1679564905 2430 8418b3f1835e588625becbcac4dbce56 ""
"/usr/share/texmf-dist/tex/latex/caption/caption.sty" 1679564905 55778 14d5c99aa26410e440820bb9ea5b8b3a ""
"/usr/share/texmf-dist/tex/latex/caption/caption3.sty" 1679564905 71836 1a735454ad10692452eb2f2fc37f3865 ""
"/usr/share/texmf-dist/tex/latex/float/float.sty" 1679564905 6749 16d2656a1984957e674b149555f1ea1d ""
"/usr/share/texmf-dist/tex/latex/graphics-cfg/graphics.cfg" 1679564905 1224 978390e9c2234eab29404bc21b268d1e ""
"/usr/share/texmf-dist/tex/latex/graphics-def/xetex.def" 1679564905 14788 1dde73f396dd97d88c838bee2a352abe ""
@ -61,16 +63,29 @@
"/usr/share/texmf-dist/tex/latex/listings/lstmisc.sty" 1679564905 77021 d05e9115c67855816136d82929db8892 ""
"/usr/share/texmf-dist/tex/latex/refcount/refcount.sty" 1679564905 9878 9e94e8fa600d95f9c7731bb21dfb67a4 ""
"/usr/share/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty" 1679564905 9714 ba3194bd52c8499b3f1e3eb91d409670 ""
"/usr/share/texmf-dist/tex/latex/subfig/subfig.sty" 1679564905 21369 9ef165ca6df8815c92e693146a376c92 ""
"/usr/share/texmf-dist/tex/latex/tools/array.sty" 1679564905 12691 5b542990fe866f3d772f71346cf85b95 ""
"/usr/share/texmf-dist/tex/latex/tools/tabularx.sty" 1679564905 7147 be6981d9f5d866a5634048c4a11814a9 ""
"/usr/share/texmf-dist/tex/latex/url/url.sty" 1679564905 12796 8edb7d69a20b857904dd0ea757c14ec9 ""
"/usr/share/texmf-dist/web2c/texmf.cnf" 1679564905 39911 2da6c67557ec033436fe5418a70a8a61 ""
"/var/lib/texmf/web2c/xetex/xelatex.fmt" 1680438638 11046058 c421129080a65de742470a82b56f326d ""
"EARIN_LAB_3_RUDNICKI_KLISZKO.aux" 1681757884 1319 29ad114a76f2d8d01aa31fa0dc1b211c "xelatex"
"EARIN_LAB_3_RUDNICKI_KLISZKO.out" 1681757884 454 50b668959753031c85a7636eb970de0c "xelatex"
"EARIN_LAB_3_RUDNICKI_KLISZKO.tex" 1681757883 3477 8ed5d7943c9fec7b536ad469925926ad ""
"0.jpg" 1681759509 87686 fdcc70f185e7fed1e054614ef7fd1d99 ""
"10.jpg" 1681759509 35289 05feeebd2669a1eaadd76cf24fefdaf5 ""
"12.jpg" 1681759509 31816 a9ed363592906d46ee5b6515a4c92003 ""
"14.jpg" 1681759509 42591 e56cb908db6f8c390fa15bd606b8e7e8 ""
"16.jpg" 1681759509 43391 433aaa137393f985e8e0ad5934b67c0f ""
"18.jpg" 1681759509 44235 8b8f1cd83e131e04baf0ec8f709477d7 ""
"2.jpg" 1681759509 51403 23f3872e85e47a182ec5801160a0bad7 ""
"20.jpg" 1681759509 43506 5da10c8bdf661be5d929ed99ca44dd22 ""
"4.jpg" 1681759509 39503 aa9b71e017c328011badbe7e6738a6d5 ""
"6.jpg" 1681759509 45028 5dc52477f526227db313fc589bb9c108 ""
"8.jpg" 1681759509 40633 34cc6363dd361341ebb04deff63f6dd2 ""
"EARIN_LAB_3_RUDNICKI_KLISZKO.aux" 1681761425 3428 c1a7746a56f3636bd859f0c0a8311e53 "xelatex"
"EARIN_LAB_3_RUDNICKI_KLISZKO.out" 1681761425 454 50b668959753031c85a7636eb970de0c "xelatex"
"EARIN_LAB_3_RUDNICKI_KLISZKO.tex" 1681761425 6607 75561c07df640700770be5e2235d7a60 ""
"example_halfway.jpg" 1681756460 43787 f0809821c60091352d61146053f795f2 ""
"example_summary.jpg" 1681756506 17901 286cc778e6a6b564c8027d51b98a968f ""
"summary.jpg" 1681760676 25294 025e44a37ad32dc1d16a583d04349a03 ""
(generated)
"EARIN_LAB_3_RUDNICKI_KLISZKO.aux"
"EARIN_LAB_3_RUDNICKI_KLISZKO.log"

View File

@ -447,6 +447,41 @@ INPUT /usr/share/texmf-dist/tex/latex/float/float.sty
INPUT /usr/share/texmf-dist/tex/latex/float/float.sty
INPUT /usr/share/texmf-dist/tex/latex/float/float.sty
INPUT /usr/share/texmf-dist/tex/latex/float/float.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/subfig/subfig.sty
INPUT /usr/share/texmf-dist/tex/latex/graphics/keyval.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/caption/caption3.sty
INPUT /usr/share/texmf-dist/tex/latex/graphics/keyval.sty
INPUT /usr/share/texmf-dist/tex/latex/l3backend/l3backend-xetex.def
INPUT /usr/share/texmf-dist/tex/latex/l3backend/l3backend-xetex.def
INPUT /usr/share/texmf-dist/tex/latex/l3backend/l3backend-xetex.def
@ -501,6 +536,42 @@ INPUT example_halfway.jpg
INPUT ./example_summary.jpg
INPUT ./example_summary.jpg
INPUT example_summary.jpg
INPUT ./0.jpg
INPUT ./0.jpg
INPUT 0.jpg
INPUT ./2.jpg
INPUT ./2.jpg
INPUT 2.jpg
INPUT ./4.jpg
INPUT ./4.jpg
INPUT 4.jpg
INPUT ./6.jpg
INPUT ./6.jpg
INPUT 6.jpg
INPUT ./8.jpg
INPUT ./8.jpg
INPUT 8.jpg
INPUT ./10.jpg
INPUT ./10.jpg
INPUT 10.jpg
INPUT ./12.jpg
INPUT ./12.jpg
INPUT 12.jpg
INPUT ./14.jpg
INPUT ./14.jpg
INPUT 14.jpg
INPUT ./16.jpg
INPUT ./16.jpg
INPUT 16.jpg
INPUT ./18.jpg
INPUT ./18.jpg
INPUT 18.jpg
INPUT ./20.jpg
INPUT ./20.jpg
INPUT 20.jpg
INPUT ./summary.jpg
INPUT ./summary.jpg
INPUT summary.jpg
INPUT EARIN_LAB_3_RUDNICKI_KLISZKO.aux
INPUT ./EARIN_LAB_3_RUDNICKI_KLISZKO.out
INPUT ./EARIN_LAB_3_RUDNICKI_KLISZKO.out

View File

@ -4,6 +4,8 @@
\usepackage{hyperref}
\usepackage{tabularx}
\usepackage{float}
\usepackage{subfig}
\title{EARIN Lab 3 Report}
\author{Krzysztof Rudnicki, 307585 \\ Jakub Kliszko, 303866 }
\date{\today}
@ -62,18 +64,84 @@ To print help info about program user can issue help flag:
Results will be displayed on 2D scatter plot. There will be as many outputs as user wanted with incrementation of generation so that the final plot will be on final generation \\
\begin{figure}[H]
\caption{Exemplary plot halfway through generation with parameters \\ nop 250 sop 1000 ms 0.1 nog 500 min max (-5.12, 5.12) noo 10 }
\includegraphics[width=8cm]{example_halfway.jpg}
\includegraphics[width=\textwidth]{example_halfway.jpg}
\centering
\end{figure}
At the end summary of results on plot will display with red gradient showing results from the earliest (white) to latest (bright red) \\
\begin{figure}[H]
\caption{Exemplary summary plot with parameters\\ nop 250 sop 1000 ms 0.1 nog 500 min max (-5.12, 5.12) noo 10 }
\includegraphics[width=8cm]{example_summary.jpg}
\includegraphics[width=\textwidth]{example_summary.jpg}
\centering
\end{figure}
Results will be displayed and if user requested saved in the same folder as code directory for further inspection, with file name containing information about input parameters
Results will be displayed and if user requested saved in the same folder as code directory for further inspection, with file name containing information about input parameters \\
4 more information will also be displayed:
\begin{itemize}
\item Best individual found - x, y coordinates closest to 0
\item Best fitness found
\item Total Generation Time - including ONLY generation (not plot display)
\item Time per generation - Total generation time divided by number of generations
\end{itemize}
\section{Results}
We have successfully implemented ES($\mu$, $\lambda$) to optimize Rastrigin function \\
Rastrigin function is used to test optimization algorithms as it contains a lot of local minima
Rastrigin function is used to test optimization algorithms as it contains a lot of local minima, our plots should therefore tend to contain values closer and closer to zeros \\
Exemplary run of the program with parameters:
\begin{itemize}
\item Number of parents - 250
\item Size of population - 1000
\item Mutation Strength - 0.1
\item Number of generations - 20
\item Min value - -5.12
\item Max value - 5.12
\item Number of outputs - 10
\end{itemize}
\begin{figure}[H]
\advance\leftskip-3cm
\begin{tabular}{cc}
\subfloat[0 generation]{
\includegraphics[width = 0.7\textwidth]{0.jpg}} &
\subfloat[2 generation]{
\includegraphics[width = 0.7\textwidth]{2.jpg}} \\
\subfloat[4 generation]{
\includegraphics[width = 0.7\textwidth]{4.jpg}} &
\subfloat[6 generation]{
\includegraphics[width = 0.7\textwidth]{6.jpg}} \\
\subfloat[8 generation]{
\includegraphics[width = 0.7\textwidth]{8.jpg}} &
\subfloat[10 generation]{
\includegraphics[width = 0.7\textwidth]{10.jpg}} \\
\end{tabular}
\caption{First 10 Generation plots with parameters nop-250:sop-1000:ms-0.1:nog-20:min-max-(-5.12, 5.12):noo-10 }
\end{figure}
\begin{figure}[H]
\advance\leftskip-3cm
\begin{tabular}{cc}
\subfloat[12 generation]{
\includegraphics[width = 0.7\textwidth]{12.jpg}} &
\subfloat[14 generation]{
\includegraphics[width = 0.7\textwidth]{14.jpg}} \\
\subfloat[16 generation]{
\includegraphics[width = 0.7\textwidth]{16.jpg}} &
\subfloat[18 generation]{
\includegraphics[width = 0.7\textwidth]{18.jpg}} \\
\subfloat[20 generation]{
\includegraphics[width = 0.7\textwidth]{20.jpg}} &
\subfloat[Summary]{
\includegraphics[width = 0.7\textwidth]{summary.jpg}} \\
\end{tabular}
\caption{Last 10 Generation plots and summary plot with parameters nop-250:sop-1000:ms-0.1:nog-20:min-max-(-5.12, 5.12):noo-10 }
\end{figure}
As we can see with every generation the result comes closer and closer to the center of the plot (point (0, 0)) \\ At the begining (0 generation) we have random points with coordinates between -5.12 and 5.12 \\ Which later form groups of points with center group becoming bigger and bigger (generations between 2 and 12) \\ To finallly reach one big group centered around (0, 0) (generations between 14 and 20) \\ Summary plot clearly shows that the final groups (once that most red) are close to point (0, 0) \\
Additonal info from execution of the program with those parameters:
\begin{itemize}
\item Best individual found: [-0.00512557 -0.00185114]
\item Best fitness found: 0.005891436754870583
\item Total generation time: 0.0532705290006561
\item Time per generation: 0.0026635264500328047
\end{itemize}
\end{document}

BIN
lab3/report/summary.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB