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

MultiobjectiveProblem.cpp

Go to the documentation of this file.
00001 #include <MultiobjectiveProblem.h>
00002 
00003 MultiobjectiveProblem::MultiobjectiveProblem()  {
00004   problemName_ = "NULL" ;
00005   variable_    = NULL ;
00006   } // MultiobjectiveProblem::MultiobjectiveProblem
00007 
00008 void MultiobjectiveProblem::adjustPrecision(int variable) {
00009   int representationBase = 2 ;
00010   bitsPerVariable_[variable] = (int) ceil(log((upperLimit_[variable] - 
00011                                                lowerLimit_[variable]) *
00012                                           pow(10.0, precision_[variable]) *
00013                                           1.000001)
00014                                      /
00015                                      log((double)representationBase)
00016                                      ) ; 
00017 } // MultiobjectiveProblem::adjustPrecision
00018 
00019 
00020 bool MultiobjectiveProblem::constraintsAreSatisfied(Individual * individual) {
00021   return true ;
00022 } // MultiobjectiveProblem::constraintsAreSatisfied
00023 
00024 int MultiobjectiveProblem::numberOfNonSatisfiedConstraints(Individual * ind) {
00025   return 0 ; 
00026 } //  MultiobjectiveProblem::numberOfNonSatisfiedContraints
00027 
00028 void MultiobjectiveProblem::initializeRealVariableType(
00029                                                   VariableType variableType) {
00030   int i ;
00031   for (i = 0; i < numberOfVariables_; i++)
00032     if (variableType == REAL) 
00033       variable_[i] = REAL ;
00034     else if (variableType == BINARY_GRAY_REAL) {
00035       variable_[i] = BINARY_GRAY_REAL ;
00036       adjustPrecision(i) ;
00037       cout << " bits variable " << i << ": " << bitsPerVariable_[i] << endl ;
00038     } // else if      
00039     else if (variableType == BINARY_REAL) {
00040       variable_[i] = BINARY_REAL ;
00041       adjustPrecision(i) ;
00042       cout << " bits variable " << i << ": " << bitsPerVariable_[i] << endl ;
00043     } // else if      
00044     else {
00045       cerr << "MultiobjectiveProblem::initializeVariableType-> "
00046            << "the type of the variable must be Real, BinaryReal or "
00047            << "BinaryGrayReal. Type received: " << variableType << endl ;
00048       exit(-1) ;
00049     } // else
00050 } // MultiobjectiveProblem::initializeVariableType
00051 
00052 
00057 void MultiobjectiveProblem::print() {
00058   cout << "Problem Name      : " << problemName_ << endl  ;
00059   cout << "Variables         : " << numberOfVariables_ << endl ;
00060   cout << "Functions         : " << numberOfFunctions_ << endl ;
00061   cout << "Partitions        : " ;
00062   int i ;
00063   for (i = 0; i < numberOfVariables_; i++) {
00064     cout << partitions_[i] << ", " ;
00065   } // for
00066   cout << endl ;
00067   cout << "Limits            : " ;
00068   for (i = 0; i < numberOfVariables_; i++) {
00069     cout << "(" << lowerLimit_[i] << ", " << upperLimit_[i] << "), " ;
00070   } // for
00071   cout << endl ;
00072   cout << "====" << endl ;
00073 
00074 } // MultiobjectiveProblem::print

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