Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/magnus/back_end/Genetic/include/ACConfig.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: 
00003  */
00004  
00005 // Copyright (C) 1998 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 //
00008 // Contents: Definition of ACConfig class
00009 //
00010 // Principal Author: Alexei Miasnikov
00011 //
00012 // Status: in progress
00013 //
00014 // Revision History:
00015 //
00016 
00017 
00018 #ifndef _ACConfig_H_
00019 #define _ACConfig_H_
00020 
00021 #include "global.h"
00022 #include <values.h>
00023 
00024 //------------------------------ ACConfig ----------------------------------//
00025 
00026 
00027 class ACConfig
00028 {
00029 
00030 public:
00031   
00032   /////////////////////////////////////////////////////////////////////////
00033   //                                                                     //
00034   // Constructors:                                                       //
00035   //                                                                     //
00036   /////////////////////////////////////////////////////////////////////////
00037   
00038   //GHNConfig( );
00039   
00040   ACConfig( int pop = 50, int gen = MAXINT, int fit_scale = 1, 
00041             int cross_prob = 85, int mut_prob = 85, int elit = true, 
00042             int penalty = 0, int cross_type = 1,
00043             int mut_app_prob = 65, int mut_insert_prob = 5,
00044             int mut_delete_prob = 15,
00045             int mut_change_prob = 15,
00046             int mut_permute_prob = 0,
00047             int use_sum_fit = 1,
00048             int num_min = 1000,
00049             int us_w = 1
00050             );
00051   
00052   // copy constructor supplied by compiler.
00053   
00054   // destructor supplied by compiler.
00055 
00056 
00057   /////////////////////////////////////////////////////////////////////////
00058   //                                                                     //
00059   // Accessors/Modifiers:                                                          //
00060   //                                                                     //
00061   /////////////////////////////////////////////////////////////////////////
00062   
00063   int populationSize() const { return population; }
00064   
00065   int numOfGenerations() const { return generations;}
00066   
00067   bool haveFitnessScaling() const { return fitness_scale; }
00068 
00069   bool useSumFitness() const { return use_sum_fitness; }
00070 
00071   double chanceOfCrossover( ) const { return double(crossover_prob)/100; }
00072   
00073   double chanceOfMutation( ) const { return double(mutation_prob)/100; }
00074   
00075   int numOfElitistSelection( ) const { return elittest; }
00076   
00077   int penaltyRate() const { return penalty_rate; }
00078   
00079   int crossoverType() const { return crossover_type; }
00080   
00081   double chanceOfMutationAppend( ) const { 
00082     return double(mutation_app_prob)/100; 
00083   }
00084   
00085   double chanceOfMutationInsert( ) const { 
00086     return double(mutation_insert_prob)/100; 
00087   }
00088   
00089   double chanceOfMutationDelete( ) const { 
00090     return double(mutation_delete_prob)/100; 
00091   }
00092   
00093   double chanceOfMutationChange( ) const { 
00094     return double(mutation_change_prob)/100; 
00095   }
00096 
00097   double chanceOfMutationPermute() const{
00098     return double(mutation_permute_prob)/100; 
00099   }
00100 
00101   int numMinmizeAfterOf() const {
00102     return num_min_after;
00103   }
00104   
00105   bool useWhitehead() const {
00106     return use_whitehead;
00107   }
00108 
00109   /////////////////////////////////////////////////////////////////////////
00110   //                                                                     //
00111   // OI:                                                                 //
00112   //                                                                     //
00113   /////////////////////////////////////////////////////////////////////////
00114   
00115   // assignment operator supplied by compiler
00116 
00117   friend ostream& operator << ( ostream& ostr, const ACConfig& C )
00118   {
00119     C.printOn(ostr);
00120     return ostr;
00121   }
00122     
00123   friend istream& operator >> ( istream& istr, ACConfig& C )
00124   {
00125     C.readFrom(istr);
00126     return istr;
00127   }
00128 
00129   void setVariable( const char*, int );
00130   // used by readFrom() to set variables
00131 
00132 private:
00133 
00134   /////////////////////////////////////////////////////////////////////////
00135   //                                                                     //
00136   // Private functions:                                                  //
00137   //                                                                     //
00138   /////////////////////////////////////////////////////////////////////////
00139 
00140   void readFrom( istream& istr );
00141 
00142   void printOn( ostream& ostr ) const;
00143 
00144 
00145 
00146   /////////////////////////////////////////////////////////////////////////
00147   //                                                                     //
00148   // Data members:                                                       //
00149   //                                                                     //
00150   /////////////////////////////////////////////////////////////////////////
00151   
00152   int population;
00153   int generations;
00154   int fitness_scale;
00155   int crossover_prob; 
00156   int mutation_prob;
00157   int elittest; 
00158   int penalty_rate;
00159   int crossover_type;
00160   int mutation_app_prob;
00161   int mutation_insert_prob;
00162   int mutation_delete_prob;
00163   int mutation_change_prob;
00164   int mutation_permute_prob;
00165   int use_sum_fitness;
00166   int num_min_after;
00167   int use_whitehead;
00168 };
00169 
00170 #endif

Generated at Tue Jun 19 09:49:35 2001 for Magnus Classes by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001