* fixed some warning issues during compilation

This commit is contained in:
Caner Candan 2010-08-31 14:10:13 +02:00
commit ce8f5f692f
5 changed files with 74 additions and 26 deletions

View file

@ -30,7 +30,7 @@
#include <vector>
#include <stdexcept>
#include <iostream>
#include <utils/eoLogger.h>
/**
* eoFitnessTraits: a traits class to specify
@ -45,7 +45,7 @@ class eoParetoFitnessTraits
static unsigned nObjectives() { return 2; }
static double tol() { return 1e-6; }
static bool maximizing(int which) { return true; } // by default: all are maximizing
static bool maximizing(int which) { (void)which; return true; } // by default: all are maximizing
};
/**
@ -62,10 +62,11 @@ public :
// possible problems
if ( nObj && (nObj != _n) ) // was already set to a different value
{
std::cout << "WARNING\n";
std::cout << "WARNING : you are changing the number of objectives\n";
std::cout << "WARNING : Make sure all existing objects are destroyed\n";
std::cout << "WARNING\n";
eo::log << eo::warnings;
eo::log << "WARNING\n";
eo::log << "WARNING : you are changing the number of objectives\n";
eo::log << "WARNING : Make sure all existing objects are destroyed\n";
eo::log << "WARNING\n";
}
nObj=_n;
bObj=_b;

View file

@ -46,7 +46,11 @@ public:
eoDummyRealBoundModifier (){}
void operator() (eoRealBaseVectorBounds & _bnds,unsigned _i){}
void operator() (eoRealBaseVectorBounds & _bnds,unsigned _i)
{
(void)_bnds;
(void)_i;
}
};

View file

@ -176,12 +176,17 @@ public:
throw std::logic_error("Trying to get range of unbounded eoIntBounds");
}
virtual double uniform(eoRng & _rng = eo::rng) const
virtual double uniform(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in unbounded eoIntBounds");
}
virtual long int random(eoRng & _rng = eo::rng) const
virtual long int random(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in unbounded eoIntBounds");
}
@ -192,8 +197,10 @@ public:
* but reading should not be done here, because of bound problems
* see eoIntVectorBounds
*/
virtual void readFrom(std::istream& _is)
virtual void readFrom(std::istream& _is)
{
(void)_is;
throw std::runtime_error("Should not use eoIntBounds::readFrom");
}
@ -312,8 +319,10 @@ public :
* but reading should not be done here, because of bound problems
* see eoIntVectorBounds
*/
virtual void readFrom(std::istream& _is)
virtual void readFrom(std::istream& _is)
{
(void)_is;
throw std::runtime_error("Should not use eoIntInterval::readFrom");
}
@ -364,12 +373,17 @@ public :
throw std::logic_error("Trying to get range of eoIntBelowBound");
}
virtual double uniform(eoRng & _rng = eo::rng) const
virtual double uniform(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in eoIntBelowBound");
}
virtual long int random(eoRng & _rng = eo::rng) const
virtual long int random(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in eoIntBelowBound");
}
@ -411,8 +425,10 @@ public :
* but reading should not be done here, because of bound problems
* see eoIntVectorBounds
*/
virtual void readFrom(std::istream& _is)
virtual void readFrom(std::istream& _is)
{
(void)_is;
throw std::runtime_error("Should not use eoIntBelowBound::readFrom");
}
@ -462,12 +478,17 @@ public :
throw std::logic_error("Trying to get range of eoIntAboveBound");
}
virtual double uniform(eoRng & _rng = eo::rng) const
virtual double uniform(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in eoIntAboveBound");
}
virtual long int random(eoRng & _rng = eo::rng) const
virtual long int random(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in eoIntAboveBound");
}
@ -509,8 +530,10 @@ public :
* but reading should not be done here, because of bound problems
* see eoIntVectorBounds
*/
virtual void readFrom(std::istream& _is)
virtual void readFrom(std::istream& _is)
{
(void)_is;
throw std::runtime_error("Should not use eoIntAboveBound::readFrom");
}
@ -650,12 +673,12 @@ public:
/** random generator of uniform doubles in bounds
* @std::exception if unbounded
*/
virtual double uniform(eoRng & _rng = eo::rng) const {return repBound->uniform();}
virtual double uniform(eoRng & _rng = eo::rng) const {(void)_rng; return repBound->uniform();}
/** random generator of uniform ints in bounds
* @std::exception if unbounded
*/
virtual long int random(eoRng & _rng = eo::rng) const {return repBound->random();}
virtual long int random(eoRng & _rng = eo::rng) const {(void)_rng; return repBound->random();}
/** for memory managements - ugly */
virtual eoIntBounds * dup() const {return repBound->dup();}

View file

@ -158,6 +158,8 @@ public:
virtual double uniform(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in unbounded eoRealBounds");
}
@ -168,8 +170,10 @@ public:
* but reading should not be done here, because of bound problems
* see eoRealVectorBounds
*/
virtual void readFrom(std::istream& _is)
virtual void readFrom(std::istream& _is)
{
(void)_is;
throw std::runtime_error("Should not use eoRealBounds::readFrom");
}
@ -283,8 +287,10 @@ public :
* but reading should not be done here, because of bound problems
* see eoRealVectorBounds
*/
virtual void readFrom(std::istream& _is)
virtual void readFrom(std::istream& _is)
{
(void)_is;
throw std::runtime_error("Should not use eoRealInterval::readFrom");
}
@ -336,8 +342,10 @@ public :
}
// random generators
virtual double uniform(eoRng & _rng = eo::rng) const
virtual double uniform(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in eoRealBelowBound");
}
@ -381,6 +389,8 @@ public :
*/
virtual void readFrom(std::istream& _is)
{
(void)_is;
throw std::runtime_error("Should not use eoRealBelowBound::readFrom");
}
@ -431,8 +441,10 @@ public :
}
// random generators
virtual double uniform(eoRng & _rng = eo::rng) const
virtual double uniform(eoRng & _rng = eo::rng) const
{
(void)_rng;
throw std::logic_error("Trying to generate uniform values in eoRealAboveBound");
}
@ -474,8 +486,10 @@ public :
* but reading should not be done here, because of bound problems
* see eoRealVectorBounds
*/
virtual void readFrom(std::istream& _is)
virtual void readFrom(std::istream& _is)
{
(void)_is;
throw std::runtime_error("Should not use eoRealAboveBound::readFrom");
}
@ -615,7 +629,7 @@ public:
/** random generator of uniform numbers in bounds
* @std::exception if unbounded
*/
virtual double uniform(eoRng & _rng = eo::rng) const {return repBound->uniform();}
virtual double uniform(eoRng & _rng = eo::rng) const {(void)_rng; return repBound->uniform();}
/** for memory managements - ugly */
virtual eoRealBounds * dup() const {return repBound->dup();}

View file

@ -190,7 +190,9 @@ public:
* An std::exception will be raised if one of the component is unbounded
*/
virtual double uniform(unsigned _i, eoRng & _rng = eo::rng)
{
{
(void)_rng;
double r= (*this)[_i]->uniform();
return r;
}
@ -403,12 +405,16 @@ public:
// random generators
virtual double uniform(unsigned, eoRng & _rng = eo::rng)
{
(void)_rng;
throw std::logic_error("No uniform distribution on eoRealVectorNoBounds");
}
// fills a std::vector with uniformly chosen variables in bounds
void uniform(std::vector<double> &, eoRng & _rng = eo::rng)
{
(void)_rng;
throw std::logic_error("No uniform distribution on eoRealVectorNoBounds");
}