225 lines
35 KiB
TeX
225 lines
35 KiB
TeX
\doxysection{evolve\+\_\+optimizer.\+h}
|
||
\hypertarget{evolve__optimizer_8h_source}{}\label{evolve__optimizer_8h_source}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/evolve\_optimizer.h@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/evolve\_optimizer.h}}
|
||
\mbox{\hyperlink{evolve__optimizer_8h}{Go to the documentation of this file.}}
|
||
\begin{DoxyCode}{0}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00001}00001\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00002}00002\ \textcolor{comment}{******************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00003}00003\ \textcolor{comment}{*\ @file\ evolve\_optimizer.h}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Заголовочный\ файл\ для\ адаптивного\ подбора\ параметров}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00005}00005\ \textcolor{comment}{******************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00006}00006\ \textcolor{comment}{*\ @addtogroup\ EVOLVE\_OPTIMIZER\ \ \ \ Evolve\ optimizer}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00007}00007\ \textcolor{comment}{*\ @ingroup\ \ \ \ MYLIBS\_DEFINES}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00008}00008\ \textcolor{comment}{*\ @brief\ \ \ \ \ \ Библиотека\ для\ эволюционного\ подбора\ параметров}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00009}00009\ \textcolor{comment}{*\ @details}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00010}00010\ \textcolor{comment}{Поддерживает:}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00011}00011\ \textcolor{comment}{-\/\ Любое\ количество\ параметров}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00012}00012\ \textcolor{comment}{-\/\ Генерацию\ новых\ параметров\ на\ основе\ лучших\ кандидатов}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00013}00013\ \textcolor{comment}{-\/\ Мутацию\ для\ поиска\ оптимальных\ параметров}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00014}00014\ \textcolor{comment}{-\/\ Несколько\ независимых\ оптимизаторов\ в\ одной\ программе}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00015}00015\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00016}00016\ \textcolor{comment}{Если\ библиотека\ отключена\ @ref\ ENABLE\_EVOLVE\_OPTIMIZATION,\ то\ вставляются\ }}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00017}00017\ \textcolor{comment}{заглушки,\ никак\ не\ влияющие\ на\ параметры\ и\ остальную\ программу}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00018}00018\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00019}00019\ \textcolor{comment}{@par\ Пример\ использования:}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00020}00020\ \textcolor{comment}{@code}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00021}00021\ \textcolor{comment}{\#include\ "{}evolve\_optimizer.h"{}}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00022}00022\ \textcolor{comment}{\#define\ N\_PARAMS\ \ \ \ \ \ \ \ 4}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00023}00023\ \textcolor{comment}{\#define\ N\_CANDIDATES\ \ \ \ 100}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00024}00024\ \textcolor{comment}{\#define\ N\_BEST\ \ \ \ \ \ \ \ \ \ 10}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00025}00025\ \textcolor{comment}{\#define\ IQ\_MUTATION\ \ \ \ \ 655}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00026}00026\ \textcolor{comment}{int32\_t\ params[N\_PARAMS];}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00027}00027\ \textcolor{comment}{EvolveOptimizer\_t\ optimizer;}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00028}00028\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00029}00029\ \textcolor{comment}{//\ Формирование\ параметров}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00030}00030\ \textcolor{comment}{uint16\_t\ \ param\_u16\ =\ 800;}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00031}00031\ \textcolor{comment}{float\ \ \ \ \ param\_f\ \ \ =\ 0.01f;}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00032}00032\ \textcolor{comment}{uint8\_t\ \ \ param\_u8\ \ =\ 40;}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00033}00033\ \textcolor{comment}{int16\_t\ \ \ param\_i16\ =\ 1600;}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00034}00034\ \textcolor{comment}{params[0]\ =\ PARAM\_SCALE\_Q16(param\_u16,\ \ 0,\ \ \ \ \ \ 1000);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00035}00035\ \textcolor{comment}{params[1]\ =\ PARAM\_SCALE\_Q16(param\_f,\ \ \ \ 0.001f,\ 0.1f);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00036}00036\ \textcolor{comment}{params[2]\ =\ PARAM\_SCALE\_Q16(param\_u8,\ \ \ 10,\ \ \ \ \ 100);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00037}00037\ \textcolor{comment}{params[3]\ =\ PARAM\_SCALE\_Q16(param\_i16,\ \ 500,\ \ \ \ 5000);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00038}00038\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00039}00039\ \textcolor{comment}{//\ Инициалиазция}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00040}00040\ \textcolor{comment}{EvolveOptimizer\_Init(\&optimizer,\ N\_PARAMS,\ N\_CANDIDATES,\ N\_BEST,\ IQ\_MUTATION,\ params);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00041}00041\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00042}00042\ \textcolor{comment}{//\ Шаг\ эволюции}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00043}00043\ \textcolor{comment}{int32\_t\ loss\ =\ calc\_iq\_loss();\ //\ расчет\ эффективности\ параметров}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00044}00044\ \textcolor{comment}{EvolveOptimizer\_Step(\&optimizer,\ params,\ loss);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00045}00045\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00046}00046\ \textcolor{comment}{//\ Взятие\ следующих\ для\ эволюции\ параметров}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00047}00047\ \textcolor{comment}{param\_u16\ =\ PARAM\_UNSCALE\_Q16(params[0],\ \ 0,\ \ \ \ \ \ 1000);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00048}00048\ \textcolor{comment}{param\_f\ \ \ =\ PARAM\_UNSCALE\_Q16(params[1],\ \ 0.001f,\ 0.1f);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00049}00049\ \textcolor{comment}{param\_u8\ \ =\ PARAM\_UNSCALE\_Q16(params[2],\ \ 10,\ \ \ \ \ 100);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00050}00050\ \textcolor{comment}{param\_i16\ =\ PARAM\_UNSCALE\_Q16(params[3],\ \ 500,\ \ \ \ 5000);}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00051}00051\ \textcolor{comment}{@endcode}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00052}00052\ \textcolor{comment}{*\ @\{\ \ }}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00053}00053\ \textcolor{comment}{*****************************************************************************/}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00054}00054\ \textcolor{preprocessor}{\#ifndef\ \_\_EVOLVE\_OPTIMIZER\_H\_}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00055}00055\ \textcolor{preprocessor}{\#define\ \_\_EVOLVE\_OPTIMIZER\_H\_}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00056}00056\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00057}00057\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{mylibs__defs_8h}{mylibs\_defs.h}}"{}}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00058}00058\ \textcolor{preprocessor}{\#include\ <stdint.h>}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00059}00059\ \textcolor{preprocessor}{\#include\ <stdlib.h>}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00060}00060\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00061}00061\ \textcolor{preprocessor}{\#ifdef\ ENABLE\_EVOLVE\_OPTIMIZATION}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00062}00062\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00063}00063\ \textcolor{preprocessor}{\#define\ Q16\_MUL(a,b)\ ((int32\_t)(((int64\_t)(a)\ *\ (int64\_t)(b))\ >>\ 16))}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00064}00064\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00065}00065\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00066}00066\ \textcolor{comment}{\ \ *\ @brief\ Линейное\ масштабирование\ x\ из\ диапазона\ [min\_val,\ max\_val]\ в\ Q16.16\ [0,\ 65536)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00067}00067\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00068}\mbox{\hyperlink{group___e_v_o_l_v_e___o_p_t_i_m_i_z_e_r_gaff223481fcffea77394a331afde29fdc}{00068}}\ \textcolor{preprocessor}{\#define\ PARAM\_SCALE\_Q16(x,\ min\_val,\ max\_val)\ \(\backslash\)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00069}00069\ \textcolor{preprocessor}{((int32\_t)((((float)(x)\ -\/\ (float)(min\_val))\ /\ ((float)(max\_val)\ -\/\ (float)(min\_val)))\ *\ 65536.0f))}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00070}00070\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00071}00071\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00072}00072\ \textcolor{comment}{\ \ *\ @brief\ Обратное\ линейное\ масштабирование\ Q16.16\ значения\ в\ диапазон\ [min\_val,\ max\_val]}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00073}00073\ \textcolor{comment}{\ */}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00074}\mbox{\hyperlink{group___e_v_o_l_v_e___o_p_t_i_m_i_z_e_r_ga71a0c240c667e976d9caef391ab767ba}{00074}}\ \textcolor{preprocessor}{\#define\ PARAM\_UNSCALE\_Q16(q16\_val,\ min\_val,\ max\_val)\ \(\backslash\)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00075}00075\ \textcolor{preprocessor}{(((float)(q16\_val)\ /\ 65536.0f)\ *\ ((float)(max\_val)\ -\/\ (float)(min\_val))\ +\ (float)(min\_val))}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00076}00076\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00077}00077\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00078}00078\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00079}00079\ \textcolor{comment}{\ \ *\ @brief\ Структура\ эволюционного\ оптимизатора}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00080}00080\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00081}\mbox{\hyperlink{struct_evolve_optimizer__t}{00081}}\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00082}\mbox{\hyperlink{struct_evolve_optimizer__t_a1c270fce82e0c97e6c88fd0971c1eed8}{00082}}\ \ \ uint16\_t\ \mbox{\hyperlink{struct_evolve_optimizer__t_a1c270fce82e0c97e6c88fd0971c1eed8}{n\_params}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Количество\ параметров}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00083}\mbox{\hyperlink{struct_evolve_optimizer__t_ac35c7ca8cede4ab9c53a2845a91cd1b1}{00083}}\ \ \ uint16\_t\ \mbox{\hyperlink{struct_evolve_optimizer__t_ac35c7ca8cede4ab9c53a2845a91cd1b1}{n\_cand}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Количество\ кандидатов}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00084}\mbox{\hyperlink{struct_evolve_optimizer__t_a950cd70cb6bff33b78ad35ee58c729a6}{00084}}\ \ \ uint16\_t\ \mbox{\hyperlink{struct_evolve_optimizer__t_a950cd70cb6bff33b78ad35ee58c729a6}{n\_best}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Количество\ лучших,\ усредняемых}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00085}\mbox{\hyperlink{struct_evolve_optimizer__t_a5391277564b54e2271856a2466033df5}{00085}}\ \ \ uint16\_t\ \mbox{\hyperlink{struct_evolve_optimizer__t_a5391277564b54e2271856a2466033df5}{iq\_mutation}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Амплитуда\ мутации\ в\ Q16.16}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00086}\mbox{\hyperlink{struct_evolve_optimizer__t_a0ae0e63ba351335d4445d927991c64ae}{00086}}\ \ \ uint16\_t\ \mbox{\hyperlink{struct_evolve_optimizer__t_a0ae0e63ba351335d4445d927991c64ae}{cand\_index}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Индекс\ кандидата\ для\ обработки}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00087}\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{00087}}\ \ \ int32\_t\ \mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[\mbox{\hyperlink{group___e_v_o_l_v_e___c_o_n_f_i_g_ga7c1396e5c95c766afccdb45cbfcf5971}{EVOLVE\_MAX\_CANDIDATES}}];\ \ \ \ \textcolor{comment}{///<\ Loss\ для\ каждого\ кандидата}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00088}\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{00088}}\ \ \ int32\_t\ \mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[\mbox{\hyperlink{group___e_v_o_l_v_e___c_o_n_f_i_g_ga7c1396e5c95c766afccdb45cbfcf5971}{EVOLVE\_MAX\_CANDIDATES}}][\mbox{\hyperlink{group___e_v_o_l_v_e___c_o_n_f_i_g_ga80d6162495fc3776d8902610657d4fee}{EVOLVE\_MAX\_PARAMS}}];\ \ \ \ \textcolor{comment}{///<\ Параметры\ кандидатов}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00089}00089\ \}\ \mbox{\hyperlink{struct_evolve_optimizer__t}{EvolveOptimizer\_t}};}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00090}00090\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00091}00091\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00092}00092\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00093}00093\ \textcolor{comment}{\ \ *\ @brief\ Инициализация\ эволюционного\ оптимизатора.}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00094}00094\ \textcolor{comment}{\ \ *\ @param\ opt\ \ \ \ \ \ \ \ \ \ Указатель\ на\ структуру\ оптимизатора}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00095}00095\ \textcolor{comment}{\ \ *\ @param\ n\_params\ \ \ \ \ Количество\ параметров\ в\ одном\ кандидате}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00096}00096\ \textcolor{comment}{\ \ *\ @param\ n\_cand\ \ \ \ \ \ \ Количество\ кандидатов}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00097}00097\ \textcolor{comment}{\ \ *\ @param\ n\_best\ \ \ \ \ \ \ Количество\ лучших,\ усредняемых}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00098}00098\ \textcolor{comment}{\ \ *\ @param\ iq\_mutation\ \ Амплитуда\ мутации\ в\ Q16.16}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00099}00099\ \textcolor{comment}{\ \ *\ @param\ start\_params\ Начальные\ параметры\ (Q16.16)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00100}00100\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00101}\mbox{\hyperlink{group___e_v_o_l_v_e___o_p_t_i_m_i_z_e_r_gac21587fe68fe3635525358ac3f4059d9}{00101}}\ \_\_STATIC\_INLINE\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___e_v_o_l_v_e___o_p_t_i_m_i_z_e_r_gac21587fe68fe3635525358ac3f4059d9}{EvolveOptimizer\_Init}}(\mbox{\hyperlink{struct_evolve_optimizer__t}{EvolveOptimizer\_t}}*\ opt,}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00102}00102\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint16\_t\ n\_params,}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00103}00103\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint16\_t\ n\_cand,}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00104}00104\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint16\_t\ n\_best,}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00105}00105\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint16\_t\ iq\_mutation,}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00106}00106\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\_t*\ start\_params)}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00107}00107\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00108}00108\ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_ga27b363f333cacdccc15f5174e096b5b3}{check\_null\_ptr\_2}}(opt,\ start\_params))}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00109}00109\ \ \ \ \ \textcolor{keywordflow}{return};}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00110}00110\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00111}00111\ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a1c270fce82e0c97e6c88fd0971c1eed8}{n\_params}}\ \ \ \ \ =\ n\_params;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00112}00112\ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac35c7ca8cede4ab9c53a2845a91cd1b1}{n\_cand}}\ \ \ \ \ \ \ =\ n\_cand;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00113}00113\ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a950cd70cb6bff33b78ad35ee58c729a6}{n\_best}}\ \ \ \ \ \ \ =\ n\_best;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00114}00114\ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a5391277564b54e2271856a2466033df5}{iq\_mutation}}\ \ =\ iq\_mutation;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00115}00115\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00116}00116\ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ i\ =\ 0;\ i\ <\ n\_cand;\ i++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00117}00117\ \ \ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ j\ =\ 0;\ j\ <\ n\_params;\ j++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00118}00118\ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[i][j]\ =\ start\_params[j];}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00119}00119\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00120}00120\ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[i]\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00121}00121\ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00122}00122\ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00123}00123\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00124}00124\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00125}00125\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00126}00126\ \textcolor{comment}{\ \ *\ @brief\ Один\ шаг\ эволюционного\ оптимизатора.}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00127}00127\ \textcolor{comment}{\ \ *\ @param\ opt\ \ \ \ Указатель\ на\ структуру\ оптимизатора}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00128}00128\ \textcolor{comment}{\ \ *\ @param\ params\ Массив\ параметров,\ которые\ будут\ обновлены\ (на\ выходе\ —\ новые\ параметры)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00129}00129\ \textcolor{comment}{\ \ *\ @param\ loss\ \ \ Loss\ текущего\ кандидата\ (Q16.16)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00130}00130\ \textcolor{comment}{\ \ *\ @details}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00131}00131\ \textcolor{comment}{\ \ *\ Сохраняет\ loss\ текущего\ кандидата\ и\ формирует\ параметры\ следующего\ кандидата.}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00132}00132\ \textcolor{comment}{\ \ *\ Если\ накоплено\ n\_cand\ кандидатов,\ генерируется\ новое\ поколение.}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00133}00133\ \textcolor{comment}{\ \ *\ Новое\ поколение\ формируется\ случайным\ выбором\ из\ n\_best\ лучших\ с\ добавлением\ мутации.}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00134}00134\ \textcolor{comment}{\ \ *}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00135}00135\ \textcolor{comment}{\ \ *\ На\ выходе\ params\ содержит\ параметры\ следующего\ кандидата\ для\ измерений.}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00136}00136\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00137}\mbox{\hyperlink{group___e_v_o_l_v_e___o_p_t_i_m_i_z_e_r_ga1ba2fa963c9ae12625be1b7c20718563}{00137}}\ \_\_STATIC\_INLINE\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___e_v_o_l_v_e___o_p_t_i_m_i_z_e_r_ga1ba2fa963c9ae12625be1b7c20718563}{EvolveOptimizer\_Step}}(\mbox{\hyperlink{struct_evolve_optimizer__t}{EvolveOptimizer\_t}}*\ opt,}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00138}00138\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\_t*\ params,}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00139}00139\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\_t\ \ \ loss)}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00140}00140\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00141}00141\ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_ga27b363f333cacdccc15f5174e096b5b3}{check\_null\_ptr\_2}}(opt,\ params))}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00142}00142\ \ \ \ \ \textcolor{keywordflow}{return};}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00143}00143\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00144}00144\ \ \ uint16\_t\ n\_params\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a1c270fce82e0c97e6c88fd0971c1eed8}{n\_params}};\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00145}00145\ \ \ uint16\_t\ n\_cand\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac35c7ca8cede4ab9c53a2845a91cd1b1}{n\_cand}};\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00146}00146\ \ \ uint16\_t\ n\_best\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a950cd70cb6bff33b78ad35ee58c729a6}{n\_best}};\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00147}00147\ \ \ uint16\_t\ mut\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a5391277564b54e2271856a2466033df5}{iq\_mutation}};}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00148}00148\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00149}00149\ \ \ \textcolor{comment}{//\ 1.\ Сохраняем\ loss\ текущего\ кандидата}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00150}00150\ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a0ae0e63ba351335d4445d927991c64ae}{cand\_index}}]\ =\ loss;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00151}00151\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00152}00152\ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a0ae0e63ba351335d4445d927991c64ae}{cand\_index}}++;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00153}00153\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00154}00154\ \ \ \textcolor{keywordflow}{if}\ (opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a0ae0e63ba351335d4445d927991c64ae}{cand\_index}}\ >=\ n\_cand)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00155}00155\ \ \ \ \ \textcolor{comment}{//\ 2.\ Сортируем\ текущее\ поколение\ по\ loss}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00156}00156\ \ \ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ i\ =\ 0;\ i\ <\ n\_cand\ -\/\ 1;\ i++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00157}00157\ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ j\ =\ i\ +\ 1;\ j\ <\ n\_cand;\ j++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00158}00158\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[j]\ <\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[i])\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00159}00159\ \ \ \ \ \ \ \ \ \ \ int32\_t\ tmp\_loss\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[i];}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00160}00160\ \ \ \ \ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[i]\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[j];}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00161}00161\ \ \ \ \ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[j]\ =\ tmp\_loss;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00162}00162\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00163}00163\ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ k\ =\ 0;\ k\ <\ n\_params;\ k++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00164}00164\ \ \ \ \ \ \ \ \ \ \ \ \ int32\_t\ tmp\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[i][k];}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00165}00165\ \ \ \ \ \ \ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[i][k]\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[j][k];}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00166}00166\ \ \ \ \ \ \ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[j][k]\ =\ tmp;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00167}00167\ \ \ \ \ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00168}00168\ \ \ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00169}00169\ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00170}00170\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00171}00171\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00172}00172\ \ \ \ \ \textcolor{comment}{//\ 3.\ Генерируем\ новое\ поколение:\ каждый\ кандидат\ берется\ случайно\ из\ лучших\ с\ мутацией}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00173}00173\ \ \ \ \ uint16\_t\ n\_elite\ =\ 2;\ \textcolor{comment}{//\ количество\ элитных\ кандидатов,\ которые\ сохраняем\ без\ изменений}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00174}00174\ \ \ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ c\ =\ 0;\ c\ <\ n\_cand;\ c++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00175}00175\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (c\ <\ n\_elite)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00176}00176\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Копируем\ лучших\ кандидатов\ напрямую\ без\ мутации}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00177}00177\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ i\ =\ 0;\ i\ <\ n\_params;\ i++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00178}00178\ \ \ \ \ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[c][i]\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[c][i];\ \textcolor{comment}{//\ просто\ сохраняем\ параметры}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00179}00179\ \ \ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00180}00180\ \ \ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[c]\ =\ 0;\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00181}00181\ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00182}00182\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Остальные\ кандидаты\ формируются\ с\ кроссовером\ и\ мутацией}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00183}00183\ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ i\ =\ 0;\ i\ <\ n\_params;\ i++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00184}00184\ \ \ \ \ \ \ \ \ int32\_t\ noise\ =\ (rand()\ \%\ (2\ *\ mut))\ -\/\ mut;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00185}00185\ \ \ \ \ \ \ \ \ \ \ uint16\_t\ parent\ =\ rand()\ \%\ n\_best;\ \textcolor{comment}{//\ каждый\ параметр\ из\ случайного\ лучшего}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00186}00186\ \ \ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[c][i]\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[parent][i]\ +\ noise;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00187}00187\ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00188}00188\ \ \ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_ac723b265a3d43b754489f14310314f0d}{loss}}[c]\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00189}00189\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00190}00190\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00191}00191\ \ \ \ \ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a0ae0e63ba351335d4445d927991c64ae}{cand\_index}}\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00192}00192\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00193}00193\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00194}00194\ \ \ \textcolor{comment}{//\ 4.\ Возвращаем\ параметры\ следующего\ кандидата}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00195}00195\ \ \ \textcolor{keywordflow}{for}\ (uint16\_t\ i\ =\ 0;\ i\ <\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a1c270fce82e0c97e6c88fd0971c1eed8}{n\_params}};\ i++)}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00196}00196\ \ \ \ \ params[i]\ =\ opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a61bd0c8ae322a79936ba1f2ae22e0e0d}{candidates}}[opt-\/>\mbox{\hyperlink{struct_evolve_optimizer__t_a0ae0e63ba351335d4445d927991c64ae}{cand\_index}}][i];}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00197}00197\ \}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00198}00198\ \textcolor{preprocessor}{\#else\ }\textcolor{comment}{//\ ENABLE\_EVOLVE\_OPTIMIZATION}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00199}00199\ \textcolor{comment}{//заглушки}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00200}00200\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00201}00201\ \ \ uint16\_t\ n\_params;\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00202}00202\ \ \ uint16\_t\ n\_cand;\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00203}00203\ \ \ uint16\_t\ n\_best;\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00204}00204\ \ \ uint16\_t\ iq\_mutation;\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00205}00205\ \ \ int32\_t\ loss[0];\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00206}00206\ \ \ int32\_t\ candidates[0][0];\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00207}00207\ \}\ \mbox{\hyperlink{struct_evolve_optimizer__t}{EvolveOptimizer\_t}};}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00208}00208\ \textcolor{preprocessor}{\#define\ EvolveOptimizer\_Init(opt,\ n\_params,\ n\_cand,\ n\_best,\ iq\_mutation,\ start\_params)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00209}00209\ \textcolor{preprocessor}{\#define\ EvolveOptimizer\_Step(opt,\ params,\ LossFunc)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00210}00210\ \textcolor{preprocessor}{\#define\ PARAM\_SCALE\_Q16(x,\ min\_val,\ max\_val)\ \ \ \ \ \ \ \ \ \ \ \ (x)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00211}00211\ \textcolor{preprocessor}{\#define\ PARAM\_UNSCALE\_Q16(q16\_val,\ min\_val,\ max\_val)\ \ \ \ (q16\_val)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (q16\_val)}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00212}00212\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ ENABLE\_EVOLVE\_OPTIMIZATION}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00213}00213\ }
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00214}00214\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ \_\_EVOLVE\_OPTIMIZER\_H\_}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00215}00215\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00216}00216\ \textcolor{comment}{/**\ EVOLVE\_OPTIMIZER}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00217}00217\ \textcolor{comment}{\ \ *\ @\}}}
|
||
\DoxyCodeLine{\Hypertarget{evolve__optimizer_8h_source_l00218}00218\ \textcolor{comment}{\ \ */}}
|
||
|
||
\end{DoxyCode}
|