freESAdaptiveNormalMutationController.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freESAdaptiveNormalMutationController.cxx,v $
00007   Language:  C++
00008 
00009 
00010   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00011   Institute for Medical Biometry and Informatics, University of Heidelberg,
00012   Germany). All rights reserved.
00013   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00014   for details.
00015 
00016      This software is distributed WITHOUT ANY WARRANTY; without even 
00017      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00018      PURPOSE.  See the above copyright notices for more information.
00019 
00020 =========================================================================*/
00021 
00022 #include "freESAdaptiveNormalMutationController.h"
00023 #include "freExceptions.h"
00024 
00025 namespace FREE
00026 {
00027 
00031 
00032 
00033 DefineParameterMacro(ESAdaptiveNormalMutationController,StrategicMutationVariance,"StrategicMutationVariance","The variance for the mutation of strategic parameters of the individual.");
00034 DefineParameterMacro(ESAdaptiveNormalMutationController,InitialSeed,"InitialSeed", "Seed for the variate gernerator.");
00035 DefineParameterMacro(ESAdaptiveNormalMutationController,UseInitialSeed,"UseInitialSeed","Use the initial seed for initializing the variate gernerator for the mutation; otherwise use actual time to initialize.");
00036 
00037 ESAdaptiveNormalMutationController::
00038 ESAdaptiveNormalMutationController()
00039 {
00040   //Profile settings
00041   this->UpdateControllerID(ControllerID::ESAdaptiveNormalMutationController);
00042   this->m_Description = "An adaptive normal ES mutations.";
00043 };
00044 
00045 void
00046 ESAdaptiveNormalMutationController::
00047 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00048                 const SessionComponentCache* pComponentCache,
00049                 bool bRegardOldSetup) const
00050 {
00051   Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00052 
00053   //Parameters
00054   profile.Parameters().AddParameter(cParam_StrategicMutationVariance,CtrlProfile::Parameter::PVTDouble,cParamDsc_StrategicMutationVariance,1,"1.0",-1,true);
00055   profile.Parameters().AddParameter(cParam_InitialSeed,CtrlProfile::Parameter::PVTInteger,cParamDsc_InitialSeed,1,"21021978");
00056   profile.Parameters().AddParameter(cParam_UseInitialSeed,CtrlProfile::Parameter::PVTBool,cParamDsc_UseInitialSeed,1,"false");
00057 };
00058 
00059 void
00060 ESAdaptiveNormalMutationController::
00061 ActualizeMainComponent(ComponentType* pMainComponent,
00062                        SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00063                                                                                          const unsigned int& iActLevel) const
00064 {
00065   Superclass::ActualizeMainComponent(pMainComponent, pComponentCache,
00066                                      pSessionInfo, iActLevel);
00067 
00068   int iSeed;
00069         bool bUseSeed;
00070   double dStrategicMutationVariance;
00071   try
00072   {
00073     SessionAccessor::GetParameterValue(pComponentCache,cParam_InitialSeed,iSeed,0,iActLevel,true);
00074     SessionAccessor::GetParameterValue(pComponentCache,cParam_UseInitialSeed,bUseSeed,0,iActLevel,true);
00075     SessionAccessor::GetParameterValue(pComponentCache,cParam_StrategicMutationVariance,dStrategicMutationVariance,0,iActLevel,true);
00076   }
00077   catchAllNPassMacro("Error while retrieving parameter values.");
00078 
00079         if (bUseSeed)
00080         {
00081           pMainComponent->GetRandomGenerator().Initialize(iSeed);
00082         }
00083         else
00084         {
00085                 pMainComponent->GetRandomGenerator().Initialize((int)clock());
00086         }
00087 
00088   pMainComponent->SetStrategicMutationVariance(dStrategicMutationVariance);
00089 };
00090 
00091 } //end of namespace free

Generated at Sat Oct 13 15:53:25 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000