⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 context.hpp

📁 非常好的进化算法EC 实现平台 可以实现多种算法 GA GP
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* *  Open BEAGLE *  Copyright (C) 2001-2005 by Christian Gagne and Marc Parizeau * *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2.1 of the License, or (at your option) any later version. * *  This library is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with this library; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *  Contact: *  Laboratoire de Vision et Systemes Numeriques *  Departement de genie electrique et de genie informatique *  Universite Laval, Quebec, Canada, G1K 7P4 *  http://vision.gel.ulaval.ca * *//*! *  \file   beagle/Context.hpp *  \brief  Definition of the class Context. *  \author Christian Gagne *  \author Marc Parizeau *  $Revision: 1.8 $ *  $Date: 2005/09/30 15:04:54 $ */#ifndef Beagle_Context_hpp#define Beagle_Context_hpp#include "beagle/config.hpp"#include "beagle/macros.hpp"#include "beagle/Object.hpp"#include "beagle/AllocatorT.hpp"#include "beagle/PointerT.hpp"#include "beagle/ContainerT.hpp"#include "beagle/WrapperT.hpp"#include "beagle/Genotype.hpp"#include "beagle/Individual.hpp"#include "beagle/Deme.hpp"#include "beagle/Vivarium.hpp"#include "beagle/System.hpp"#include "beagle/Evolver.hpp"#include "beagle/RunTimeException.hpp"namespace Beagle {/*! *  \class Context beagle/Context.hpp "beagle/Context.hpp" *  \brief Evolutionary context. *  \ingroup ECF *  \ingroup Sys */class Context : public Object {public:  //! Context allocator type.  typedef AllocatorT<Context,Object::Alloc>          Alloc;  //! Context handle type.  typedef PointerT<Context,Object::Handle>          Handle;  //! Context bag type.  typedef ContainerT<Context,Object::Bag>          Bag;           Context();  virtual ~Context() { }  /*!   *  \brief Return the continuing flag value.   *  \return Continuing flag value.   */  inline bool getContinueFlag() const  {    Beagle_StackTraceBeginM();    return mContinueFlag;    Beagle_StackTraceEndM("bool Context::getContinueFlag() const");  }  /*!   *  \brief Return a constant reference to the actual deme.   *  \return Actual deme constant reference.   */  inline const Deme& getDeme() const  {    Beagle_StackTraceBeginM();#ifndef BEAGLE_NDEBUG    if(mDemeHandle == NULL) throw Beagle_RunTimeExceptionM(      string("The context does not have a handle to a deme. ")+      string("Consider Beagle::Context::setDemeHandle() and setDemeIndex()."));#endif // BEAGLE_NDEBUG    return *mDemeHandle;    Beagle_StackTraceEndM("const Deme& Context::getDeme() const");  }  /*!   *  \brief Return a reference to the actual deme.   *  \return Actual deme reference.   */  inline Deme& getDeme()  {    Beagle_StackTraceBeginM();#ifndef BEAGLE_NDEBUG    if(mDemeHandle == NULL) throw Beagle_RunTimeExceptionM(      string("The context does not have a handle to a deme. ")+      string("Consider Beagle::Context::setDemeHandle() and setDemeIndex()."));#endif // BEAGLE_NDEBUG    return *mDemeHandle;    Beagle_StackTraceEndM("Deme& Context::getDeme()");  }  /*!   *  \brief Return a handle to the actual deme.   *  \return Actual deme handle.   */  inline Deme::Handle getDemeHandle()  {    Beagle_StackTraceBeginM();    return mDemeHandle;    Beagle_StackTraceEndM("Deme::Handle Context::getDemeHandle()");  }  /*!   *  \brief Return the actual deme index.   *  \return Actual deme index.   */  inline unsigned int getDemeIndex() const  {    Beagle_StackTraceBeginM();    return mDemeIndex;    Beagle_StackTraceEndM("unsigned int Context::getDemeIndex() const");  }  /*!   *  \brief Return a constant reference to the actual evolver.   *  \return Actual evolver constant reference.   */  inline const Evolver& getEvolver() const  {    Beagle_StackTraceBeginM();#ifndef BEAGLE_NDEBUG    if(mEvolverHandle == NULL) throw Beagle_RunTimeExceptionM(      string("The context does not have a handle to an evolver. ")+      string("Consider Beagle::Context::setEvolverHandle()."));#endif // BEAGLE_NDEBUG    return *mEvolverHandle;    Beagle_StackTraceEndM("const Evolver& Context::getEvolver() const");  }  /*!   *  \brief Return a reference to the actual evolver.   *  \return Actual evolver reference.   */  inline Evolver& getEvolver()  {    Beagle_StackTraceBeginM();#ifndef BEAGLE_NDEBUG    if(mEvolverHandle == NULL) throw Beagle_RunTimeExceptionM(      string("The context does not have a handle to an evolver. ")+      string("Consider Beagle::Context::setEvolverHandle()."));#endif // BEAGLE_NDEBUG    return *mEvolverHandle;    Beagle_StackTraceEndM("Evolver& Context::getEvolver()");  }  /*!   *  \brief Return a handle to the actual evolver.   *  \return Actual evolver handle.   */  inline Evolver::Handle getEvolverHandle()  {    Beagle_StackTraceBeginM();    return mEvolverHandle;    Beagle_StackTraceEndM("Evolver::Handle Context::getEvolverHandle()");  }  /*!   *  \brief Return a constant reference to the actual individual.   *  \return Actual individual constant reference.   */  inline const Individual& getIndividual() const  {    Beagle_StackTraceBeginM();#ifndef BEAGLE_NDEBUG    if(mIndividualHandle == NULL) throw Beagle_RunTimeExceptionM(      string("The context does not have a handle to an individual. ")+      string("Consider Beagle::Context::setIndividualHandle() and setIndividualIndex()."));#endif // BEAGLE_NDEBUG    return *mIndividualHandle;    Beagle_StackTraceEndM("const Individual& Context::getIndividual() const");  }  /*!   *  \brief Return a reference to the actual individual.   *  \return Actual individual reference.   */  inline Individual& getIndividual()  {    Beagle_StackTraceBeginM();#ifndef BEAGLE_NDEBUG    if(mIndividualHandle == NULL) throw Beagle_RunTimeExceptionM(      string("The context does not have a handle to an individual. ")+      string("Consider Beagle::Context::setIndividualHandle() and setIndividualIndex()."));#endif // BEAGLE_NDEBUG    return *mIndividualHandle;    Beagle_StackTraceEndM("Individual& Context::getIndividual()");  }  /*!   *  \brief Return a handle to the actual individual.   *  \return Actual individual handle.   */  inline Individual::Handle getIndividualHandle()  {    Beagle_StackTraceBeginM();    return mIndividualHandle;    Beagle_StackTraceEndM("Individual::Handle Context::getIndividualHandle()");  }  /*!   *  \brief Return the actual individual index.   *  \return Actual individual index.   */  inline unsigned int getIndividualIndex() const  {    Beagle_StackTraceBeginM();    return mIndividualIndex;    Beagle_StackTraceEndM("unsigned int Context::getIndividualIndex() const");  }  /*!   *  \brief Return a constant reference to the actual genotype.   *  \return Actual genotype constant reference.   */  inline const Genotype& getGenotype() const  {    Beagle_StackTraceBeginM();#ifndef BEAGLE_NDEBUG    if(mGenotypeHandle == NULL) throw Beagle_RunTimeExceptionM(      string("The context does not have a handle to a genotype. ")+      string("Consider Beagle::Context::setGenotypeHandle()."));#endif // BEAGLE_NDEBUG    return *mGenotypeHandle;    Beagle_StackTraceEndM("const Genotype& Context::getGenotype() const");  }  /*!   *  \brief Return a reference to the actual genotype.   *  \return Actual genotype reference.   */  inline Genotype& getGenotype()  {    Beagle_StackTraceBeginM();#ifndef BEAGLE_NDEBUG    if(mGenotypeHandle == NULL) throw Beagle_RunTimeExceptionM(      string("The context does not have a handle to a genotype. ")+      string("Consider Beagle::Context::setGenotypeHandle()."));#endif // BEAGLE_NDEBUG    return *mGenotypeHandle;    Beagle_StackTraceEndM("Genotype& Context::getGenotype()");  }  /*!   *  \brief Return a handle to the actual genotype.   *  \return Actual genotype handle.   */  inline Genotype::Handle getGenotypeHandle()  {    Beagle_StackTraceBeginM();    return mGenotypeHandle;    Beagle_StackTraceEndM("Genotype::Handle Context::getGenotypeHandle()");  }  /*!   *  \brief Return the actual genotype index.   *  \return Actual genotype index.   */  inline unsigned int getGenotypeIndex() const  {    Beagle_StackTraceBeginM();    return mGenotypeIndex;    Beagle_StackTraceEndM("unsigned int Context::getGenotypeIndex() const");  }  /*!   *  \brief Return the actual generation number.   *  \return Actual generation number.   */  inline unsigned int getGeneration() const  {    Beagle_StackTraceBeginM();    return mGeneration;    Beagle_StackTraceEndM("unsigned int Context::getGeneration() const");  }  /*!   *  \return Number of individuals processed by the actual deme in this generation.   */  inline unsigned int getProcessedDeme() const  {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -