fix several warnings

Probably fixes a bug in es/CMA, which has been deprecated for a long time in favor of the EDO module anyway.
This commit is contained in:
Johann Dreo 2025-04-07 14:16:37 +02:00
commit 22275e434b
15 changed files with 51 additions and 36 deletions

View file

@ -174,18 +174,18 @@ protected:
// if the flight does not need to be used, use the dummy flight instance
class eoDummyFlight:public eoFlight < POT >
{
public:
eoDummyFlight () {}
void operator () (POT &) {}
}dummyFlight;
public:
eoDummyFlight () {}
void operator() (POT &) override {}
} dummyFlight;
// if the initializer does not need to be used, use the dummy one instead
class eoDummyInitializer:public eoInitializerBase < POT >
{
public:
eoDummyInitializer () {}
void operator () (POT &) {}
}dummyInit;
public:
eoDummyInitializer () {}
void operator() () override {}
} dummyInit;
};
/**

View file

@ -230,27 +230,25 @@ protected:
// if the eval does not need to be used, use the dummy eval instance
class eoDummyEval : public eoEvalFunc<POT>
{
public:
void operator()(POT &)
{}
}
dummyEval;
class eoDummyFlight:public eoFlight < POT >
{
public:
eoDummyFlight () {}
void operator () (POT &) {}
}dummyFlight;
public:
void operator()(POT &) override {}
} dummyEval;
class eoDummyFlight:public eoFlight < POT >
{
public:
eoDummyFlight () {}
void operator() (POT &) override {}
} dummyFlight;
// if the initializer does not need to be used, use the dummy one instead
class eoDummyInitializer:public eoInitializerBase < POT >
{
public:
eoDummyInitializer () {}
void operator () (POT &) {}
}dummyInit;
public:
eoDummyInitializer () {}
void operator() () override {}
} dummyInit;
};
/** @example t-eoSyncEasyPSO.cpp

View file

@ -113,16 +113,19 @@ CMAParams::CMAParams(eoParser& parser, unsigned dimensionality) {
for (unsigned i = 0; i < weights.size(); ++i) {
weights[i] = mu - i;
}
break;
}
case 2:
{
weights = 1.;
break;
}
default :
{
for (unsigned i = 0; i < weights.size(); ++i) {
weights[i] = log(mu+1.)-log(i+1.);
}
break;
}
}

View file

@ -468,8 +468,11 @@ private :
switch(new_arity)
{
case 3 : args[2].copy(s.args[2]); args[2].parent = this; // no break!
[[fallthrough]];
case 2 : args[1].copy(s.args[1]); args[1].parent = this;
[[fallthrough]];
case 1 : args[0].copy(s.args[0]); args[0].parent = this;
[[fallthrough]];
case 0 : break;
default :
{
@ -523,7 +526,9 @@ private :
switch(arity())
{
case 3 : args[2].parent = 0; // no break!
[[fallthrough]];
case 2 : args[1].parent = 0;
[[fallthrough]];
case 1 : args[0].parent = 0; break;
case 0 : break;
default :
@ -542,7 +547,9 @@ private :
switch(arity())
{
case 3 : args[2].parent = this; // no break!
[[fallthrough]];
case 2 : args[1].parent = this;
[[fallthrough]];
case 1 : args[0].parent = this; break;
case 0 : break;
default :

View file

@ -161,7 +161,7 @@ namespace mpi
MPI_Barrier( MPI_COMM_WORLD );
}
void broadcast( communicator & comm, int value, int root )
void broadcast( communicator & /*comm*/, int value, int root )
{
MPI_Bcast( &value, 1, MPI_INT, root, MPI_COMM_WORLD );
}

View file

