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

Deb.cpp

Go to the documentation of this file.
00001 
00010 #include <Deb.h>
00011 
00015 Deb::Deb(VariableType variableType) {
00016 
00017   problemName_ = "Deb-MOP61" ;
00018 
00019   numberOfVariables_   = 2 ;
00020   numberOfFunctions_   = 2 ;
00021   numberOfConstraints_ = 0 ;
00022 
00023   const double upperLimit[] = {1.0, 1.0} ;
00024   const double lowerLimit[] = {0.0, 0.0} ;
00025   const int    partitions[] = {800, 800} ;
00026   const int precision[]     = {5, 5} ;
00027 
00028   upperLimit_      = new double[numberOfVariables_] ;
00029   lowerLimit_      = new double[numberOfVariables_] ;
00030   partitions_      = new int[numberOfVariables_]    ;
00031   precision_       = new int[numberOfVariables_]    ;
00032   bitsPerVariable_ = new int[numberOfVariables_]    ;
00033   
00034   memcpy(upperLimit_, upperLimit, numberOfVariables_ * sizeof(double)) ;
00035   memcpy(lowerLimit_, lowerLimit, numberOfVariables_ * sizeof(double)) ;
00036   memcpy(partitions_, partitions_, numberOfVariables_ * sizeof(int)) ;
00037   memcpy(precision_, precision, numberOfVariables_ * sizeof(int)) ;
00038 
00039   variable_ = new VariableType[numberOfVariables_] ;
00040 
00041   initializeRealVariableType(variableType) ;
00042   cout << "Created a " << problemName_ << " problem" << endl ;
00043 
00044 } // Deb::Deb
00045 
00046 
00047 static const double alpha = 2.0 ; 
00048 static const double q     = 4.0 ; 
00049 
00050 void Deb::evaluate(Individual * individual) {
00051   double x[2] ;
00052 
00053   x[0] = (individual->chromosome_->gene_[0])->getRealAllele() ;
00054   x[1] = (individual->chromosome_->gene_[1])->getRealAllele() ;
00055 
00056   // First function
00057   individual->fitness_[0] = x[0] ;
00058 
00059   // Second function
00060 
00061   individual->fitness_[1] = (1 + 10 * x[1]) * 
00062                             (1 - pow(x[0]/(1+10*x[1]), alpha) -
00063                             (x[0] / (1+10*x[1])* sin(2*3.1416*q*x[0]))) ;
00064 
00065 } // Deb::evaluate
00066 

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