Skip to content

Commit

Permalink
fix: remove a lot of trivial warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreo committed Aug 23, 2024
1 parent a16298c commit 8414882
Show file tree
Hide file tree
Showing 83 changed files with 218 additions and 196 deletions.
3 changes: 1 addition & 2 deletions edo/src/utils/edoFileSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ edoFileSnapshot::edoFileSnapshot(std::string dirname,
s = " ";
}

int dummy;
dummy = system(s.c_str());
(void)/*ignore returned*/ system(s.c_str());
// all done

_descOfFiles = new std::ofstream( std::string(dirname + "/list_of_files.txt").c_str() );
Expand Down
8 changes: 4 additions & 4 deletions eo/src/eoPartiallyMappedXover.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class eoPartiallyMappedXover : public eoQuadOp<EOT>

// replace if necessary
for(i = 0; i < i1; i++) {
while (p1[ _solution1[i] ] != -1)
while (p1[ _solution1[i] ] != -1) // FIXME as an unsigned int, p1 cannot hold negative values!
_solution1[i] = p1[_solution1[i]];
while (p2[ _solution2[i] ] != -1)
while (p2[ _solution2[i] ] != -1) // FIXME as an unsigned int, p2 cannot hold negative values!
_solution2[i] = p2[_solution2[i]];
}

Expand All @@ -96,9 +96,9 @@ class eoPartiallyMappedXover : public eoQuadOp<EOT>

// replace if necessary
for(i = i2 + 1; i < _solution1.size(); i++) {
while (p1[ _solution1[i] ] != -1)
while (p1[ _solution1[i] ] != -1) // FIXME as an unsigned int, p1 cannot hold negative values!
_solution1[i] = p1[_solution1[i]];
while (p2[ _solution2[i] ] != -1)
while (p2[ _solution2[i] ] != -1) // FIXME as an unsigned int, p2 cannot hold negative values!
_solution2[i] = p2[_solution2[i]];
}