@ -42,16 +42,16 @@ int Check( PCom *com )
}
PCom * PipeComOpen( char *prog )
PCom * PipeComOpen( const char *prog )
{
char *args[2];
args[0] = prog;
args[0] = strdup( prog );
args[1] = NULL;
return PipeComOpenArgv( prog, args );
}
PCom * PipeComOpenArgv( char *prog, char *argv[] )
PCom * PipeComOpenArgv( const char *prog, char *argv[] )
{
int toFils[2];
int toPere[2];

View file

@ -23,8 +23,8 @@ typedef struct PipeCommunication {
} PCom;
extern PCom *PipeComOpen( char *prog );
extern PCom *PipeComOpenArgv( char *prog, char *argv[] );
extern PCom *PipeComOpen( const char *prog );
extern PCom *PipeComOpenArgv( const char *prog, char *argv[] );
extern int PipeComSend( PCom *to, const char *line );
extern int PipeComSendn( PCom *to, const char *data, int n );

View file

@ -66,7 +66,7 @@ bool testDirRes(std::string _dirName, bool _erase);
* @param _archive the archive of non-dominated solutions
*/
template < class MOEOT >
eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState & _state, eoEvalFuncCounter < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _archive)
eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState & _state, eoEvalFuncCounter < MOEOT > & /*_eval*/, eoContinue < MOEOT > & _continue, eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _archive)
{
eoCheckPoint < MOEOT > & checkpoint = _state.storeFunctor(new eoCheckPoint < MOEOT > (_continue));
/* the objective vector type */

View file

@ -85,7 +85,7 @@
* @param _archive the archive of non-dominated solutions
*/
template < class MOEOT >
moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & _archive)
moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & /*_archive*/)
{
/* the objective vector type */

View file

@ -55,7 +55,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
* @param _normalize allow to normalize data (default true)
* @param _rho coefficient to determine the reference point.
*/
moeoHyperVolumeMetric(bool _normalize=true, double _rho=1.1): normalize(_normalize), rho(_rho), ref_point(NULL){
moeoHyperVolumeMetric(bool _normalize=true, double _rho=1.1): normalize(_normalize), rho(_rho) {
bounds.resize(ObjectiveVector::Traits::nObjectives());
// initialize bounds in case someone does not want to use them
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
@ -69,7 +69,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
* @param _normalize allow to normalize data (default true)
* @param _ref_point the reference point
*/
moeoHyperVolumeMetric(bool _normalize=true, ObjectiveVector& _ref_point=NULL): normalize(_normalize), rho(0.0), ref_point(_ref_point){
moeoHyperVolumeMetric(bool _normalize, ObjectiveVector& _ref_point): normalize(_normalize), rho(0.0), ref_point(_ref_point){
bounds.resize(ObjectiveVector::Traits::nObjectives());
// initialize bounds in case someone does not want to use them
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)

View file

@ -47,11 +47,11 @@ using namespace std;
class Sch1ObjectiveVectorTraits : public moeoObjectiveVectorTraits
{
public:
static bool minimizing (int i)
static bool minimizing (int /*i*/)
{
return true;
}
static bool maximizing (int i)
static bool maximizing (int /*i*/)
{
return false;
}

View file

@ -52,7 +52,7 @@ class Loop<T,Arg...>
}
template<class U>
U& findValueImpl(T& t, Arg&... arg, std::true_type)
U& findValueImpl(T& t, Arg&... /*arg*/, std::true_type)
{
return t;
}

View file

@ -59,6 +59,10 @@ paradiseo::smp::Island<EOAlgo,EOT,bEOT>::Island(eoPop<EOT>& _pop, IntPolicy<EOT>
_pop, _intPolicy, _migPolicy, args...)
{ }
template<template <class> class EOAlgo, class EOT, class bEOT>
paradiseo::smp::Island<EOAlgo,EOT,bEOT>::~Island()
{ }
template<template <class> class EOAlgo, class EOT, class bEOT>
void paradiseo::smp::Island<EOAlgo,EOT,bEOT>::operator()()
{

View file

@ -134,6 +134,7 @@ public:
//AIsland<bEOT> clone() const;
virtual ~Island();
protected:
/**

View file

@ -30,6 +30,8 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#ifndef _QAPGA_h
#define _QAPGA_h
extern int n; // size
class ProblemInit : public eoInit<Problem>
{
public: