Evocosm - A C++ Framework for Evolutionary Computing

Main Index

Created by Scott Robert Ladd at Coyote Gulch Productions.


evoreal.h

00001 //---------------------------------------------------------------------
00002 //  Algorithmic Conjurings @ http://www.coyotegulch.com
00003 //  Evocosm -- An Object-Oriented Framework for Evolutionary Algorithms
00004 //
00005 //  evoreal.h
00006 //---------------------------------------------------------------------
00007 //
00008 //  Copyright 1996, 1999, 2002, 2003, 2004, 2005, 2007 Scott Robert Ladd
00009 //
00010 //  This program is free software; you can redistribute it and/or modify
00011 //  it under the terms of the GNU General Public License as published by
00012 //  the Free Software Foundation; either version 2 of the License, or
00013 //  (at your option) any later version.
00014 //  
00015 //  This program is distributed in the hope that it will be useful,
00016 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 //  GNU General Public License for more details.
00019 //  
00020 //  You should have received a copy of the GNU General Public License
00021 //  along with this program; if not, write to the
00022 //      Free Software Foundation, Inc.
00023 //      59 Temple Place - Suite 330
00024 //      Boston, MA 02111-1307, USA.
00025 //
00026 //-----------------------------------------------------------------------
00027 //
00028 //  For more information on this software package, please visit
00029 //  Scott's web site, Coyote Gulch Productions, at:
00030 //
00031 //      http://www.coyotegulch.com
00032 //  
00033 //-----------------------------------------------------------------------
00034 
00035 #if !defined(LIBEVOCOSM_GAFLOAT_H)
00036 #define LIBEVOCOSM_GAFLOAT_H
00037 
00038 // libevocosm
00039 #include "evocommon.h"
00040 
00041 namespace libevocosm
00042 {
00044 
00067     class evoreal : protected globals 
00068     {
00069     public:
00071 
00086         evoreal(float a_sign_weight = 5.0F, float a_exponent_weight =  5.0F, float a_mantissa_weight = 90.0F);
00087 
00089 
00093         evoreal(evoreal & a_source);
00094 
00096 
00100         evoreal & operator = (evoreal & a_source);
00101 
00103 
00108         float  mutate(float  a_f);
00109 
00111 
00116         double mutate(double a_d);
00117 
00119 
00126         float crossover(float  a_f1, float  a_f2);
00127 
00129 
00136         double crossover(double a_d1, double a_d2);
00137 
00138     private:
00139         // weights used to select parts of a number for manipulation
00140         const float m_total_weight;
00141         const float m_sign_weight;
00142         const float m_exp_weight;
00143 
00144 #if defined(_MSC_VER) && (_MSC_VER < 1300)
00145         static const long FLT_EXP_BITS;
00146         static const long DBL_EXP_BITS;
00147 #else
00148         static const long FLT_EXP_BITS = 0x7F800000L;
00149         static const long DBL_EXP_BITS = 0x7FF00000UL;
00150 #endif
00151     };
00152 }
00153 
00154 #endif
00155 

© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.