00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "freLevenbergMarquardtOptimizerController.h"
00024 #include "freExceptions.h"
00025
00026 namespace FREE
00027 {
00028
00032
00033
00034 LevenbergMarquardtOptimizerController::
00035 LevenbergMarquardtOptimizerController()
00036 {
00037
00038 this->UpdateControllerID(ControllerID::LevenbergMarquardtOptimizerController);
00039 this->m_Description = "Optimizes by a Levenberg-Marquardt-optimizer approach.";
00040 };
00041
00042 void
00043 LevenbergMarquardtOptimizerController::
00044 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00045 const SessionComponentCache* pComponentCache,
00046 bool bRegardOldSetup) const
00047 {
00048 Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00049
00050
00051 profile.Parameters().AddParameter(cParam_EpsilonFunction,CtrlProfile::Parameter::PVTDouble,cParamDsc_EpsilonFunction,1,"1e-11",-1,true);
00052 profile.Parameters().AddParameter(cParam_GradMagTolerance,CtrlProfile::Parameter::PVTDouble,cParamDsc_GradMagTolerance,1,"1e-5",-1,true);
00053 profile.Parameters().AddParameter(cParam_ValueTolerance,CtrlProfile::Parameter::PVTDouble,cParamDsc_ValueTolerance,1,"1e-8",-1,true);
00054 profile.Parameters().AddParameter(cParam_Iterations,Parameter::PVTInteger,cParamDsc_Iterations,1,"2000",-1,true);
00055 };
00056
00057 void
00058 LevenbergMarquardtOptimizerController::
00059 ActualizeMainComponent(ComponentType* pMainComponent,
00060 SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00061 const unsigned int& iActLevel) const
00062 {
00063 Superclass::ActualizeMainComponent(pMainComponent, pComponentCache, pSessionInfo, iActLevel);
00064
00065 int iNrOfIterations;
00066 double dValueTolerance;
00067 double dGradMagTolerance;
00068 double dEpsilonFunction;
00069
00070 try
00071 {
00072 SessionAccessor::GetParameterValue(pComponentCache,cParam_Iterations,iNrOfIterations,0,iActLevel,true);
00073 SessionAccessor::GetParameterValue(pComponentCache,cParam_GradMagTolerance,dGradMagTolerance,0,iActLevel,true);
00074 SessionAccessor::GetParameterValue(pComponentCache,cParam_ValueTolerance,dValueTolerance,0,iActLevel,true);
00075 SessionAccessor::GetParameterValue(pComponentCache,cParam_EpsilonFunction,dEpsilonFunction,0,iActLevel,true);
00076 }
00077 catchAllNPassMacro("Error while retrieving parameter values.");
00078
00079 ParameterArrayType scales = this->GetTransformScales(pComponentCache,iActLevel);
00080 pMainComponent->SetScales(scales);
00081 pMainComponent->SetNumberOfIterations(iNrOfIterations);
00082 pMainComponent->SetGradientTolerance(dGradMagTolerance);
00083 pMainComponent->SetValueTolerance(dValueTolerance);
00084 pMainComponent->SetEpsilonFunction(dEpsilonFunction);
00085 };
00086
00087
00088 }