Fixed some compatibility issues with GCC 3.0.1 and the Intel C++ Compiler
for Linux v5.
This commit is contained in:
parent
e4523b3080
commit
94a13c6d53
4 changed files with 28 additions and 19 deletions
|
|
@ -20,10 +20,10 @@ ac_cv_header_stdc=${ac_cv_header_stdc=yes}
|
||||||
ac_cv_lib_eo_main=${ac_cv_lib_eo_main=no}
|
ac_cv_lib_eo_main=${ac_cv_lib_eo_main=no}
|
||||||
ac_cv_lib_eoutils_main=${ac_cv_lib_eoutils_main=no}
|
ac_cv_lib_eoutils_main=${ac_cv_lib_eoutils_main=no}
|
||||||
ac_cv_lib_m_main=${ac_cv_lib_m_main=yes}
|
ac_cv_lib_m_main=${ac_cv_lib_m_main=yes}
|
||||||
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
|
ac_cv_path_install=${ac_cv_path_install=$'/usr/bin/install -c'}
|
||||||
ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'}
|
ac_cv_prog_CPP=${ac_cv_prog_CPP=$'cc -E'}
|
||||||
ac_cv_prog_CXX=${ac_cv_prog_CXX=c++}
|
ac_cv_prog_CXX=${ac_cv_prog_CXX=c++}
|
||||||
ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'}
|
ac_cv_prog_LN_S=${ac_cv_prog_LN_S=$'ln -s'}
|
||||||
ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib}
|
ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib}
|
||||||
ac_cv_prog_cxx_cross=${ac_cv_prog_cxx_cross=no}
|
ac_cv_prog_cxx_cross=${ac_cv_prog_cxx_cross=no}
|
||||||
ac_cv_prog_cxx_g=${ac_cv_prog_cxx_g=yes}
|
ac_cv_prog_cxx_g=${ac_cv_prog_cxx_g=yes}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,6 @@
|
||||||
|
|
||||||
// need to allocate the static variables of class eoVariableParetoTraits
|
// need to allocate the static variables of class eoVariableParetoTraits
|
||||||
unsigned eoVariableParetoTraits::nObj;
|
unsigned eoVariableParetoTraits::nObj;
|
||||||
vector<bool> eoVariableParetoTraits::bObj;
|
std::vector<bool> eoVariableParetoTraits::bObj;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* eoFitnessTraits: a traits class to specify
|
* eoFitnessTraits: a traits class to specify
|
||||||
|
|
@ -55,20 +57,20 @@ class eoVariableParetoTraits : public eoParetoFitnessTraits
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
/** setting the static stuff */
|
/** setting the static stuff */
|
||||||
static void setUp(unsigned _n, vector<bool> & _b)
|
static void setUp(unsigned _n, std::vector<bool> & _b)
|
||||||
{
|
{
|
||||||
// possible problems
|
// possible problems
|
||||||
if ( nObj && (nObj != _n) ) // was already set to a different value
|
if ( nObj && (nObj != _n) ) // was already set to a different value
|
||||||
{
|
{
|
||||||
cout << "WARNING\n";
|
std::cout << "WARNING\n";
|
||||||
cout << "WARNING : you are changing the number of objectives\n";
|
std::cout << "WARNING : you are changing the number of objectives\n";
|
||||||
cout << "WARNING : Make sure all existing objects are destroyed\n";
|
std::cout << "WARNING : Make sure all existing objects are destroyed\n";
|
||||||
cout << "WARNING\n";
|
std::cout << "WARNING\n";
|
||||||
}
|
}
|
||||||
nObj=_n;
|
nObj=_n;
|
||||||
bObj=_b;
|
bObj=_b;
|
||||||
if (nObj != bObj.size())
|
if (nObj != bObj.size())
|
||||||
throw runtime_error("Number of objectives and min/max size don't match in VariableParetoTraits::setup");
|
throw std::runtime_error("Number of objectives and min/max size don't match in VariableParetoTraits::setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the accessors */
|
/** the accessors */
|
||||||
|
|
@ -76,7 +78,7 @@ public :
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (!nObj)
|
if (!nObj)
|
||||||
throw runtime_error("Number of objectives not assigned in VariableParetoTraits");
|
throw std::runtime_error("Number of objectives not assigned in VariableParetoTraits");
|
||||||
#endif
|
#endif
|
||||||
return nObj;
|
return nObj;
|
||||||
}
|
}
|
||||||
|
|
@ -84,17 +86,17 @@ public :
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (_i >= bObj.size())
|
if (_i >= bObj.size())
|
||||||
throw runtime_error("Wrong index in VariableParetoTraits");
|
throw std::runtime_error("Wrong index in VariableParetoTraits");
|
||||||
#endif
|
#endif
|
||||||
return bObj[_i];
|
return bObj[_i];
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
static unsigned nObj;
|
static unsigned nObj;
|
||||||
static vector<bool> bObj;
|
static std::vector<bool> bObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
eoParetoFitness class: vector of doubles with overloaded comparison operators. Comparison is done
|
eoParetoFitness class: std::vector of doubles with overloaded comparison operators. Comparison is done
|
||||||
on pareto dominance. The template argument FitnessTraits defaults to eoParetoFitnessTraits, which
|
on pareto dominance. The template argument FitnessTraits defaults to eoParetoFitnessTraits, which
|
||||||
can be replaces at will by any other class that implements the static functions defined therein.
|
can be replaces at will by any other class that implements the static functions defined therein.
|
||||||
|
|
||||||
|
|
@ -114,7 +116,7 @@ public :
|
||||||
/** access to the traits characteristics (so you don't have to write
|
/** access to the traits characteristics (so you don't have to write
|
||||||
* a lot of typedef's around
|
* a lot of typedef's around
|
||||||
*/
|
*/
|
||||||
static void setUp(unsigned _n, vector<bool> & _b) {FitnessTraits::setUp(_n, _b);}
|
static void setUp(unsigned _n, std::vector<bool> & _b) {FitnessTraits::setUp(_n, _b);}
|
||||||
static bool maximizing(unsigned _i) { return FitnessTraits::maximizing(_i);}
|
static bool maximizing(unsigned _i) { return FitnessTraits::maximizing(_i);}
|
||||||
|
|
||||||
/// Partial order based on Pareto-dominance
|
/// Partial order based on Pareto-dominance
|
||||||
|
|
@ -124,8 +126,8 @@ public :
|
||||||
bool dom = false;
|
bool dom = false;
|
||||||
|
|
||||||
double tol = FitnessTraits::tol();
|
double tol = FitnessTraits::tol();
|
||||||
const vector<double>& performance = *this;
|
const std::vector<double>& performance = *this;
|
||||||
const vector<double>& otherperformance = _other;
|
const std::vector<double>& otherperformance = _other;
|
||||||
|
|
||||||
for (unsigned i = 0; i < FitnessTraits::nObjectives(); ++i)
|
for (unsigned i = 0; i < FitnessTraits::nObjectives(); ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -152,8 +154,8 @@ public :
|
||||||
bool operator<(const eoParetoFitness<FitnessTraits>& _other) const
|
bool operator<(const eoParetoFitness<FitnessTraits>& _other) const
|
||||||
{
|
{
|
||||||
double tol = FitnessTraits::tol();
|
double tol = FitnessTraits::tol();
|
||||||
const vector<double>& performance = *this;
|
const std::vector<double>& performance = *this;
|
||||||
const vector<double>& otherperformance = _other;
|
const std::vector<double>& otherperformance = _other;
|
||||||
for (unsigned i = 0; i < FitnessTraits::nObjectives(); ++i)
|
for (unsigned i = 0; i < FitnessTraits::nObjectives(); ++i)
|
||||||
{
|
{
|
||||||
bool maxim = FitnessTraits::maximizing(i);
|
bool maxim = FitnessTraits::maximizing(i);
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,13 @@ public :
|
||||||
|
|
||||||
typedef parse_tree<Node>::subtree Subtree;
|
typedef parse_tree<Node>::subtree Subtree;
|
||||||
|
|
||||||
|
/* For Compatibility with the intel C++ compiler for Linux 5.x */
|
||||||
|
typedef Node reference;
|
||||||
|
typedef const reference const_reference;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Reference in a new issue