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

/magnus/back_end/Genetic/include/ACGA.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 ACGA class
00009 //
00010 // Principal Author: Alexei Miasnikov
00011 //
00012 // Status: in progress
00013 //
00014 // Revision History:
00015 //
00016 
00017 
00018 #ifndef _ACGA_H_
00019 #define _ACGA_H_
00020 
00021 #include "RandomNumbers.h"
00022 #include "FPGroup.h"
00023 #include "FreeGroup.h"
00024 #include "ACConfig.h"
00025 #include "Associations.h"
00026 #include "Set.h"
00027 #include "WhiteheadOrbit.h"
00028 /*
00029 class TransformationClass
00030 {
00031  public:
00032   PopulationClass() {}
00033 
00034   PopulationClass(const Word&);
00035 
00036   PopulationClass(const PopulationClass& pc):
00037     theTransformation(pc.theTransformation),
00038     random_conjugates(pc.random_conjugates) { }
00039 
00040   operator = (const PopulationClass& pc){
00041     theTransformation = pc.theTransformation;
00042     random_conjugates = pc.random_conjugates;
00043 
00044  private:
00045   Word theTransformation;
00046   ListOf<Word> random_conjugates;
00047 };
00048 */
00049 // ------------------------------- ACGA ------------------------------------ //
00050 
00051 
00052 class ACGA
00053 {
00054 
00055 public:
00056   
00057   /////////////////////////////////////////////////////////////////////////
00058   //                                                                     //
00059   // Constructors:                                                       //
00060   //                                                                     //
00061   /////////////////////////////////////////////////////////////////////////
00062   
00063   ACGA( const FPGroup& G, const ACConfig& config );
00064   
00065   // copy constructor supplied by compiler.
00066   
00067   // destructor supplied by compiler.
00068 
00069 
00070   /////////////////////////////////////////////////////////////////////////
00071   //                                                                     //
00072   // Accessors:                                                          //
00073   //                                                                     //
00074   /////////////////////////////////////////////////////////////////////////
00075 
00076   //Trichotomy isTrivial( const Word& u, ostream& out );
00077   // returns yes if the genetic algorithm could prove that u
00078   // is trivial; returns dontknow after computing all generations
00079 
00080 //  bool transform( const Chars&, ostream& best_out);
00081   bool transform(ostream&, ostream& best_out, ostream& equiv  );
00082 
00083   void putTestSet( const SetOf<PairOfWords>& s) {testSet = s;}
00084   /////////////////////////////////////////////////////////////////////////
00085   //                                                                     //
00086   // OI:                                                                 //
00087   //                                                                     //
00088   /////////////////////////////////////////////////////////////////////////
00089   int fitness(  Word& u, ListOf<Word>& conj );
00090 
00091   Word randomWord( );
00092 
00093   void print( Word& u, const ListOf<Word>& conj, ostream& out ) ;
00094 
00095 private:
00096 
00097   /////////////////////////////////////////////////////////////////////////
00098   //                                                                     //
00099   // Private functions:                                                  //
00100   //                                                                     //
00101   /////////////////////////////////////////////////////////////////////////
00102 
00103   Word mutate( const Word& u );
00104 
00105   int randomGen( );
00106   
00107   Word crossover1( const Word& w1,const Word& w2 );
00108   
00109   Word crossover2( const Word& w1,const Word& w2 );
00110  
00111   int genToInsertAfter( Generator g );
00112 
00113   int genToInsertBefore( Generator g );
00114 
00115   int genToInsert( Generator g1, Generator g2 );
00116 
00117   Word randomPermutation();
00118 
00119   Word randomWordInGroup();
00120     
00121   void applyWhitehead( ostream& out);
00122   /////////////////////////////////////////////////////////////////////////
00123   //                                                                     //
00124   // Data members:                                                       //
00125   //                                                                     //
00126   /////////////////////////////////////////////////////////////////////////
00127   
00128   FPGroup theGroup;
00129   ACConfig cfg;
00130 
00131   friend int main(int, char **);
00132  
00133 //  SetIterator<Word> I;
00134   UniformRandom r;
00135   int numberOfRelators;
00136   int numberOfGens;
00137   int numberOfTrans;
00138   VectorOf<Word> transformations;
00139   VectorOf<Word> relatorsVector;
00140   VectorOf<Word> transferImage;
00141   VectorOf<Word> currentBest;
00142   VectorOf<Chars> trNames;
00143   AssociationsOf<int,int> reduces;
00144 
00145   int g;
00146   Word finalResult;
00147 
00148   int numberOfGenTransf;
00149   int numberOfRelTransf;
00150   bool useWhitehead;
00151 
00152   
00153   SetOf<PairOfWords> testSet;
00154 };
00155 
00156 
00157 
00158 #endif

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