diff --git a/eo/src/eoParetoFitness.h b/eo/src/eoParetoFitness.h index 4634c9f4..44594937 100644 --- a/eo/src/eoParetoFitness.h +++ b/eo/src/eoParetoFitness.h @@ -30,7 +30,7 @@ #include #include #include - +#include /** * 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; diff --git a/eo/src/eoRealBoundModifier.h b/eo/src/eoRealBoundModifier.h index b309a483..d9fa099e 100644 --- a/eo/src/eoRealBoundModifier.h +++ b/eo/src/eoRealBoundModifier.h @@ -46,7 +46,11 @@ public: eoDummyRealBoundModifier (){} - void operator() (eoRealBaseVectorBounds & _bnds,unsigned _i){} + void operator() (eoRealBaseVectorBounds & _bnds,unsigned _i) + { + (void)_bnds; + (void)_i; + } }; diff --git a/eo/src/utils/eoIntBounds.h b/eo/src/utils/eoIntBounds.h index 59c98c03..074c0836 100644 --- a/eo/src/utils/eoIntBounds.h +++ b/eo/src/utils/eoIntBounds.h @@ -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();} diff --git a/eo/src/utils/eoRealBounds.h b/eo/src/utils/eoRealBounds.h index 12cb7b46..d67f4450 100644 --- a/eo/src/utils/eoRealBounds.h +++ b/eo/src/utils/eoRealBounds.h @@ -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();} diff --git a/eo/src/utils/eoRealVectorBounds.h b/eo/src/utils/eoRealVectorBounds.h index 11144b39..7cdbcb61 100644 --- a/eo/src/utils/eoRealVectorBounds.h +++ b/eo/src/utils/eoRealVectorBounds.h @@ -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 &, eoRng & _rng = eo::rng) { + (void)_rng; + throw std::logic_error("No uniform distribution on eoRealVectorNoBounds"); }