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

Gene.cpp

Go to the documentation of this file.
00001 /*
00002  * @file    Gene.cpp
00003  * @author  Antonio Jesus Nebro Urbaneja
00004  * @version 1.0
00005  * @date    29 January 2004
00006  * @brief   Abstract class representing a generic gene
00007  */
00008  
00009 #include <Gene.h>
00010 
00017 Gene::Gene(VariableType geneType, Random * random) {
00018   random_   = random   ;
00019   geneType_ = geneType ;
00020 } // Gene::Gene(
00021 
00028 Gene::Gene(Gene & gene) {
00029   random_   = gene.random_ ;
00030   geneType_ = gene.geneType_ ;
00031 } // Gene::Gene
00032 
00039 Gene::Gene(Gene * gene) {
00040   random_   = gene->random_ ;
00041   geneType_ = gene->geneType_ ;
00042 } // Gene::Gene
00043 
00049 Gene::~Gene() {
00050 } // Gene::~Gene
00051 
00052 
00053 
00054 int Gene::bitFlipMutation(double mutationProbability) {
00055   cerr << "Bit-flip mutation cannot be applied to a gene of type "  
00056        << geneType_ << endl ; 
00057   exit(-1) ;
00058 } // Gene::bitFlipMutation
00059 
00060 int Gene::randomMutation(double mutationProbability) {
00061   cerr << "Random mutation cannot be applied to a gene of type "  
00062        << geneType_ << endl ; 
00063   exit(-1) ;
00064 } // Gene::randomMutation
00065 
00066 int Gene::polynomialMutation(double mutationProbability, 
00067                              double distributionIndex) {
00068   cerr << "Polynomial mutation cannot be applied to a gene of type "  
00069        << geneType_ << endl ; 
00070   // exit(-1) ;
00071 } // Gene::polynomialMutationint 
00072 
00073 int Gene::uniformMutation(double mutationProbability, 
00074                       double perturbation) {
00075   cerr << "Uniform mutation cannot be applied to a gene of type "  
00076        << geneType_ << endl ; 
00077   // exit(-1) ;
00078 } // Gene::uniformMutation
00079 
00080 double Gene::getRealAllele() {
00081   cerr << "getRealAllele() cannot be applied to a gene of type "  
00082        << geneType_ << endl ; 
00083   exit(-1) ;
00084 } // Gene::getRealAllele
00085 
00089 Gene & Gene::operator=(const Gene& gene) {
00090   random_   = gene.random_ ;
00091   geneType_ = gene.geneType_ ;
00092   
00093   return *this ;  
00094 } // Gene::operator=
00095 
00099 ostream& operator<< (ostream& outputStream, Gene& gene) {
00100   outputStream << "Gene type: " << gene.geneType_ ;
00101 } // operator<< 
00102 

Generated on Wed Feb 11 10:38:01 2004 for Paes by doxygen 1.3.3