Suppress warnings when compiling MOEO functions returning const
When compiling whith --Wignored-qualifiers, g++ no more warns about ignoring const in methods *returning* a const, which isn't logical.
This commit is contained in:
parent
b06250dc39
commit
bda48533e8
14 changed files with 36 additions and 37 deletions
|
|
@ -62,7 +62,7 @@ class moeoAggregativeComparator : public moeoComparator < MOEOT >
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
{
|
{
|
||||||
return ( weightFitness * _moeo1.fitness() + weightDiversity * _moeo1.diversity() ) < ( weightFitness * _moeo2.fitness() + weightDiversity * _moeo2.diversity() );
|
return ( weightFitness * _moeo1.fitness() + weightDiversity * _moeo1.diversity() ) < ( weightFitness * _moeo2.fitness() + weightDiversity * _moeo2.diversity() );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class moeoDiversityThenFitnessComparator : public moeoComparator < MOEOT >
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
{
|
{
|
||||||
if (_moeo1.diversity() == _moeo2.diversity())
|
if (_moeo1.diversity() == _moeo2.diversity())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public:
|
||||||
* @param _objectiveVector1 the first objective vector
|
* @param _objectiveVector1 the first objective vector
|
||||||
* @param _objectiveVector2 the second objective vector
|
* @param _objectiveVector2 the second objective vector
|
||||||
*/
|
*/
|
||||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class moeoFitnessComparator : public moeoComparator < MOEOT >
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
{
|
{
|
||||||
return _moeo1.fitness() < _moeo2.fitness();
|
return _moeo1.fitness() < _moeo2.fitness();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class moeoFitnessThenDiversityComparator : public moeoComparator < MOEOT >
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
{
|
{
|
||||||
if (_moeo1.fitness() == _moeo2.fitness())
|
if (_moeo1.fitness() == _moeo2.fitness())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class moeoGDominanceObjectiveVectorComparator : public moeoObjectiveVectorCompar
|
||||||
* @param _objectiveVector1 the first objective vector
|
* @param _objectiveVector1 the first objective vector
|
||||||
* @param _objectiveVector2 the second objective vector
|
* @param _objectiveVector2 the second objective vector
|
||||||
*/
|
*/
|
||||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||||
{
|
{
|
||||||
unsigned int flag1 = flag(_objectiveVector1);
|
unsigned int flag1 = flag(_objectiveVector1);
|
||||||
unsigned int flag2 = flag(_objectiveVector2);
|
unsigned int flag2 = flag(_objectiveVector2);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class moeoObjectiveObjectiveVectorComparator : public moeoObjectiveVectorCompara
|
||||||
* @param _objectiveVector1 the first objective vector
|
* @param _objectiveVector1 the first objective vector
|
||||||
* @param _objectiveVector2 the second objective vector
|
* @param _objectiveVector2 the second objective vector
|
||||||
*/
|
*/
|
||||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class moeoOneObjectiveComparator : public moeoComparator < MOEOT >
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
{
|
{
|
||||||
return _moeo1.objectiveVector()[obj] < _moeo2.objectiveVector()[obj];
|
return _moeo1.objectiveVector()[obj] < _moeo2.objectiveVector()[obj];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class moeoParetoObjectiveVectorComparator : public moeoObjectiveVectorComparator
|
||||||
* @param _objectiveVector1 the first objective vector
|
* @param _objectiveVector1 the first objective vector
|
||||||
* @param _objectiveVector2 the second objective vector
|
* @param _objectiveVector2 the second objective vector
|
||||||
*/
|
*/
|
||||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||||
{
|
{
|
||||||
bool dom = false;
|
bool dom = false;
|
||||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||||
|
|
|
||||||
|
|
@ -29,25 +29,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template < class MOEOT >
|
template < class MOEOT >
|
||||||
class moeoPtrComparator : public eoBF < const MOEOT *, const MOEOT *, const bool >
|
class moeoPtrComparator : public eoBF < const MOEOT *, const MOEOT *, bool >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ctor with a comparator
|
* Ctor with a comparator
|
||||||
* @param _cmp comparator to be employed
|
* @param _cmp comparator to be employed
|
||||||
|
|
||||||
*/
|
*/
|
||||||
moeoPtrComparator( moeoComparator<MOEOT> & _cmp) : cmp(_cmp) {}
|
moeoPtrComparator( moeoComparator<MOEOT> & _cmp) : cmp(_cmp) {}
|
||||||
|
|
||||||
/** compare two const individuals */
|
/** compare two const individuals */
|
||||||
const bool operator() (const MOEOT *ptr1, const MOEOT *ptr2)
|
bool operator() (const MOEOT *ptr1, const MOEOT *ptr2)
|
||||||
{
|
{
|
||||||
return cmp(*ptr1, *ptr2);
|
return cmp(*ptr1, *ptr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** compare two non const individuals */
|
/** compare two non const individuals */
|
||||||
const bool operator() (MOEOT *ptr1, MOEOT *ptr2)
|
bool operator() (MOEOT *ptr1, MOEOT *ptr2)
|
||||||
{
|
{
|
||||||
return cmp(*ptr1, *ptr2);
|
return cmp(*ptr1, *ptr2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public:
|
||||||
* @param _objectiveVector1 the first objective vector
|
* @param _objectiveVector1 the first objective vector
|
||||||
* @param _objectiveVector2 the second objective vector
|
* @param _objectiveVector2 the second objective vector
|
||||||
*/
|
*/
|
||||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public:
|
||||||
* @param _objectiveVector1 the first objective vector
|
* @param _objectiveVector1 the first objective vector
|
||||||
* @param _objectiveVector2 the second objective vector
|
* @param _objectiveVector2 the second objective vector
|
||||||
*/
|
*/
|
||||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class moeoManhattanDistance : public moeoObjSpaceDistance < MOEOT >
|
||||||
* @param _obj1 the first objective vector
|
* @param _obj1 the first objective vector
|
||||||
* @param _obj2 the second objective vector
|
* @param _obj2 the second objective vector
|
||||||
*/
|
*/
|
||||||
const double operator()(const ObjectiveVector & _obj1, const ObjectiveVector & _obj2)
|
double operator()(const ObjectiveVector & _obj1, const ObjectiveVector & _obj2)
|
||||||
{
|
{
|
||||||
double result = 0.0;
|
double result = 0.0;
|
||||||
double tmp1, tmp2;
|
double tmp1, tmp2;
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ class moeoDominanceDepthFitnessAssignment : public moeoDominanceBasedFitnessAssi
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
{
|
{
|
||||||
return cmp(_moeo1.objectiveVector(), _moeo2.objectiveVector());
|
return cmp(_moeo1.objectiveVector(), _moeo2.objectiveVector());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue