freESAsymmetricMutationController.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: freESAsymmetricMutationController.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 "freESAsymmetricMutationController.h"
00023 #include "freExceptions.h"
00024 
00025 namespace FREE
00026 {
00027 
00031 
00032 
00033 DefineParameterMacro(ESAsymmetricMutationController,Gamma,"Gamma","The general control parameter for the shape of the asymmetric distributen. Default value =2; a higher value will enforce the ability of new adaptation, but lower the asymmetric characteristics, thus the ability to adapt a certain direction.");
00034 DefineParameterMacro(ESAsymmetricMutationController,Tau,"Tau","Controls the (individual) step size of the mutation of the strategic parameter variance.");
00035 DefineParameterMacro(ESAsymmetricMutationController,TauGlobal,"TauGlobal","Controls the (global) step size of the mutation of the strategic parameter variance.");
00036 DefineParameterMacro(ESAsymmetricMutationController,Tau_Skewness,"Tau_Skewness","Controls the (individual) step size of the mutation of the strategic parameter skewness.");
00037 DefineParameterMacro(ESAsymmetricMutationController,TauGlobal_Skewness,"TauGlobal_Skewness","Controls the (global) step size of the mutation of the strategic parameter skewness.");
00038 DefineParameterMacro(ESAsymmetricMutationController,InitialSeed,"InitialSeed", "Seed for the variate gernerator.");
00039 DefineParameterMacro(ESAsymmetricMutationController,UseInitialSeed,"UseInitialSeed","Use the initial seed for initializing the variate gernerator for the mutation; otherwise use actual time to initialize.");
00040 
00041 ESAsymmetricMutationController::
00042 ESAsymmetricMutationController()
00043 {
00044   //Profile settings
00045   this->UpdateControllerID(ControllerID::ESAsymmetricMutationController);
00046   this->m_Description = "An adaptive normal ES mutations.";
00047 };
00048 
00049 void
00050 ESAsymmetricMutationController::
00051 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00052                 const SessionComponentCache* pComponentCache,
00053                 bool bRegardOldSetup) const
00054 {
00055   Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00056 
00057   //Parameters
00058   profile.Parameters().AddParameter(cParam_Gamma,CtrlProfile::Parameter::PVTDouble,cParamDsc_Gamma,1,"2.0",-1,true);
00059   profile.Parameters().AddParameter(cParam_Tau,CtrlProfile::Parameter::PVTDouble,cParamDsc_Tau,1,"1.0",-1,true);
00060   profile.Parameters().AddParameter(cParam_TauGlobal,CtrlProfile::Parameter::PVTDouble,cParamDsc_TauGlobal,1,"1.0",-1,true);
00061   profile.Parameters().AddParameter(cParam_Tau_Skewness,CtrlProfile::Parameter::PVTDouble,cParamDsc_Tau_Skewness,1,"1.0",-1,true);
00062   profile.Parameters().AddParameter(cParam_TauGlobal_Skewness,CtrlProfile::Parameter::PVTDouble,cParamDsc_TauGlobal_Skewness,1,"1.0",-1,true);
00063   profile.Parameters().AddParameter(cParam_InitialSeed,CtrlProfile::Parameter::PVTInteger,cParamDsc_InitialSeed,1,"21021978");
00064   profile.Parameters().AddParameter(cParam_UseInitialSeed,CtrlProfile::Parameter::PVTBool,cParamDsc_UseInitialSeed,1,"false");
00065 };
00066 
00067 void
00068 ESAsymmetricMutationController::
00069 ActualizeMainComponent(ComponentType* pMainComponent,
00070                        SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00071                                                                                          const unsigned int& iActLevel) const
00072 {
00073   Superclass::ActualizeMainComponent(pMainComponent, pComponentCache,
00074                                      pSessionInfo, iActLevel);
00075 
00076   int iSeed;
00077         bool bUseSeed;
00078   double dGamma;
00079   double dTau;
00080   double dTauGlobal;
00081   double dTau_Skewness;
00082   double dTauGlobal_Skewness;
00083 
00084   try
00085   {
00086     SessionAccessor::GetParameterValue(pComponentCache,cParam_InitialSeed,iSeed,0,iActLevel,true);
00087     SessionAccessor::GetParameterValue(pComponentCache,cParam_UseInitialSeed,bUseSeed,0,iActLevel,true);
00088     SessionAccessor::GetParameterValue(pComponentCache,cParam_Gamma,dGamma,0,iActLevel,true);
00089     SessionAccessor::GetParameterValue(pComponentCache,cParam_Tau,dTau,0,iActLevel,true);
00090     SessionAccessor::GetParameterValue(pComponentCache,cParam_TauGlobal,dTauGlobal,0,iActLevel,true);
00091     SessionAccessor::GetParameterValue(pComponentCache,cParam_Tau_Skewness,dTau_Skewness,0,iActLevel,true);
00092     SessionAccessor::GetParameterValue(pComponentCache,cParam_TauGlobal_Skewness,dTauGlobal_Skewness,0,iActLevel,true);
00093   }
00094   catchAllNPassMacro("Error while retrieving parameter values.");
00095 
00096         if (bUseSeed)
00097         {
00098           pMainComponent->GetRandomGenerator().Initialize(iSeed);
00099         }
00100         else
00101         {
00102                 pMainComponent->GetRandomGenerator().Initialize();
00103         }
00104 
00105   pMainComponent->SetGamma(dGamma);
00106   pMainComponent->SetTau(dTau);
00107   pMainComponent->SetTau_Skewness(dTau_Skewness);
00108   pMainComponent->SetTauGlobal(dTauGlobal);
00109   pMainComponent->SetTauGlobal_Skewness(dTauGlobal_Skewness);
00110 };
00111 
00112 } //end of namespace free

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