00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "freEvolutionaryStrategyOptimizerControllerBase.h"
00023 #include "freExceptions.h"
00024
00025 namespace FREE
00026 {
00027
00031
00032
00033 template <class TOptimizer>
00034 EvolutionaryStrategyOptimizerControllerBase<TOptimizer>::
00035 EvolutionaryStrategyOptimizerControllerBase()
00036 {
00037
00038 this->UpdateControllerID(ControllerID::EvolutionaryStrategyOptimizerControllerBase);
00039 this->m_Description = "Base for evolutionary strategy optimizer.";
00040 };
00041
00042 template <class TOptimizer>
00043 void
00044 EvolutionaryStrategyOptimizerControllerBase<TOptimizer>::
00045 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00046 const SessionComponentCache* pComponentCache,
00047 bool bRegardOldSetup) const
00048 {
00049 Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00050
00051
00052 profile.Parameters().AddParameter(cParam_Iterations,Parameter::PVTInteger,cParamDsc_Iterations,1,"100",-1,true);
00053 };
00054
00055 template <class TOptimizer>
00056 void
00057 EvolutionaryStrategyOptimizerControllerBase<TOptimizer>::
00058 ActualizeMainComponent(ComponentType* pMainComponent,
00059 SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00060 const unsigned int& iActLevel) const
00061 {
00062 int iNrOfIterations;
00063
00064 try
00065 {
00066 SessionAccessor::GetParameterValue(pComponentCache,cParam_Iterations,iNrOfIterations,0,iActLevel,true);
00067 }
00068 catchAllNPassMacro("Error while retrieving parameter values.");
00069
00070 ParameterArrayType scales = this->GetTransformScales(pComponentCache,iActLevel);
00071 pMainComponent->SetScales(scales);
00072 pMainComponent->SetMaximumIteration(iNrOfIterations);
00073 };
00074
00075 }