Mutator.h

Go to the documentation of this file.
00001 #ifndef MUTATOR_H
00002 #define MUTATOR_H
00003 
00004 #include <iomanip>
00005 #include <errno.h>
00006 #include <iostream>
00007 #include <fstream>
00008 #include <sstream>
00009 #include <list>
00010 #include <string>
00011 #include <map>
00012 #include <vector>
00013 #include <time.h>
00014 #include <stdio.h>
00015 #include <math.h>
00016 #include <stdlib.h>
00017 #include "../../lib/StringUtils.h"
00018 #include "Ttable.h"
00019 
00020 //#define INPUT_START 990 //Our input nodes start at 990 (see the node list: nodes.csv) 
00021 
00023 static inline string IntToStr(int x)
00024 {
00025         ostringstream o;
00026         if (!(o << x))
00027                 printf("Error in conversion from int to string \n");
00028         return o.str();
00029 }
00030 
00032 static inline string FltToStr(float x)
00033 {
00034         ostringstream o;
00035         if (!(o << x))
00036                 printf("Error in conversion from float to string \n");
00037         return o.str();
00038 }
00039 
00043 class Mutator 
00044 {
00045         friend class Ttable;
00046         public:
00048         Mutator( void ){};
00050         ~Mutator( void ) {};
00051         //void cchain( const string &, const string &, const bool &, const bool & ); 
00052         //Mode to create an input file for ChemChain
00053         //void egen( const string &, const string &, const bool & );   
00054         //Mode to generate a file with logic for the eq. generator
00055         //void stats( const string &, const string &, const bool &  ); 
00056         //Mode to generate a file with stats
00057         void randomizeInputs( const string &, const string &, const float & );
00058         void randomizeInputs2( const string &, const string &, const float & );
00059         void mutateTables( const string &, const string &, const float & );
00060         private:
00061         vector<Ttable*> tables;
00062         //              vector<string> nodeLst;
00063         map<string,vector<int> > nodeLst;
00064         int numOfLines( void );
00065         int numOfNodeInputs( void );
00066         bool cchainToTables( const string & );
00067         bool tablesToCChain( const string & );
00068         void addNodes( const vector<string> & );
00069         void addNode( const string &, const int & );
00070         void adjustOutDegree( const vector<string> & );
00071         vector<string> nodesWithOutDeg( const int & );
00072         void printNodes( );
00074         int find_id( const string & );
00076         string find_name( const int & );
00078         void print_nodes( void ); 
00079         // Display the list of nodes ... for testing only
00080         void show_tables( void ); 
00081         //Display the nodes with their truth tables
00083         bool read_nodes( const string & ); 
00085         bool read_tables( const bool & ); 
00086         void err_exit( const string & ); //Exits program with a message
00087         vector<string> get_states( Ttable &, const bool & ); 
00088         //Gets states of a node when the function = 1 or 0 
00089         //    string get_function( Ttable & ); 
00090         //Retrieves the logic (the last column in the table) of a node  
00091         //     bool is_node( const string & ); 
00092         //Checks if the name (string) is a valid node
00093         // int num_1( Ttable & ); //Counts the number of 1's in a node
00094         //  int num_lines( void ); 
00095         //Counts the number of lines of the overall logic
00096         //   int num_0( Ttable & ); //Counts the number of 0's in a node
00097         //     void print_ind_P( ostream & ); //Print the P values  
00098         //       void print_P( ostream & ); //Print the overall P-value
00100         void decToBin( int, string & ); //Convert decimal to binary
00101 };
00102 #endif

Generated on Fri May 7 00:40:41 2010 for ChemChains by  doxygen 1.6.1