fix: remove a lot of trivial warnings

This commit is contained in:
Johann Dreo 2024-08-23 17:59:49 +02:00
commit 84148824e0
83 changed files with 218 additions and 196 deletions

View file

@ -258,9 +258,9 @@ public:
void filtre(){
eoPop<MOEOT> pop;
for(int i=0; i<size(); i++)
for(unsigned i=0; i<size(); i++)
pop.push_back(operator[](i));
for(int i=0; i<pop.size(); i++)
for(unsigned i=0; i<pop.size(); i++)
(*this)(pop[i]);
}

View file

@ -99,7 +99,11 @@ class moeoBitVector : public moeoVector < MOEOObjectiveVector, bool, MOEOFitness
if (_is)
{
resize(bits.size());
#if __cplusplus >= 201103L
std::transform(bits.begin(), bits.end(), begin(), std::bind(std::equal_to<char>(), std::placeholders::_1, '1'));
#else
std::transform(bits.begin(), bits.end(), begin(), std::bind2nd(std::equal_to<char>(), '1'));
#endif
}
}

View file

@ -52,7 +52,7 @@ class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type >
* Nothing to do
* @param _pop the population
*/
virtual void setup(const eoPop < MOEOT > & _pop)
virtual void setup(const eoPop < MOEOT > & /*_pop*/)
{}
@ -62,7 +62,7 @@ class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type >
* @param _max upper bound
* @param _obj the objective index
*/
virtual void setup(double _min, double _max, unsigned int _obj)
virtual void setup(double /*_min*/, double /*_max*/, unsigned int /*_obj*/)
{}
@ -71,7 +71,7 @@ class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type >
* @param _realInterval the eoRealInterval object
* @param _obj the objective index
*/
virtual void setup(eoRealInterval _realInterval, unsigned int _obj)
virtual void setup(eoRealInterval /*_realInterval*/, unsigned int /*_obj*/)
{}
};

View file

@ -100,7 +100,7 @@ class moeoCrowdingDiversityAssignment : public moeoDiversityAssignment < MOEOT >
* @param _objVec the objective vector
* @warning NOT IMPLEMENTED, DO NOTHING !
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoCrowdingDiversityAssignment" << std::endl;
}

View file

@ -66,7 +66,7 @@ public:
* @param _objVec the objective vector
* @warning NOT IMPLEMENTED, DO NOTHING !
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoFrontByFrontCrowdingDistanceDiversityAssignment" << std::endl;
}

View file

@ -78,7 +78,7 @@ class moeoFrontByFrontSharingDiversityAssignment : public moeoSharingDiversityAs
* @param _objVec the objective vector
* @warning NOT IMPLEMENTED, DO NOTHING !
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoSharingDiversityAssignment" << std::endl;
}

View file

@ -143,7 +143,7 @@ public:
* @param _objVec the objective vector
* @warning NOT IMPLEMENTED, DOES NOTHING !
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoNearestNeighborDiversityAssignment" << std::endl;
}

View file

@ -102,7 +102,7 @@ class moeoSharingDiversityAssignment : public moeoDiversityAssignment < MOEOT >
* @param _objVec the objective vector
* @warning NOT IMPLEMENTED, DO NOTHING !
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoSharingDiversityAssignment" << std::endl;
}

View file

@ -113,12 +113,12 @@ class moeoAggregationFitnessAssignment : public moeoSingleObjectivization < MOEO
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){}
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){}
private:
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){}
void operator()(MOEOT &/*moeo*/){}
}defaultEval;
//the vector of weight

View file

@ -135,7 +135,7 @@ class moeoConstraintFitnessAssignment : public moeoSingleObjectivization < MOEOT
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
//std::cout << "WARNING : updateByDeleting not implemented in moeoAssignmentFitnessAssignment" << std::endl;
}
@ -144,7 +144,7 @@ class moeoConstraintFitnessAssignment : public moeoSingleObjectivization < MOEOT
//dummy evaluation function
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){
void operator()(MOEOT &/*moeo*/){
}
} defaultEval;

View file

@ -119,7 +119,7 @@ public:
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountFitnessAssignment" << std::endl;
}

View file

@ -123,7 +123,7 @@ public:
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountRankingFitnessAssignment" << std::endl;
}

View file

@ -123,7 +123,7 @@ public:
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceRankFitnessAssignment" << std::endl;
}

View file

@ -74,7 +74,7 @@ class moeoDummyFitnessAssignment : public moeoFitnessAssignment < MOEOT >
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
// nothing to do... ;-)
}

View file