Expand Down
4 changes: 4 additions & 0 deletions eo/src/gp/eoParseTreeDepthInit.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ class eoParseTreeDepthInit : public eoInit< eoParseTree<FType, Node> >
protected:
// a binary predicate for sorting
// hopefully this will work with M$VC++ 6.0
#if __cplusplus >= 201103L
struct lt_arity:public std::function<bool(Node,Node)>
#else
struct lt_arity:public std::binary_function<Node,Node,bool>
#endif
{
bool operator()(const Node &_node1, const Node &_node2) { return (_node1.arity() < _node2.arity());};
};
Expand Down
2 changes: 0 additions & 2 deletions eo/test/t-eoCheckpointing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public :
int the_main(int argc, char **argv)
{ // ok, we have a command line parser and a state

typedef eoBit<float> Chrom;

eoParser parser(argc, argv);

// Define Parameters
Expand Down
2 changes: 1 addition & 1 deletion eo/test/t-eoSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ eoValueParam<unsigned> tournamentSizeParam = parser.createParam(unsigned(2), "to
}

// hard-coded directory name ...
const int ignored = system("mkdir ResSelect");
(void) system("mkdir ResSelect");
std::cout << "Testing the Selections\nParents size = " << pSize
<< ", offspring rate = " << oRate;
std::cout << " and putting rsulting files in dir ResSelect" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion eo/test/t-eoSharing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ int the_main(int argc, char **argv)

std::cout << "The resulting file (in dir ResSelect), contains \n";
std::cout << " the empirical proba. for each indi to be selected." << std::endl;
const int ignored = system("mkdir ResSelect");
(void) system("mkdir ResSelect");

// initialize parent population
parentsOrg.resize(pSize);
Expand Down
2 changes: 0 additions & 2 deletions eo/test/t-eoStateAndParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ struct Dummy : public EO<double>
int the_main(int argc, char **argv)
{ // ok, we have a command line parser and a state

typedef eoBit<float> Chrom;

eoParser parser(argc, argv);

// Define Parameters
Expand Down
6 changes: 5 additions & 1 deletion mo/src/continuator/moFullEvalContinuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ class moFullEvalContinuator : public moContinuator<Neighbor>
* @param _maxFullEval number maximum of iterations
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
*/
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval, bool _restartCounter = true): eval(_eval), maxFullEval(_maxFullEval), restartCounter(_restartCounter) {
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval, bool _restartCounter = true):
eval(_eval),
restartCounter(_restartCounter),
maxFullEval(_maxFullEval)
{
nbEval_start = eval.value();
}

Expand Down
2 changes: 1 addition & 1 deletion mo/src/continuator/moNeighborhoodStat.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public :

if (nb > 1) {
sd = 0;
for(int i = 0; i < nb; i++)
for(unsigned i = 0; i < nb; i++)
sd += (neighborFitness[i] - mean) * (neighborFitness[i] - mean) ;
sd = sqrt( sd / (nb - 1.0) ); // becareful: could be infinite when large values
//sd = sqrt( (sd - nb * mean * mean) / (nb - 1.0) ); // becareful: could be negative due to approximation of large values
Expand Down
4 changes: 2 additions & 2 deletions mo/src/continuator/moQuartilesNeighborStat.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public :
* Set the first and the third quartile of fitness in the neighborhood
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
virtual void init(EOT & /*_sol*/) {
value().first = nhStat.getQ1();
value().second = nhStat.getQ3();
}
Expand All @@ -71,7 +71,7 @@ public :
* Set the first and the third quartile fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
virtual void operator()(EOT & /*_sol*/) {
value().first = nhStat.getQ1();
value().second = nhStat.getQ3();
}
Expand Down
4 changes: 2 additions & 2 deletions mo/src/neighborhood/moNeighbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class moNeighbor: public EO<Fitness> {
* @param _neighbor the neighbor to assign
* @return a neighbor equal to the other
*/
virtual moNeighbor<EOT, Fitness>& operator=(
moNeighbor<EOT, Fitness>& operator=(
const moNeighbor<EOT, Fitness>& _neighbor) {
if (!(_neighbor.invalid()))
fitness(_neighbor.fitness());
Expand All @@ -93,7 +93,7 @@ class moNeighbor: public EO<Fitness> {
* @param _neighbor a neighbor
* @return if _neighbor and this one are equals
*/
virtual bool equals(moNeighbor<EOT, Fitness> & /*_neighbor*/) {
bool equals(moNeighbor<EOT, Fitness> & /*_neighbor*/) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion mo/src/problems/eval/moNKlandscapesIncrEval.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class moNKlandscapesIncrEval : public moEval<Neighbor>
nonSig = 0;

unsigned int n = 1;
for(int j = 0; j < nk.K + 1; j++) {
for(unsigned j = 0; j < nk.K + 1; j++) {
if (_solution[ nk.links[i][j] ] == 1)
sig = sig | n;

Expand Down
26 changes: 13 additions & 13 deletions mo/src/sampling/moAdaptiveWalkSampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,26 @@ class moAdaptiveWalkSampling : public moSampling<Neighbor>
moEval<Neighbor>& _eval,
unsigned int _nbAdaptWalk) :
moSampling<Neighbor>(initHC, * new moRandomSearch<Neighbor>(initHC, _fullEval, _nbAdaptWalk), copyStat),
neighborEvalCount(_eval),
nEvalStat(neighborEvalCount, true),
copyStat(lengthStat), // copy is used to report the statistic of the first walk
neighborEvalCount(_eval),
nEvalStat(neighborEvalCount, true),
copyEvalStat(nEvalStat),
copyStat(lengthStat), // copy is used to report the statistic of the first walk
checkpoint(trueCont),
hc(_neighborhood, _fullEval, neighborEvalCount, checkpoint),
initHC(_init, hc)
{
// to count the number of step in the HC
checkpoint.add(lengthStat);

// set the long name of this statistic which is the length of the walk
copyStat.setLongName("length");
// set the long name of this statistic which is the length of the walk
copyStat.setLongName("length");

// to count the number of evaluations
// to count the number of evaluations
checkpoint.add(nEvalStat);

// set the long name of this statistic which is the number of neighbor evaluation
copyEvalStat.setLongName("ngheval");
// set the long name of this statistic which is the number of neighbor evaluation
copyEvalStat.setLongName("ngheval");

// add the solution into statistics
this->add(copyEvalStat);
this->add(solStat);
Expand All @@ -118,10 +118,10 @@ class moAdaptiveWalkSampling : public moSampling<Neighbor>
}

protected:
/* count the number of evaluations */
moEvalCounter<Neighbor> neighborEvalCount;
moValueStat<EOT, unsigned long> nEvalStat;
moStatFromStat<EOT, double> copyEvalStat;
/* count the number of evaluations */
moEvalCounter<Neighbor> neighborEvalCount;
moValueStat<EOT, unsigned long> nEvalStat;
moStatFromStat<EOT, double> copyEvalStat;

moSolutionStat<EOT> solStat;
moMinusOneCounterStat<EOT> lengthStat;
Expand Down
2 changes: 1 addition & 1 deletion mo/src/sampling/moNeutralWalkSampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ class moNeutralWalkSampling : public moSampling<Neighbor>
moSolutionStat<EOT> solutionStat;
moDistanceStat<EOT> distStat;
moNeighborhoodStat< Neighbor > neighborhoodStat;
moMinNeighborStat< Neighbor > minStat;
moAverageFitnessNeighborStat< Neighbor > averageStat;
moStdFitnessNeighborStat< Neighbor > stdStat;
moMinNeighborStat< Neighbor > minStat;
moMaxNeighborStat< Neighbor > maxStat;
moNbSupNeighborStat< Neighbor > nbSupStat;
moNbInfNeighborStat< Neighbor > nbInfStat;
Expand Down
16 changes: 8 additions & 8 deletions mo/test/moTestClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ typedef EO<int> Solution;

class moDummyNeighborTest: public moNeighbor<Solution> {
public:
virtual void move(Solution & _solution) {
virtual void move(Solution & /*_solution*/) {
}
};

class moDummyBackableNeighbor: public moBackableNeighbor<Solution> {
public:
virtual void move(Solution & _solution) {
virtual void move(Solution & /*_solution*/) {
}
virtual void moveBack(Solution & _solution) {
virtual void moveBack(Solution & /*_solution*/) {
}
};

Expand All @@ -91,7 +91,7 @@ class moDummyNeighborhoodTest: public moNeighborhood<moDummyNeighborTest> {
i(0), j(0) {
}

virtual bool hasNeighbor(EOT & _solution) {
virtual bool hasNeighbor(EOT & /*_solution*/) {
bool res;
if (i % 3 == 0 || i == 1)
res = false;
Expand All @@ -100,11 +100,11 @@ class moDummyNeighborhoodTest: public moNeighborhood<moDummyNeighborTest> {
i++;
return res;
}
virtual void init(EOT & _solution, Neighbor & _current) {
virtual void init(EOT & /*_solution*/, Neighbor & /*_current*/) {
}
virtual void next(EOT & _solution, Neighbor & _current) {
virtual void next(EOT & /*_solution*/, Neighbor & /*_current*/) {
}
virtual bool cont(EOT & _solution) {
virtual bool cont(EOT & /*_solution*/) {
j++;
return (j % 10 != 0);
}
Expand Down Expand Up @@ -227,7 +227,7 @@ class updater1: public eoUpdater {

class dummyInit: public eoInit<bitVector> {
public:
void operator()(bitVector& sol) {
void operator()(bitVector& /*sol*/) {
}
};

Expand Down
4 changes: 2 additions & 2 deletions moeo/src/archive/moeoEpsilonHyperboxArchive.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ class moeoEpsilonHyperboxArchive : public moeoArchive < MOEOT >

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]);
}

Expand Down
4 changes: 4 additions & 0 deletions moeo/src/core/moeoBitVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
6 changes: 3 additions & 3 deletions moeo/src/distance/moeoDistance.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*/)
{}


Expand All @@ -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*/)
{}


Expand All @@ -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*/)
{}

};
Expand Down
2 changes: 1 addition & 1 deletion moeo/src/diversity/moeoCrowdingDiversityAssignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class moeoFrontByFrontCrowdingDiversityAssignment : public moeoCrowdingDiversity
* @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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class moeoNearestNeighborDiversityAssignment : public moeoDiversityAssignment <
* @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;
}
Expand Down
2 changes: 1 addition & 1 deletion moeo/src/diversity/moeoSharingDiversityAssignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions moeo/src/fitness/moeoAggregationFitnessAssignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions moeo/src/fitness/moeoConstraintFitnessAssignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;

Expand Down
Loading

0 comments on commit 8414882

Please sign in to comment.