• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Deb.cpp

Go to the documentation of this file.
00001 
00010 #include <Deb.h>
00011 
00015 Deb::Deb(VariableType variableType) {
00016   problemName_ = "Deb-MOP61" ;
00017 
00018   numberOfVariables_   = 2 ;
00019   numberOfFunctions_   = 2 ;
00020   numberOfConstraints_ = 0 ;
00021 
00022   const double upperLimit[] = {1.0, 1.0} ;
00023   const double lowerLimit[] = {0.0, 0.0} ;
00024   const int    precision[]  = {5, 5} ;
00025 
00026   upperLimit_      = new double[numberOfVariables_] ;
00027   lowerLimit_      = new double[numberOfVariables_] ;
00028   precision_       = new int[numberOfVariables_]    ;
00029   bitsPerVariable_ = new int[numberOfVariables_]    ;
00030   
00031   memcpy(upperLimit_, upperLimit, numberOfVariables_ * sizeof(double)) ;
00032   memcpy(lowerLimit_, lowerLimit, numberOfVariables_ * sizeof(double)) ;
00033   memcpy(precision_, precision, numberOfVariables_ * sizeof(int)) ;
00034 
00035   variableType_ = new VariableType[numberOfVariables_] ;
00036 
00037   initializeVariableType(variableType) ;
00038   cout << "Created a " << problemName_ << " problem" << endl ;
00039 
00040 } // Deb::Deb
00041 
00042 
00043 static const double alpha = 2.0 ; 
00044 static const double q     = 4.0 ; 
00045 
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 

Our Software

orangebox Mallba

orangebox ssGA

orangebox JGDS

orangebox xxGA

orangebox JCell

orangebox MHTB

orangebox DEME

orangebox JMetal

orangebox More...

orangebox Go Back