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

@ -76,8 +76,7 @@ edoFileSnapshot::edoFileSnapshot(std::string dirname,
s = " "; s = " ";
} }
int dummy; (void)/*ignore returned*/ system(s.c_str());
dummy = system(s.c_str());
// all done // all done
_descOfFiles = new std::ofstream( std::string(dirname + "/list_of_files.txt").c_str() ); _descOfFiles = new std::ofstream( std::string(dirname + "/list_of_files.txt").c_str() );

View file

@ -82,9 +82,9 @@ public:
// replace if necessary // replace if necessary
for(i = 0; i < i1; i++) { 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]]; _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]]; _solution2[i] = p2[_solution2[i]];
} }
@ -96,9 +96,9 @@ public:
// replace if necessary // replace if necessary
for(i = i2 + 1; i < _solution1.size(); i++) { 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]]; _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]]; _solution2[i] = p2[_solution2[i]];
} }

View file

@ -50,7 +50,11 @@ class eoParseTreeDepthInit : public eoInit< eoParseTree<FType, Node> >
protected: protected:
// a binary predicate for sorting // a binary predicate for sorting
// hopefully this will work with M$VC++ 6.0 // 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> struct lt_arity:public std::binary_function<Node,Node,bool>
#endif
{ {
bool operator()(const Node &_node1, const Node &_node2) { return (_node1.arity() < _node2.arity());}; bool operator()(const Node &_node1, const Node &_node2) { return (_node1.arity() < _node2.arity());};
}; };

View file

@ -31,8 +31,6 @@ public :
int the_main(int argc, char **argv) int the_main(int argc, char **argv)
{ // ok, we have a command line parser and a state { // ok, we have a command line parser and a state
typedef eoBit<float> Chrom;
eoParser parser(argc, argv); eoParser parser(argc, argv);
// Define Parameters // Define Parameters

View file

@ -126,7 +126,7 @@ eoValueParam<unsigned> tournamentSizeParam = parser.createParam(unsigned(2), "to
} }
// hard-coded directory name ... // hard-coded directory name ...
const int ignored = system("mkdir ResSelect"); (void) system("mkdir ResSelect");
std::cout << "Testing the Selections\nParents size = " << pSize std::cout << "Testing the Selections\nParents size = " << pSize
<< ", offspring rate = " << oRate; << ", offspring rate = " << oRate;
std::cout << " and putting rsulting files in dir ResSelect" << std::endl; std::cout << " and putting rsulting files in dir ResSelect" << std::endl;

View file

@ -193,7 +193,7 @@ int the_main(int argc, char **argv)
std::cout << "The resulting file (in dir ResSelect), contains \n"; std::cout << "The resulting file (in dir ResSelect), contains \n";
std::cout << " the empirical proba. for each indi to be selected." << std::endl; 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 // initialize parent population
parentsOrg.resize(pSize); parentsOrg.resize(pSize);

View file

@ -37,8 +37,6 @@ struct Dummy : public EO<double>
int the_main(int argc, char **argv) int the_main(int argc, char **argv)
{ // ok, we have a command line parser and a state { // ok, we have a command line parser and a state
typedef eoBit<float> Chrom;
eoParser parser(argc, argv); eoParser parser(argc, argv);
// Define Parameters // Define Parameters

View file

@ -54,7 +54,11 @@ public:
* @param _maxFullEval number maximum of iterations * @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 * @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(); nbEval_start = eval.value();
} }

View file

