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

📄 parityevalop.hpp

📁 非常好的进化算法EC 实现平台 可以实现多种算法 GA GP
💻 HPP
字号:
/* *  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   ParityEvalOp.hpp *  \brief  Definition of the type ParityEvalOp. *  \author Christian Gagne *  \author Marc Parizeau *  $Revision: 1.9 $ *  $Date: 2005/10/04 09:32:55 $ *//*! *  \defgroup Parity Even-6 Parity Example *  \brief Even 6-parity (parity): A GP example working on booleans with Open BEAGLE. * *  \par Objective *  Find a program that produces the value of the Boolean even 6-parity given *  six independent Boolean inputs. * *  \par Terminal set *  - IN0, IN1, IN2, IN3, IN4, and IN5, the inputs of the function. *  - 0 and 1, two Boolean constants. * *  \par Function set *  - AND *  - OR *  - NOT *  - XOR    (to make the problem harder, don't use this one) * *  \par Automatically defined functions *  Two ADFs used, each with two arguments inputs. * *  \par Fitness cases *  All the \f$2^6 = 64\f$ combinations of the six input Booleans. * *  \par Fitness *  Rate of correct outputs obtained over all the 64 fitness cases. * *  \par Stopping criteria *  When the evolution reaches the maximum number of generations. * *  \par Reference *  John R. Koza, "Genetic Programming II: Automatic Discovery of Reusable *  Programs", MIT Press, 1994, pages 157-199. * */ #ifndef ParityEvalOp_hpp#define ParityEvalOp_hpp#include "beagle/GP.hpp"#include <string>#include <vector>/*! *  \class ParityEvalOp ParityEvalOp.hpp "ParityEvalOp.hpp" *  \brief The individual evaluation class operator for the parity-6 problem. *  \ingroup Parity */class ParityEvalOp : public Beagle::GP::EvaluationOp {public:  //! ParityEvalOp allocator type.  typedef Beagle::AllocatorT<ParityEvalOp,Beagle::GP::EvaluationOp::Alloc>          Alloc;  //!< ParityEvalOp handle type.  typedef Beagle::PointerT<ParityEvalOp,Beagle::GP::EvaluationOp::Handle>          Handle;  //!< ParityEvalOp bag type.  typedef Beagle::ContainerT<ParityEvalOp,Beagle::GP::EvaluationOp::Bag>          Bag;  explicit ParityEvalOp();  virtual void initialize(Beagle::System& ioSystem);  virtual Beagle::Fitness::Handle evaluate(Beagle::GP::Individual& inIndividual,                                           Beagle::GP::Context& ioContext);protected:  std::vector< std::vector<Beagle::Bool> > mInputs;  std::vector<Beagle::Bool>                mOutputs;};#endif // ParityEvalOp_hpp

⌨️ 快捷键说明

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