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

View file

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

View file

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

View file

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

View file

@ -161,7 +161,7 @@ namespace mpi
MPI_Barrier( MPI_COMM_WORLD ); 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 ); 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]; char *args[2];
args[0] = prog; args[0] = strdup( prog );
args[1] = NULL; args[1] = NULL;
return PipeComOpenArgv( prog, args ); return PipeComOpenArgv( prog, args );
} }
PCom * PipeComOpenArgv( char *prog, char *argv[] ) PCom * PipeComOpenArgv( const char *prog, char *argv[] )
{ {
int toFils[2]; int toFils[2];
int toPere[2]; int toPere[2];

View file

@ -23,8 +23,8 @@ typedef struct PipeCommunication {
} PCom; } PCom;
extern PCom *PipeComOpen( char *prog ); extern PCom *PipeComOpen( const char *prog );
extern PCom *PipeComOpenArgv( char *prog, char *argv[] ); extern PCom *PipeComOpenArgv( const char *prog, char *argv[] );
extern int PipeComSend( PCom *to, const char *line ); extern int PipeComSend( PCom *to, const char *line );
extern int PipeComSendn( PCom *to, const char *data, int n ); 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 * @param _archive the archive of non-dominated solutions
*/ */
template < class MOEOT > 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)); eoCheckPoint < MOEOT > & checkpoint = _state.storeFunctor(new eoCheckPoint < MOEOT > (_continue));
/* the objective vector type */ /* the objective vector type */

View file

@ -85,7 +85,7 @@
* @param _archive the archive of non-dominated solutions * @param _archive the archive of non-dominated solutions
*/ */
template < class MOEOT > 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 */ /* 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 _normalize allow to normalize data (default true)
* @param _rho coefficient to determine the reference point. * @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()); bounds.resize(ObjectiveVector::Traits::nObjectives());
// initialize bounds in case someone does not want to use them // initialize bounds in case someone does not want to use them
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++) 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 _normalize allow to normalize data (default true)
* @param _ref_point the reference point * @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()); bounds.resize(ObjectiveVector::Traits::nObjectives());
// initialize bounds in case someone does not want to use them // initialize bounds in case someone does not want to use them
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++) for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)

View file

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

View file

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

View file

@ -59,6 +59,10 @@ paradiseo::smp::Island<EOAlgo,EOT,bEOT>::Island(eoPop<EOT>& _pop, IntPolicy<EOT>
_pop, _intPolicy, _migPolicy, args...) _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> template<template <class> class EOAlgo, class EOT, class bEOT>
void paradiseo::smp::Island<EOAlgo,EOT,bEOT>::operator()() void paradiseo::smp::Island<EOAlgo,EOT,bEOT>::operator()()
{ {

View file

@ -133,7 +133,8 @@ public:
virtual void receive(void); virtual void receive(void);
//AIsland<bEOT> clone() const; //AIsland<bEOT> clone() const;
virtual ~Island();
protected: protected:
/** /**

View file

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