diff --git a/PartA/crossover_100_mutation_100_elitism_0/.~lock.crossover_100_mutation_100_elitism_0.tsv# b/PartA/crossover_100_mutation_100_elitism_0/.~lock.crossover_100_mutation_100_elitism_0.tsv# deleted file mode 100644 index b306c28..0000000 --- a/PartA/crossover_100_mutation_100_elitism_0/.~lock.crossover_100_mutation_100_elitism_0.tsv# +++ /dev/null @@ -1 +0,0 @@ -,brett,laforge,15.02.2024 22:10,file:///home/brett/.config/libreoffice/4; \ No newline at end of file diff --git a/PartA/crossover_100_mutation_100_elitism_2/.~lock.crossover_100_mutation_100_elitism_2.tsv# b/PartA/crossover_100_mutation_100_elitism_2/.~lock.crossover_100_mutation_100_elitism_2.tsv# deleted file mode 100644 index b306c28..0000000 --- a/PartA/crossover_100_mutation_100_elitism_2/.~lock.crossover_100_mutation_100_elitism_2.tsv# +++ /dev/null @@ -1 +0,0 @@ -,brett,laforge,15.02.2024 22:10,file:///home/brett/.config/libreoffice/4; \ No newline at end of file diff --git a/PartA/crossover_90_mutation_10_elitism_0/.~lock.crossover_90_mutation_10_elitism_0.tsv# b/PartA/crossover_90_mutation_10_elitism_0/.~lock.crossover_90_mutation_10_elitism_0.tsv# deleted file mode 100644 index dca2a0e..0000000 --- a/PartA/crossover_90_mutation_10_elitism_0/.~lock.crossover_90_mutation_10_elitism_0.tsv# +++ /dev/null @@ -1 +0,0 @@ -,brett,laforge,15.02.2024 22:09,file:///home/brett/.config/libreoffice/4; \ No newline at end of file diff --git a/PartA/crossover_90_mutation_10_elitism_2/.~lock.crossover_90_mutation_10_elitism_2.tsv# b/PartA/crossover_90_mutation_10_elitism_2/.~lock.crossover_90_mutation_10_elitism_2.tsv# deleted file mode 100644 index dca2a0e..0000000 --- a/PartA/crossover_90_mutation_10_elitism_2/.~lock.crossover_90_mutation_10_elitism_2.tsv# +++ /dev/null @@ -1 +0,0 @@ -,brett,laforge,15.02.2024 22:09,file:///home/brett/.config/libreoffice/4; \ No newline at end of file diff --git a/PartB/90Cross10Mut2El/aggregated_fn.tsv b/PartB/90Cross10Mut2El/aggregated_fn.tsv index 8e6316e..d61a769 100644 --- a/PartB/90Cross10Mut2El/aggregated_fn.tsv +++ b/PartB/90Cross10Mut2El/aggregated_fn.tsv @@ -10,6 +10,10 @@ Run(RV)/(PV) CC CO OO OC 8 1009 104 1537 160 9 1040 108 1410 252 +Best Result: + CC CO OO OC + 1073 71 1510 156 +Fitness: 0.998937 Total results: CC CO OO OC 10226 1138 15367 1369 diff --git a/edeeee.ods b/edeeee.ods index 8161545..421d380 100644 Binary files a/edeeee.ods and b/edeeee.ods differ diff --git a/report/fp10.png b/report/fp10.png new file mode 100644 index 0000000..43c9e24 Binary files /dev/null and b/report/fp10.png differ diff --git a/report/fp11.png b/report/fp11.png new file mode 100644 index 0000000..e587037 Binary files /dev/null and b/report/fp11.png differ diff --git a/report/fp12.png b/report/fp12.png new file mode 100644 index 0000000..566e3d2 Binary files /dev/null and b/report/fp12.png differ diff --git a/report/fp13.png b/report/fp13.png new file mode 100644 index 0000000..c663ccd Binary files /dev/null and b/report/fp13.png differ diff --git a/report/fp6.png b/report/fp6.png new file mode 100644 index 0000000..c53c6e0 Binary files /dev/null and b/report/fp6.png differ diff --git a/report/fp7.png b/report/fp7.png new file mode 100644 index 0000000..ddd7a36 Binary files /dev/null and b/report/fp7.png differ diff --git a/report/fp8.png b/report/fp8.png new file mode 100644 index 0000000..3447882 Binary files /dev/null and b/report/fp8.png differ diff --git a/report/fp9.png b/report/fp9.png new file mode 100644 index 0000000..1581fcd Binary files /dev/null and b/report/fp9.png differ diff --git a/report/template_Report.aux b/report/template_Report.aux index 6ea946a..70afa95 100644 --- a/report/template_Report.aux +++ b/report/template_Report.aux @@ -12,9 +12,27 @@ \newlabel{fig:fp4}{{1}{3}{2 Elites, 10 Runs Averaged}{figure.0.1}{}} \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces }}{3}{figure.0.2}\protected@file@percent } \newlabel{fig:fp2}{{2}{3}{}{figure.0.2}{}} -\@writefile{toc}{\contentsline {subsection}{\numberline {2.5}Analysis And Conclusion}{4}{subsection.0.2.5}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.5}Analysis and Conclusion}{4}{subsection.0.2.5}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {3}Rice Classification}{4}{section.0.3}\protected@file@percent } \@writefile{toc}{\contentsline {subsection}{\numberline {3.1}Introduction}{4}{subsection.0.3.1}\protected@file@percent } \@writefile{toc}{\contentsline {subsection}{\numberline {3.2}Parameter Table}{4}{subsection.0.3.2}\protected@file@percent } -\@writefile{toc}{\contentsline {section}{\numberline {4}Compiling / Executing}{4}{section.0.4}\protected@file@percent } -\gdef \@abspage@last{6} +\@writefile{toc}{\contentsline {subsection}{\numberline {3.3}Fitness Evaluation}{4}{subsection.0.3.3}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {3.4}Fitness Plots}{5}{subsection.0.3.4}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces 2 Elites, 10 Runs Averaged}}{5}{figure.0.3}\protected@file@percent } +\newlabel{fig:fp6}{{3}{5}{2 Elites, 10 Runs Averaged}{figure.0.3}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces 2 Elites, 10 Runs Averaged}}{5}{figure.0.4}\protected@file@percent } +\newlabel{fig:fp7}{{4}{5}{2 Elites, 10 Runs Averaged}{figure.0.4}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {3.5}Confusion Matrix}{6}{subsection.0.3.5}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces 0.9 Crossover 0.1 Mutation 2 Elites Best Program Results}}{6}{figure.0.5}\protected@file@percent } +\newlabel{fig:fp10}{{5}{6}{0.9 Crossover 0.1 Mutation 2 Elites Best Program Results}{figure.0.5}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces 0.9 Crossover 0.1 Mutation 2 Elites 10 Run Average Results}}{7}{figure.0.6}\protected@file@percent } +\newlabel{fig:fp11}{{6}{7}{0.9 Crossover 0.1 Mutation 2 Elites 10 Run Average Results}{figure.0.6}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces 0.9 Crossover 0.9 Mutation 2 Elites Best Program Results}}{8}{figure.0.7}\protected@file@percent } +\newlabel{fig:fp8}{{7}{8}{0.9 Crossover 0.9 Mutation 2 Elites Best Program Results}{figure.0.7}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {8}{\ignorespaces 0.9 Crossover 0.9 Mutation 2 Elites 10 Run Average Results}}{9}{figure.0.8}\protected@file@percent } +\newlabel{fig:fp9}{{8}{9}{0.9 Crossover 0.9 Mutation 2 Elites 10 Run Average Results}{figure.0.8}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {3.6}Analysis and Conclusion}{9}{subsection.0.3.6}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4}Compiling / Executing}{9}{section.0.4}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {5}Conclusion}{10}{section.0.5}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {6}References}{10}{section.0.6}\protected@file@percent } +\gdef \@abspage@last{11} diff --git a/report/template_Report.log b/report/template_Report.log index daec661..d96b0b5 100644 --- a/report/template_Report.log +++ b/report/template_Report.log @@ -1,4 +1,4 @@ -This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex 2024.1.7) 16 FEB 2024 00:32 +This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex 2024.1.7) 16 FEB 2024 01:18 entering extended mode restricted \write18 enabled. %&-line parsing enabled. @@ -809,42 +809,82 @@ l.124 \end{center} [1 ] - + File: fp5.png Graphic file (type png) Package pdftex.def Info: fp5.png used on input line 132. (pdftex.def) Requested size: 345.0pt x 202.1484pt. - + File: fp3.png Graphic file (type png) Package pdftex.def Info: fp3.png used on input line 138. (pdftex.def) Requested size: 345.0pt x 207.5856pt. [2] [3 <./fp5.png (PNG copy)> <./fp3.png (PNG copy)>] -[4] [5] (./template_Report.aux) + +File: fp6.png Graphic file (type png) + +Package pdftex.def Info: fp6.png used on input line 194. +(pdftex.def) Requested size: 345.0pt x 193.78903pt. + +File: fp7.png Graphic file (type png) + +Package pdftex.def Info: fp7.png used on input line 200. +(pdftex.def) Requested size: 345.0pt x 197.50826pt. + +[4] + +File: fp10.png Graphic file (type png) + +Package pdftex.def Info: fp10.png used on input line 210. +(pdftex.def) Requested size: 345.0pt x 291.47491pt. + [5 <./fp6.png (PNG copy)> <./fp7.png (PNG copy)>] + +File: fp11.png Graphic file (type png) + +Package pdftex.def Info: fp11.png used on input line 217. +(pdftex.def) Requested size: 345.0pt x 293.1364pt. + [6 <./fp10.png (PNG copy)>] + +File: fp12.png Graphic file (type png) + +Package pdftex.def Info: fp12.png used on input line 226. +(pdftex.def) Requested size: 345.0pt x 292.59122pt. + +File: fp13.png Graphic file (type png) + +Package pdftex.def Info: fp13.png used on input line 232. +(pdftex.def) Requested size: 345.0pt x 292.22226pt. + [7 <./fp11.png (PNG copy)>] [8 <./fp12.png (PNG copy)>] [9 <./fp13.png (PNG co +py)>] +Underfull \hbox (badness 10000) in paragraph at lines 257--260 + + [] + +[10] (./template_Report.aux) *********** LaTeX2e <2023-11-01> L3 programming layer <2023-11-09> *********** Package rerunfilecheck Info: File `template_Report.out' has not changed. -(rerunfilecheck) Checksum: 88B3055B850BBFE4735D34A8B2B55A9E;1534. +(rerunfilecheck) Checksum: E40A270BC030F77E608A9EE4D6630F6B;2339. ) Here is how much of TeX's memory you used: - 27180 strings out of 476151 - 545257 string characters out of 5795190 - 1952555 words of memory out of 5000000 - 48686 multiletter control sequences out of 15000+600000 + 27275 strings out of 476151 + 546478 string characters out of 5795190 + 1943555 words of memory out of 5000000 + 48764 multiletter control sequences out of 15000+600000 564797 words of font info for 61 fonts, out of 8000000 for 9000 59 hyphenation exceptions out of 8191 - 93i,8n,99p,428b,1242s stack positions out of 10000i,1000n,20000p,200000b,200000s + 93i,8n,99p,984b,1242s stack positions out of 10000i,1000n,20000p,200000b,200000s -Output written on template_Report.pdf (6 pages, 253086 bytes). +Output written on template_Report.pdf (11 pages, 480180 bytes). PDF statistics: - 169 PDF objects out of 1000 (max. 8388607) - 123 compressed objects within 2 object streams - 26 named destinations out of 1000 (max. 500000) - 255 words of extra memory for PDF output out of 10000 (max. 10000000) + 238 PDF objects out of 1000 (max. 8388607) + 181 compressed objects within 2 object streams + 43 named destinations out of 1000 (max. 500000) + 333 words of extra memory for PDF output out of 10000 (max. 10000000) diff --git a/report/template_Report.out b/report/template_Report.out index 5ec7d95..e8482d6 100644 --- a/report/template_Report.out +++ b/report/template_Report.out @@ -4,8 +4,14 @@ \BOOKMARK [2][-]{subsection.0.2.2}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000\040\000T\000a\000b\000l\000e}{section.0.2}% 4 \BOOKMARK [2][-]{subsection.0.2.3}{\376\377\000F\000i\000t\000n\000e\000s\000s\000\040\000E\000v\000a\000l\000u\000a\000t\000i\000o\000n}{section.0.2}% 5 \BOOKMARK [2][-]{subsection.0.2.4}{\376\377\000F\000i\000t\000n\000e\000s\000s\000\040\000P\000l\000o\000t\000s}{section.0.2}% 6 -\BOOKMARK [2][-]{subsection.0.2.5}{\376\377\000A\000n\000a\000l\000y\000s\000i\000s\000\040\000A\000n\000d\000\040\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{section.0.2}% 7 +\BOOKMARK [2][-]{subsection.0.2.5}{\376\377\000A\000n\000a\000l\000y\000s\000i\000s\000\040\000a\000n\000d\000\040\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{section.0.2}% 7 \BOOKMARK [1][-]{section.0.3}{\376\377\000R\000i\000c\000e\000\040\000C\000l\000a\000s\000s\000i\000f\000i\000c\000a\000t\000i\000o\000n}{}% 8 \BOOKMARK [2][-]{subsection.0.3.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n}{section.0.3}% 9 \BOOKMARK [2][-]{subsection.0.3.2}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000\040\000T\000a\000b\000l\000e}{section.0.3}% 10 -\BOOKMARK [1][-]{section.0.4}{\376\377\000C\000o\000m\000p\000i\000l\000i\000n\000g\000\040\000/\000\040\000E\000x\000e\000c\000u\000t\000i\000n\000g}{}% 11 +\BOOKMARK [2][-]{subsection.0.3.3}{\376\377\000F\000i\000t\000n\000e\000s\000s\000\040\000E\000v\000a\000l\000u\000a\000t\000i\000o\000n}{section.0.3}% 11 +\BOOKMARK [2][-]{subsection.0.3.4}{\376\377\000F\000i\000t\000n\000e\000s\000s\000\040\000P\000l\000o\000t\000s}{section.0.3}% 12 +\BOOKMARK [2][-]{subsection.0.3.5}{\376\377\000C\000o\000n\000f\000u\000s\000i\000o\000n\000\040\000M\000a\000t\000r\000i\000x}{section.0.3}% 13 +\BOOKMARK [2][-]{subsection.0.3.6}{\376\377\000A\000n\000a\000l\000y\000s\000i\000s\000\040\000a\000n\000d\000\040\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{section.0.3}% 14 +\BOOKMARK [1][-]{section.0.4}{\376\377\000C\000o\000m\000p\000i\000l\000i\000n\000g\000\040\000/\000\040\000E\000x\000e\000c\000u\000t\000i\000n\000g}{}% 15 +\BOOKMARK [1][-]{section.0.5}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{}% 16 +\BOOKMARK [1][-]{section.0.6}{\376\377\000R\000e\000f\000e\000r\000e\000n\000c\000e\000s}{}% 17 diff --git a/report/template_Report.pdf b/report/template_Report.pdf index d04f32d..dacc8dc 100644 Binary files a/report/template_Report.pdf and b/report/template_Report.pdf differ diff --git a/report/template_Report.synctex.gz b/report/template_Report.synctex.gz index 8b7a2ff..aa69ec3 100644 Binary files a/report/template_Report.synctex.gz and b/report/template_Report.synctex.gz differ diff --git a/report/template_Report.tex b/report/template_Report.tex index 3bf2fdd..d63ef8f 100644 --- a/report/template_Report.tex +++ b/report/template_Report.tex @@ -139,11 +139,9 @@ If the difference is less than a user provided (default 1.e15) value cutoff it i \caption[]{0 Elites, 10 Runs Averaged} \label{fig:fp2} \end{figure} -\subsection{Analysis And Conclusion} +\subsection{Analysis and Conclusion} The best average fitness of all the tests was 0.19384 using 0.9 crossover and 0.1 mutation. - - \section{Rice Classification} \subsection{Introduction} \subsection{Parameter Table} @@ -156,27 +154,27 @@ The best average fitness of all the tests was 0.19384 using 0.9 crossover and 0. \hline Population Size & 5000 \\ \hline - Generations & 50 \\ + Generations & 51 \\ \hline - Training Set & N/A \\ + Training Set & Rice Classification (Cammeo and Osmancik) \\ \hline - Testing Set & N/A \\ + Testing Set & Rice Classification (Cammeo and Osmancik) \\ \hline Crossover Operator & Subtree Crossover\\ \hline Mutation Operator & Grow Tree, Max Depth 4 \\ \hline - Crossover Rate & 0.9 or 1.0* \\ + Crossover Rate & 0.9 or 0.9* \\ \hline - Mutation Rate & 0.1 or 1.0* \\ + Mutation Rate & 0.1 or 0.9* \\ \hline - Elitism & Best 2 or 0 individuals Survive* \\ + Elitism & Best 2 individuals Survive \\ \hline Selection & Fitness Proportionate \\ \hline - Function Set & *, /, +, -, exp, log, sin, cos \\ + Function Set & *, /, +, -, exp, log \\ \hline - Terminal Set & X, Ephemeral Value \\ + Terminal Set & area, perimeter, major, minor, eccentricity, convex, extent, Ephemeral Value \\ \hline Tree Initialization & Half and Half, Max Depth 2-6 \\ \hline @@ -188,6 +186,57 @@ The best average fitness of all the tests was 0.19384 using 0.9 crossover and 0. \hline \end{tabularx} \end{center} +\subsection{Fitness Evaluation} +Tested on the input terminal values the GP produces a positive or negative value which is interpreted as either Cammeo (+) or Osmancik (-). Raw fitness is equal to the number of hits which is the number of correct identifications. The adjusted fitness is then calculated and subtracted from 1 in order to invert and produce the required lowest fitness better. +\subsection{Fitness Plots} +\begin{figure}[H] + \centering + \includegraphics[width=1.0\linewidth]{fp6} + \caption{2 Elites, 10 Runs Averaged} + \label{fig:fp6} +\end{figure} +\begin{figure}[H] + \centering + \includegraphics[width=1.0\linewidth]{fp7} + \caption{2 Elites, 10 Runs Averaged} + \label{fig:fp7} +\end{figure} + + +\subsection{Confusion Matrix} + +\begin{figure}[H] + \centering + \includegraphics[width=1.0\linewidth]{fp10} + \caption{0.9 Crossover 0.1 Mutation 2 Elites Best Program Results} + \label{fig:fp10} +\end{figure} + +\begin{figure}[H] + \centering + \includegraphics[width=1.0\linewidth]{fp11} + \caption{0.9 Crossover 0.1 Mutation 2 Elites 10 Run Average Results} + \label{fig:fp11} +\end{figure} + + + +\begin{figure}[H] + \centering + \includegraphics[width=1.0\linewidth]{fp12} + \caption{0.9 Crossover 0.9 Mutation 2 Elites Best Program Results} + \label{fig:fp8} +\end{figure} +\begin{figure}[H] + \centering + \includegraphics[width=1.0\linewidth]{fp13} + \caption{0.9 Crossover 0.9 Mutation 2 Elites 10 Run Average Results} + \label{fig:fp9} +\end{figure} + +\subsection{Analysis and Conclusion} +The best results found was a correct classification rate of 91.9\%. On average the 0.9 crossover with 0.1 mutation produced the best results with the 0.9/0.9 best result almost being equal. + \section{Compiling / Executing} This assignment was made for linux using GCC 13.2.0, however any C++17 compliant compiler should work. @@ -201,5 +250,12 @@ The minimum GCC version appears to be 8.5, meaning this assignment can be built \end{lstlisting} The actual assignment executable is called |Assignment_1| while the automatic run system is called |Assignment_1_RUNNER|. |Assignment_1_RUNNER| has a help menu with options but the defaults will work assuming you run from the build directory and are using part b only. If you want to build for Part A run |cmake -DPART_B=OFF| and run |Assignment_1_RUNNER| with |-b| +\section{Conclusion} +I made a few changes to lilgp, mostly memory fixes along with elitism with a number of individuals instead of a proportion. There appear to be some kind of issue in the GP, of which won't matter as assignment two will likely use my own gp system. I might look into it, but I was not aware there was an issue until compiling the stats here. My results have been generally positive, however, I did notice in the course of collecting data that at some point the Part A results stopped being consistently good however part B results have remained unchanged. Might have happened when I changed my custom random number seeder to not produce div by zero errors during testing. Could be anything. I don't like writing reports and have procrastinated on writing and instead have spent the last couple of weeks messing around with the GP. Fun fact a bunch of additions to my standard lib were made for this assignment. Next time will be better hopefully + +\section{References} +Next assignment these will be proper. Latex is being annoying to setup for bib.\\\\ +https://archive.ics.uci.edu/dataset/545/rice+cammeo+and+osmancik\\ +http://garage.cse.msu.edu/software/lil-gp/ \end{document} diff --git a/report/template_Report.toc b/report/template_Report.toc index e19afde..03c542f 100644 --- a/report/template_Report.toc +++ b/report/template_Report.toc @@ -4,8 +4,14 @@ \contentsline {subsection}{\numberline {2.2}Parameter Table}{2}{subsection.0.2.2}% \contentsline {subsection}{\numberline {2.3}Fitness Evaluation}{2}{subsection.0.2.3}% \contentsline {subsection}{\numberline {2.4}Fitness Plots}{3}{subsection.0.2.4}% -\contentsline {subsection}{\numberline {2.5}Analysis And Conclusion}{4}{subsection.0.2.5}% +\contentsline {subsection}{\numberline {2.5}Analysis and Conclusion}{4}{subsection.0.2.5}% \contentsline {section}{\numberline {3}Rice Classification}{4}{section.0.3}% \contentsline {subsection}{\numberline {3.1}Introduction}{4}{subsection.0.3.1}% \contentsline {subsection}{\numberline {3.2}Parameter Table}{4}{subsection.0.3.2}% -\contentsline {section}{\numberline {4}Compiling / Executing}{4}{section.0.4}% +\contentsline {subsection}{\numberline {3.3}Fitness Evaluation}{4}{subsection.0.3.3}% +\contentsline {subsection}{\numberline {3.4}Fitness Plots}{5}{subsection.0.3.4}% +\contentsline {subsection}{\numberline {3.5}Confusion Matrix}{6}{subsection.0.3.5}% +\contentsline {subsection}{\numberline {3.6}Analysis and Conclusion}{9}{subsection.0.3.6}% +\contentsline {section}{\numberline {4}Compiling / Executing}{9}{section.0.4}% +\contentsline {section}{\numberline {5}Conclusion}{10}{section.0.5}% +\contentsline {section}{\numberline {6}References}{10}{section.0.6}% diff --git a/src/program/app.cpp b/src/program/app.cpp index dcd5851..c60e984 100644 --- a/src/program/app.cpp +++ b/src/program/app.cpp @@ -48,6 +48,7 @@ static double* app_fitness_cases[2]; #endif static double value_cutoff; +// required for this to work with c++ template auto cxx_d(T* t) { @@ -60,7 +61,7 @@ auto cxx_c(T* t) return reinterpret_cast(t); } -struct stt_record +struct rice_record { double area; double perimeter; @@ -74,16 +75,16 @@ struct stt_record struct loaded_data { - std::vector cammeo; - std::vector osmancik; - std::vector set; + std::vector cammeo; + std::vector osmancik; + std::vector set; // everything after these values is testing data. size_t last_c = 0; size_t last_o = 0; - std::vector getTrainingSet(size_t amount) + std::vector getTrainingSet(size_t amount) { - std::vector set; + std::vector set; static std::random_device dev; static std::mt19937_64 engine(dev()); std::uniform_int_distribution choice(0, 1); @@ -103,7 +104,7 @@ struct loaded_data return set; } - std::vector getTestingSet() + std::vector getTestingSet() { if (set.empty()) { @@ -131,7 +132,7 @@ struct loaded_data } } rice_data; -void vec_randomizer(std::vector& read, std::vector& write) +void vec_randomizer(std::vector& read, std::vector& write) { auto seed_param = get_parameter("random_seed"); static std::random_device dev; @@ -155,12 +156,12 @@ void load_rice_data(std::string_view path) size_t index = 0; while (!blt::string::contains(file[index++], "@DATA")) {} - std::vector c; - std::vector o; + std::vector c; + std::vector o; for (std::string_view v : blt::itr_offset(file, index)) { auto data = blt::string::split(v, ','); - stt_record r{std::stod(data[0]), std::stod(data[1]), std::stod(data[2]), std::stod(data[3]), std::stod(data[4]), std::stod(data[5]), + rice_record r{std::stod(data[0]), std::stod(data[1]), std::stod(data[2]), std::stod(data[3]), std::stod(data[4]), std::stod(data[5]), std::stod(data[6])}; std::memset(r.type, 0, 8ul); std::memcpy(r.type, data[7].data(), std::min(data[7].size(), 8ul)); @@ -170,7 +171,7 @@ void load_rice_data(std::string_view path) o.push_back(r); } - vec_randomizer(c, rice_data.cammeo); + vec_randomizer(c, rice_data.cammeo); vec_randomizer(o, rice_data.osmancik); }