\doxysubsubsection{Genetic optimizer }
\hypertarget{group___g_e_n___o_p_t_i_m_i_z_e_r}{}\label{group___g_e_n___o_p_t_i_m_i_z_e_r}\index{Genetic optimizer@{Genetic optimizer}}


Библиотека для эволюционного подбора параметров  


Collaboration diagram for Genetic optimizer\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=279pt]{group___g_e_n___o_p_t_i_m_i_z_e_r}
\end{center}
\end{figure}
\doxysubsubsubsubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{struct_gen_optimizer__t}{Gen\+Optimizer\+\_\+t}}
\end{DoxyCompactItemize}
\doxysubsubsubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group___g_e_n___o_p_t_i_m_i_z_e_r_ga3e654886869ea8182effbfcb99278670}{Gen\+Optimizer\+\_\+\+Init}}(opt,  n\+\_\+params,  n\+\_\+cand,  n\+\_\+best,  mutation\+\_\+amp,  start\+\_\+params)
\item 
\#define \mbox{\hyperlink{group___g_e_n___o_p_t_i_m_i_z_e_r_ga33bbb9131ac7f94c3731dd4130321885}{Gen\+Optimizer\+\_\+\+Step}}(opt,  params,  Loss\+Func)
\item 
\#define \mbox{\hyperlink{group___g_e_n___o_p_t_i_m_i_z_e_r_ga83abbcabaff9111c03ae2475ee72ea3e}{PARAM\+\_\+\+SCALE}}(x,  min\+\_\+val,  max\+\_\+val)
\item 
\#define \mbox{\hyperlink{group___g_e_n___o_p_t_i_m_i_z_e_r_gaa1d5510fe5f0bd989473f3ebe324bde3}{PARAM\+\_\+\+UNSCALE}}(val,  min\+\_\+val,  max\+\_\+val)
\end{DoxyCompactItemize}


\doxysubsubsubsection{Detailed Description}
Библиотека для эволюционного подбора параметров 

Поддерживает\+:
\begin{DoxyItemize}
\item Любое количество параметров
\item Генерацию новых параметров на основе лучших кандидатов
\item Мутацию для поиска оптимальных параметров
\item Несколько независимых оптимизаторов в одной программе
\end{DoxyItemize}

Параметры для конфигурации\+:
\begin{DoxyItemize}
\item \doxylink{group___g_e_n___c_o_n_f_i_g_gae6d1db3c0b21f67cb0db2673d207b62c}{GEN\+\_\+\+OPTIMIZATION\+\_\+\+ENABLE} -\/ Включить оптимизацию параметров Если библиотека отключена \doxylink{group___g_e_n___c_o_n_f_i_g_gae6d1db3c0b21f67cb0db2673d207b62c}{GEN\+\_\+\+OPTIMIZATION\+\_\+\+ENABLE}, то вставляются заглушки, никак не влияющие на параметры и остальную программу
\item \doxylink{group___g_e_n___c_o_n_f_i_g_ga8daf4b266a95353d580bd7946f47c0ab}{GEN\+\_\+\+MAX\+\_\+\+PARAMS} -\/ Максимальное количество параметров
\item \doxylink{group___g_e_n___c_o_n_f_i_g_ga201cffde04ebc6540869c74bd1dae869}{GEN\+\_\+\+MAX\+\_\+\+CANDIDATES} -\/ Максимальное количество кандидатов для обучения
\item (опционально) GEN\+\_\+\+MUTATION\+\_\+\+MIN\+\_\+\+PCT -\/ Минимальная мутация в процентах от Loss (по умолчанию 10\%)
\item (опционально) GEN\+\_\+\+MUTATION\+\_\+\+MAX\+\_\+\+PCT -\/ Максимальная мутация в процентах от Loss (по умолчанию 100\%)
\item (опционально) ELOVLE\+\_\+\+N\+\_\+\+ELITE\+\_\+\+CANDIDATE -\/ Количество кандидатов, которые проходят в поколение без изменений
\end{DoxyItemize}