@ -108,8 +108,8 @@ class moeoDMLSMonOp : public eoMonOp < typename Neighbor::EOT >
tmp = rng.random(dmlsArchive.size());
_moeo = dmlsArchive[tmp];
defaultContinuator.totalGenerations(defaultContinuator.totalGenerations());
if(verbose)
std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl;
if(verbose) {
std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl; }
return false;
}

View file

@ -318,8 +318,8 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
//if there are less than 3 objectifs take the fisrt objectif of the first point of front to begin computation of hypervolume
if(_no_objectives < 3){
if(_no_objectives < 1)
throw("Error in moeoHyperVolumeUnaryMetric::calc_hypervolume -> argument3: _no_objectives must be greater than 0");
if(_no_objectives < 1) {
throw("Error in moeoHyperVolumeUnaryMetric::calc_hypervolume -> argument3: _no_objectives must be greater than 0"); }
temp_vol=_front[0][0];
}
//else if there at least 3 objectives, a recursive computation of hypervolume starts with _no_objectives -1 on the filter_nondominated_set calculating previously.

View file

@ -54,7 +54,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT >
* equivalent to "number one element should be on top of number two element" in the list by looking to the first obj
*/
struct CompareByFirst
#if __cplusplus >= 201103L
: std::function< bool(entree, entree) > {
#else
: std::binary_function< bool, entree, entree > {
#endif
bool operator ()(
const entree& elem1,
const entree& elem2
@ -71,7 +75,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT >
* equivalent to "number one element should be on top of number two element" in the list by looking to the 2nd obj
*/
struct CompareByLast
#if __cplusplus >= 201103L
: std::function< bool(entree, entree) > {
#else
: std::binary_function< bool, entree, entree > {
#endif
bool operator ()(
const entree& elem1,
const entree& elem2
@ -87,7 +95,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT >
struct CompareByLast2
#if __cplusplus >= 201103L
: std::function< bool(MOEOT, MOEOT) > {
#else
: std::binary_function< bool, MOEOT, MOEOT > {
#endif
bool operator ()(
const MOEOT& elem1,
const MOEOT& elem2

View file

@ -111,7 +111,7 @@ class moeoAchievementFitnessAssignment : public moeoScalarFitnessAssignment < MO
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
// nothing to do ;-)
}

View file

@ -127,12 +127,12 @@ class moeoAchievementScalarizingFunctionMetricFitnessAssignment : public moeoSin
* @param _pop the populing
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){}
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){}
private:
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){
void operator()(MOEOT &/*moeo*/){
}
} defaultEval;

View file

@ -138,7 +138,7 @@ class moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment : publi
* @param _pop the populing
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
}
@ -146,7 +146,7 @@ class moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment : publi
private:
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){
void operator()(MOEOT &/*moeo*/){
}
} defaultEval;

View file

@ -124,12 +124,12 @@ class moeoAugmentedWeightedChebychevMetricFitnessAssignment : public moeoSingleO
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){}
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){}
private:
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){
void operator()(MOEOT &/*moeo*/){
}
} defaultEval;

View file

@ -129,12 +129,12 @@ class moeoWeightedChebychevMetricFitnessAssignment : public moeoSingleObjectiviz
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){}
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){}
private:
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){
void operator()(MOEOT &/*moeo*/){
}
} defaultEval;

View file

@ -57,7 +57,7 @@ class moeoDetArchiveSelect : public eoSelect<MOEOT>
* @param _source compatibility parameter, not used
* @param _dest destination population, selected from archive
*/
void operator()(const eoPop < MOEOT > & _source, eoPop < MOEOT > & _dest)
void operator()(const eoPop < MOEOT > & /*_source*/, eoPop < MOEOT > & _dest)
{
if(max < min){
std::cout << "Warning! moeoDetArchiveSelect: min value > max value!!! Nothing is done." << std::endl;
@ -74,8 +74,11 @@ class moeoDetArchiveSelect : public eoSelect<MOEOT>
std::vector <int> permutation;
for(unsigned int i=0; i < archive_size; i++)
permutation.push_back(i);
UF_random_generator<unsigned int> rndGen(permutation.size());
random_shuffle(permutation.begin(), permutation.end(), rndGen);
// UF_random_generator<unsigned int> rndGen(permutation.size());
// random_shuffle(permutation.begin(), permutation.end(), rndGen);
std::random_device rd;
std::mt19937 gen(rd());
std::shuffle(permutation.begin(), permutation.end(), gen);
for (unsigned int i=0; i<max; i++)
_dest.push_back(archive[permutation[i]]);
}