@ -167,7 +167,7 @@ public :
if (nb > 1) { if (nb > 1) {
sd = 0; sd = 0;
for(int i = 0; i < nb; i++) for(unsigned i = 0; i < nb; i++)
sd += (neighborFitness[i] - mean) * (neighborFitness[i] - mean) ; sd += (neighborFitness[i] - mean) * (neighborFitness[i] - mean) ;
sd = sqrt( sd / (nb - 1.0) ); // becareful: could be infinite when large values 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 //sd = sqrt( (sd - nb * mean * mean) / (nb - 1.0) ); // becareful: could be negative due to approximation of large values

View file

@ -62,7 +62,7 @@ public :
* Set the first and the third quartile of fitness in the neighborhood * Set the first and the third quartile of fitness in the neighborhood
* @param _sol the first solution * @param _sol the first solution
*/ */
virtual void init(EOT & _sol) { virtual void init(EOT & /*_sol*/) {
value().first = nhStat.getQ1(); value().first = nhStat.getQ1();
value().second = nhStat.getQ3(); value().second = nhStat.getQ3();
} }
@ -71,7 +71,7 @@ public :
* Set the first and the third quartile fitness in the neighborhood * Set the first and the third quartile fitness in the neighborhood
* @param _sol the corresponding solution * @param _sol the corresponding solution
*/ */
virtual void operator()(EOT & _sol) { virtual void operator()(EOT & /*_sol*/) {
value().first = nhStat.getQ1(); value().first = nhStat.getQ1();
value().second = nhStat.getQ3(); value().second = nhStat.getQ3();
} }

View file

@ -72,7 +72,7 @@ public:
* @param _neighbor the neighbor to assign * @param _neighbor the neighbor to assign
* @return a neighbor equal to the other * @return a neighbor equal to the other
*/ */
virtual moNeighbor<EOT, Fitness>& operator=( moNeighbor<EOT, Fitness>& operator=(
const moNeighbor<EOT, Fitness>& _neighbor) { const moNeighbor<EOT, Fitness>& _neighbor) {
if (!(_neighbor.invalid())) if (!(_neighbor.invalid()))
fitness(_neighbor.fitness()); fitness(_neighbor.fitness());
@ -93,7 +93,7 @@ public:
* @param _neighbor a neighbor * @param _neighbor a neighbor
* @return if _neighbor and this one are equals * @return if _neighbor and this one are equals
*/ */
virtual bool equals(moNeighbor<EOT, Fitness> & /*_neighbor*/) { bool equals(moNeighbor<EOT, Fitness> & /*_neighbor*/) {
return false; return false;
} }

View file

@ -112,7 +112,7 @@ private:
nonSig = 0; nonSig = 0;
unsigned int n = 1; 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) if (_solution[ nk.links[i][j] ] == 1)
sig = sig | n; sig = sig | n;

View file

@ -86,8 +86,8 @@ public:
moSampling<Neighbor>(initHC, * new moRandomSearch<Neighbor>(initHC, _fullEval, _nbAdaptWalk), copyStat), moSampling<Neighbor>(initHC, * new moRandomSearch<Neighbor>(initHC, _fullEval, _nbAdaptWalk), copyStat),
neighborEvalCount(_eval), neighborEvalCount(_eval),
nEvalStat(neighborEvalCount, true), nEvalStat(neighborEvalCount, true),
copyStat(lengthStat), // copy is used to report the statistic of the first walk
copyEvalStat(nEvalStat), copyEvalStat(nEvalStat),
copyStat(lengthStat), // copy is used to report the statistic of the first walk
checkpoint(trueCont), checkpoint(trueCont),
hc(_neighborhood, _fullEval, neighborEvalCount, checkpoint), hc(_neighborhood, _fullEval, neighborEvalCount, checkpoint),
initHC(_init, hc) initHC(_init, hc)

View file

@ -192,9 +192,9 @@ protected:
moSolutionStat<EOT> solutionStat; moSolutionStat<EOT> solutionStat;
moDistanceStat<EOT> distStat; moDistanceStat<EOT> distStat;
moNeighborhoodStat< Neighbor > neighborhoodStat; moNeighborhoodStat< Neighbor > neighborhoodStat;
moMinNeighborStat< Neighbor > minStat;
moAverageFitnessNeighborStat< Neighbor > averageStat; moAverageFitnessNeighborStat< Neighbor > averageStat;
moStdFitnessNeighborStat< Neighbor > stdStat; moStdFitnessNeighborStat< Neighbor > stdStat;
moMinNeighborStat< Neighbor > minStat;
moMaxNeighborStat< Neighbor > maxStat; moMaxNeighborStat< Neighbor > maxStat;
moNbSupNeighborStat< Neighbor > nbSupStat; moNbSupNeighborStat< Neighbor > nbSupStat;
moNbInfNeighborStat< Neighbor > nbInfStat; moNbInfNeighborStat< Neighbor > nbInfStat;

View file

@ -71,15 +71,15 @@ typedef EO<int> Solution;
class moDummyNeighborTest: public moNeighbor<Solution> { class moDummyNeighborTest: public moNeighbor<Solution> {
public: public:
virtual void move(Solution & _solution) { virtual void move(Solution & /*_solution*/) {
} }
}; };
class moDummyBackableNeighbor: public moBackableNeighbor<Solution> { class moDummyBackableNeighbor: public moBackableNeighbor<Solution> {
public: public:
virtual void move(Solution & _solution) { virtual void move(Solution & /*_solution*/) {
} }
virtual void moveBack(Solution & _solution) { virtual void moveBack(Solution & /*_solution*/) {
} }
}; };
@ -91,7 +91,7 @@ public:
i(0), j(0) { i(0), j(0) {
} }
virtual bool hasNeighbor(EOT & _solution) { virtual bool hasNeighbor(EOT & /*_solution*/) {
bool res; bool res;
if (i % 3 == 0 || i == 1) if (i % 3 == 0 || i == 1)
res = false; res = false;
@ -100,11 +100,11 @@ public:
i++; i++;
return res; 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++; j++;
return (j % 10 != 0); return (j % 10 != 0);
} }
@ -227,7 +227,7 @@ private:
class dummyInit: public eoInit<bitVector> { class dummyInit: public eoInit<bitVector> {
public: public:
void operator()(bitVector& sol) { void operator()(bitVector& /*sol*/) {
} }
}; };

View file

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

View file

@ -99,7 +99,11 @@ class moeoBitVector : public moeoVector < MOEOObjectiveVector, bool, MOEOFitness
if (_is) if (_is)
{ {
resize(bits.size()); 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')); 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 * Nothing to do
* @param _pop the population * @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 _max upper bound
* @param _obj the objective index * @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 _realInterval the eoRealInterval object
* @param _obj the objective index * @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 * @param _objVec the objective vector
* @warning NOT IMPLEMENTED, DO NOTHING ! * @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; std::cout << "WARNING : updateByDeleting not implemented in moeoCrowdingDiversityAssignment" << std::endl;
} }

View file

@ -66,7 +66,7 @@ public:
* @param _objVec the objective vector * @param _objVec the objective vector
* @warning NOT IMPLEMENTED, DO NOTHING ! * @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; std::cout << "WARNING : updateByDeleting not implemented in moeoFrontByFrontCrowdingDistanceDiversityAssignment" << std::endl;
} }

Some files were not shown because too many files have changed in this diff Show more