\begin{DoxyParagraph}{Пример использования\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{gen__optimizer_8h}{gen\_optimizer.h}}"{}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ N\_PARAMS\ \ \ \ \ \ \ \ 4}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ N\_CANDIDATES\ \ \ \ 100}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ N\_BEST\ \ \ \ \ \ \ \ \ \ 10}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ MUTATION\ \ \ \ \ \ \ \ 0.1f}}
\DoxyCodeLine{\textcolor{keywordtype}{float}\ params[N\_PARAMS];}
\DoxyCodeLine{\mbox{\hyperlink{struct_gen_optimizer__t}{GenOptimizer\_t}}\ optimizer;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Формирование\ параметров}}
\DoxyCodeLine{uint16\_t\ \ param\_u16\ =\ 800;}
\DoxyCodeLine{\textcolor{keywordtype}{float}\ \ \ \ \ param\_f\ \ \ =\ 0.01f;}
\DoxyCodeLine{uint8\_t\ \ \ param\_u8\ \ =\ 40;}
\DoxyCodeLine{int16\_t\ \ \ param\_i16\ =\ 1600;}
\DoxyCodeLine{params[0]\ =\ PARAM\_SCALE(param\_u16,\ \ 0.0f,\ \ \ 1000.0f);}
\DoxyCodeLine{params[1]\ =\ PARAM\_SCALE(param\_f,\ \ \ \ 0.001f,\ 0.1f);}
\DoxyCodeLine{params[2]\ =\ PARAM\_SCALE(param\_u8,\ \ \ 10.0f,\ \ 100.0f);}
\DoxyCodeLine{params[3]\ =\ PARAM\_SCALE(param\_i16,\ \ 500.0f,\ 5000.0f);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Инициалиазция}}
\DoxyCodeLine{GenOptimizer\_Init(\&optimizer,\ N\_PARAMS,\ N\_CANDIDATES,\ N\_BEST,\ MUTATION,\ params);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Шаг\ эволюции}}
\DoxyCodeLine{\textcolor{keywordtype}{float}\ loss\ =\ calc\_loss();\ \textcolor{comment}{//\ расчет\ эффективности\ параметров\ (от\ 0\ до\ 1)}}
\DoxyCodeLine{GenOptimizer\_Step(\&optimizer,\ params,\ loss);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Взятие\ следующих\ для\ эволюции\ параметров}}
\DoxyCodeLine{param\_u16\ =\ PARAM\_UNSCALE(params[0],\ \ 0.0f,\ \ \ 1000.0f);}
\DoxyCodeLine{param\_f\ \ \ =\ PARAM\_UNSCALE(params[1],\ \ 0.001f,\ 0.1f);}
\DoxyCodeLine{param\_u8\ \ =\ PARAM\_UNSCALE(params[2],\ \ 10.0f,\ \ 100.0f);}
\DoxyCodeLine{param\_i16\ =\ PARAM\_UNSCALE(params[3],\ \ 500.0f,\ 5000.0f);}

\end{DoxyCode}

\end{DoxyParagraph}


\label{doc-define-members}
\Hypertarget{group___g_e_n___o_p_t_i_m_i_z_e_r_doc-define-members}
\doxysubsubsubsection{Macro Definition Documentation}
\Hypertarget{group___g_e_n___o_p_t_i_m_i_z_e_r_ga3e654886869ea8182effbfcb99278670}\index{Genetic optimizer@{Genetic optimizer}!GenOptimizer\_Init@{GenOptimizer\_Init}}
\index{GenOptimizer\_Init@{GenOptimizer\_Init}!Genetic optimizer@{Genetic optimizer}}
\doxysubsubsubsubsection{\texorpdfstring{GenOptimizer\_Init}{GenOptimizer\_Init}}
{\footnotesize\ttfamily \label{group___g_e_n___o_p_t_i_m_i_z_e_r_ga3e654886869ea8182effbfcb99278670} 
\#define Gen\+Optimizer\+\_\+\+Init(\begin{DoxyParamCaption}\item[{}]{opt}{, }\item[{}]{n\+\_\+params}{, }\item[{}]{n\+\_\+cand}{, }\item[{}]{n\+\_\+best}{, }\item[{}]{mutation\+\_\+amp}{, }\item[{}]{start\+\_\+params}{}\end{DoxyParamCaption})}



Definition at line \mbox{\hyperlink{gen__optimizer_8h_source_l00327}{327}} of file \mbox{\hyperlink{gen__optimizer_8h_source}{gen\+\_\+optimizer.\+h}}.

\Hypertarget{group___g_e_n___o_p_t_i_m_i_z_e_r_ga33bbb9131ac7f94c3731dd4130321885}\index{Genetic optimizer@{Genetic optimizer}!GenOptimizer\_Step@{GenOptimizer\_Step}}
\index{GenOptimizer\_Step@{GenOptimizer\_Step}!Genetic optimizer@{Genetic optimizer}}
\doxysubsubsubsubsection{\texorpdfstring{GenOptimizer\_Step}{GenOptimizer\_Step}}
{\footnotesize\ttfamily \label{group___g_e_n___o_p_t_i_m_i_z_e_r_ga33bbb9131ac7f94c3731dd4130321885} 
\#define Gen\+Optimizer\+\_\+\+Step(\begin{DoxyParamCaption}\item[{}]{opt}{, }\item[{}]{params}{, }\item[{}]{Loss\+Func}{}\end{DoxyParamCaption})}



Definition at line \mbox{\hyperlink{gen__optimizer_8h_source_l00328}{328}} of file \mbox{\hyperlink{gen__optimizer_8h_source}{gen\+\_\+optimizer.\+h}}.

\Hypertarget{group___g_e_n___o_p_t_i_m_i_z_e_r_ga83abbcabaff9111c03ae2475ee72ea3e}\index{Genetic optimizer@{Genetic optimizer}!PARAM\_SCALE@{PARAM\_SCALE}}
\index{PARAM\_SCALE@{PARAM\_SCALE}!Genetic optimizer@{Genetic optimizer}}
\doxysubsubsubsubsection{\texorpdfstring{PARAM\_SCALE}{PARAM\_SCALE}}
{\footnotesize\ttfamily \label{group___g_e_n___o_p_t_i_m_i_z_e_r_ga83abbcabaff9111c03ae2475ee72ea3e} 
\#define PARAM\+\_\+\+SCALE(\begin{DoxyParamCaption}\item[{}]{x}{, }\item[{}]{min\+\_\+val}{, }\item[{}]{max\+\_\+val}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{(x)}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{gen__optimizer_8h_source_l00329}{329}} of file \mbox{\hyperlink{gen__optimizer_8h_source}{gen\+\_\+optimizer.\+h}}.

\Hypertarget{group___g_e_n___o_p_t_i_m_i_z_e_r_gaa1d5510fe5f0bd989473f3ebe324bde3}\index{Genetic optimizer@{Genetic optimizer}!PARAM\_UNSCALE@{PARAM\_UNSCALE}}
\index{PARAM\_UNSCALE@{PARAM\_UNSCALE}!Genetic optimizer@{Genetic optimizer}}
\doxysubsubsubsubsection{\texorpdfstring{PARAM\_UNSCALE}{PARAM\_UNSCALE}}
{\footnotesize\ttfamily \label{group___g_e_n___o_p_t_i_m_i_z_e_r_gaa1d5510fe5f0bd989473f3ebe324bde3} 
\#define PARAM\+\_\+\+UNSCALE(\begin{DoxyParamCaption}\item[{}]{val}{, }\item[{}]{min\+\_\+val}{, }\item[{}]{max\+\_\+val}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{(val)}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{gen__optimizer_8h_source_l00330}{330}} of file \mbox{\hyperlink{gen__optimizer_8h_source}{gen\+\_\+optimizer.\+h}}.

