Evocosm - A C++ Framework for Evolutionary Computing

Main Index

Created by Scott Robert Ladd at Coyote Gulch Productions.


evoreal.h
1 //---------------------------------------------------------------------
2 // Algorithmic Conjurings @ http://www.coyotegulch.com
3 // Evocosm -- An Object-Oriented Framework for Evolutionary Algorithms
4 //
5 // evoreal.h
6 //---------------------------------------------------------------------
7 //
8 // Copyright 1996, 1999, 2002, 2003, 2004, 2005, 2007 Scott Robert Ladd
9 //
10 // This program is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the
22 // Free Software Foundation, Inc.
23 // 59 Temple Place - Suite 330
24 // Boston, MA 02111-1307, USA.
25 //
26 //-----------------------------------------------------------------------
27 //
28 // For more information on this software package, please visit
29 // Scott's web site, Coyote Gulch Productions, at:
30 //
31 // http://www.coyotegulch.com
32 //
33 //-----------------------------------------------------------------------
34 
35 #if !defined(LIBEVOCOSM_GAFLOAT_H)
36 #define LIBEVOCOSM_GAFLOAT_H
37 
38 // libevocosm
39 #include "evocommon.h"
40 
41 namespace libevocosm
42 {
44 
67  class evoreal : protected globals
68  {
69  public:
71 
86  evoreal(float a_sign_weight = 5.0F, float a_exponent_weight = 5.0F, float a_mantissa_weight = 90.0F);
87 
89 
93  evoreal(evoreal & a_source);
94 
96 
100  evoreal & operator = (evoreal & a_source);
101 
103 
108  float mutate(float a_f);
109 
111 
116  double mutate(double a_d);
117 
119 
126  float crossover(float a_f1, float a_f2);
127 
129 
136  double crossover(double a_d1, double a_d2);
137 
138  private:
139  // weights used to select parts of a number for manipulation
140  const float m_total_weight;
141  const float m_sign_weight;
142  const float m_exp_weight;
143 
144 #if defined(_MSC_VER) && (_MSC_VER < 1300)
145  static const long FLT_EXP_BITS;
146  static const long DBL_EXP_BITS;
147 #else
148  static const long FLT_EXP_BITS = 0x7F800000L;
149  static const long DBL_EXP_BITS = 0x7FF00000UL;
150 #endif
151  };
152 }
153 
154 #endif
155 
float mutate(float a_f)
Mutation for float values.
Tools for evolving real numbers.
Definition: evoreal.h:67
evoreal(float a_sign_weight=5.0F, float a_exponent_weight=5.0F, float a_mantissa_weight=90.0F)
Creation constructor.
float crossover(float a_f1, float a_f2)
Crossover for float values.
evoreal & operator=(evoreal &a_source)
Assignment.
A toolkit and framework for implementing evolutionary algorithms.
Definition: evocommon.h:60
Elements shared by all classes in Evocosm.
Definition: evocommon.h:115

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