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 = " ";
}
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() );

View file

@ -82,9 +82,9 @@ public:
// 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]];
}
@ -96,9 +96,9 @@ public:
// 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]];
}

View file

@ -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());};
};

View file

@ -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

View file

@ -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;

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

View file

@ -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

View file

@ -54,7 +54,11 @@ public:
* @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();
}

View file

@ -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

View file

@ -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();
}
@ -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();
}

View file

@ -72,7 +72,7 @@ public:
* @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());
@ -93,7 +93,7 @@ public:
* @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;
}

View file

@ -112,7 +112,7 @@ private:
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;

View file

@ -84,10 +84,10 @@ public:
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)
@ -95,15 +95,15 @@ public:
// 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);
@ -118,10 +118,10 @@ public:
}
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;

View file

@ -192,9 +192,9 @@ protected:
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;

View file

@ -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*/) {
}
};
@ -91,7 +91,7 @@ public:
i(0), j(0) {
}
virtual bool hasNeighbor(EOT & _solution) {
virtual bool hasNeighbor(EOT & /*_solution*/) {
bool res;
if (i % 3 == 0 || i == 1)
res = false;
@ -100,11 +100,11 @@ public:
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);
}
@ -227,7 +227,7 @@ private:
class dummyInit: public eoInit<bitVector> {
public:
void operator()(bitVector& sol) {
void operator()(bitVector& /*sol*/) {
}
};

View file

@ -258,9 +258,9 @@ public:
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]);
}

View file

@ -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
}
}

View file

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

View file

@ -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;
}

View file

@ -66,7 +66,7 @@ public:
* @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;
}

View file

@ -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;
}

View file

@ -143,7 +143,7 @@ public:
* @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;
}

View file

@ -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;
}

View file

@ -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

View file

@ -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;
}
@ -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;

View file

@ -119,7 +119,7 @@ public:
* @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 moeoDominanceCountFitnessAssignment" << std::endl;
}

View file

@ -123,7 +123,7 @@ public:
* @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 moeoDominanceCountRankingFitnessAssignment" << std::endl;
}

View file

@ -123,7 +123,7 @@ public:
* @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 moeoDominanceRankFitnessAssignment" << std::endl;
}

View file

@ -74,7 +74,7 @@ class moeoDummyFitnessAssignment : public moeoFitnessAssignment < MOEOT >
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
// nothing to do... ;-)
}

View file

@ -108,8 +108,8 @@ class moeoDMLSMonOp : public eoMonOp < typename Neighbor::EOT >
tmp = rng.random(dmlsArchive.size());
_moeo = dmlsArchive[tmp];
defaultContinuator.totalGenerations(defaultContinuator.totalGenerations());
if(verbose)
std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl;
if(verbose) {
std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl; }
return false;
}

View file

@ -318,8 +318,8 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
//if there are less than 3 objectifs take the fisrt objectif of the first point of front to begin computation of hypervolume
if(_no_objectives < 3){
if(_no_objectives < 1)
throw("Error in moeoHyperVolumeUnaryMetric::calc_hypervolume -> argument3: _no_objectives must be greater than 0");
if(_no_objectives < 1) {
throw("Error in moeoHyperVolumeUnaryMetric::calc_hypervolume -> argument3: _no_objectives must be greater than 0"); }
temp_vol=_front[0][0];
}
//else if there at least 3 objectives, a recursive computation of hypervolume starts with _no_objectives -1 on the filter_nondominated_set calculating previously.

View file

@ -54,7 +54,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT >
* equivalent to "number one element should be on top of number two element" in the list by looking to the first obj
*/
struct CompareByFirst
#if __cplusplus >= 201103L
: std::function< bool(entree, entree) > {
#else
: std::binary_function< bool, entree, entree > {
#endif
bool operator ()(
const entree& elem1,
const entree& elem2
@ -71,7 +75,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT >
* equivalent to "number one element should be on top of number two element" in the list by looking to the 2nd obj
*/
struct CompareByLast
#if __cplusplus >= 201103L
: std::function< bool(entree, entree) > {
#else
: std::binary_function< bool, entree, entree > {
#endif
bool operator ()(
const entree& elem1,
const entree& elem2
@ -87,7 +95,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT >
struct CompareByLast2
#if __cplusplus >= 201103L
: std::function< bool(MOEOT, MOEOT) > {
#else
: std::binary_function< bool, MOEOT, MOEOT > {
#endif
bool operator ()(
const MOEOT& elem1,
const MOEOT& elem2

View file

@ -111,7 +111,7 @@ class moeoAchievementFitnessAssignment : public moeoScalarFitnessAssignment < MO
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
// nothing to do ;-)
}

View file

@ -127,12 +127,12 @@ class moeoAchievementScalarizingFunctionMetricFitnessAssignment : public moeoSin
* @param _pop the populing
* @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;

View file

@ -138,7 +138,7 @@ class moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment : publi
* @param _pop the populing
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{
}
@ -146,7 +146,7 @@ class moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment : publi
private:
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){
void operator()(MOEOT &/*moeo*/){
}
} defaultEval;

View file

@ -124,12 +124,12 @@ class moeoAugmentedWeightedChebychevMetricFitnessAssignment : public moeoSingleO
* @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;

View file

@ -129,12 +129,12 @@ class moeoWeightedChebychevMetricFitnessAssignment : public moeoSingleObjectiviz
* @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;

View file

@ -57,7 +57,7 @@ class moeoDetArchiveSelect : public eoSelect<MOEOT>
* @param _source compatibility parameter, not used
* @param _dest destination population, selected from archive
*/
void operator()(const eoPop < MOEOT > & _source, eoPop < MOEOT > & _dest)
void operator()(const eoPop < MOEOT > & /*_source*/, eoPop < MOEOT > & _dest)
{
if(max < min){
std::cout << "Warning! moeoDetArchiveSelect: min value > max value!!! Nothing is done." << std::endl;
@ -74,8 +74,11 @@ class moeoDetArchiveSelect : public eoSelect<MOEOT>
std::vector <int> permutation;
for(unsigned int i=0; i < archive_size; i++)
permutation.push_back(i);
UF_random_generator<unsigned int> rndGen(permutation.size());
random_shuffle(permutation.begin(), permutation.end(), rndGen);
// UF_random_generator<unsigned int> rndGen(permutation.size());
// random_shuffle(permutation.begin(), permutation.end(), rndGen);
std::random_device rd;
std::mt19937 gen(rd());
std::shuffle(permutation.begin(), permutation.end(), gen);
for (unsigned int i=0; i<max; i++)
_dest.push_back(archive[permutation[i]]);
}

View file

@ -52,11 +52,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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;
}
@ -66,7 +66,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
typedef MOEO < ObjectiveVector, double, double > Solution;
class DummyEval: public eoEvalFunc<Solution>{
void operator()(Solution &moeo){
void operator()(Solution &/*moeo*/){
}
} eval;
//-----------------------------------------------------------------------------

View file

@ -48,11 +48,11 @@
class ObjectiveVectorTraits : 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;
}
@ -67,7 +67,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
typedef MOEO < ObjectiveVector, double, double > Solution;
class DummyEval: public eoEvalFunc<Solution>{
void operator()(Solution &moeo){
void operator()(Solution &/*moeo*/){
}
} eval;
//-----------------------------------------------------------------------------

View file

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -48,11 +48,11 @@
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
{
public:
static bool minimizing (int i)
static bool minimizing (int /*i*/)
{
return false;
}
static bool maximizing (int i)
static bool maximizing (int /*i*/)
{
return true;
}

View file

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
{
public:
static bool minimizing (int i)
static bool minimizing (int /*i*/)
{
return false;
}
static bool maximizing (int i)
static bool maximizing (int /*i*/)
{
return true;
}
@ -66,7 +66,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
typedef MOEO < ObjectiveVector, double, double > Solution;
class DummyEval: public eoEvalFunc<Solution>{
void operator()(Solution &moeo){
void operator()(Solution &/*moeo*/){
}
} eval;
//-----------------------------------------------------------------------------

View file

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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;
}
@ -66,7 +66,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
typedef MOEO < ObjectiveVector, double, double > Solution;
class DummyEval: public eoEvalFunc<Solution>{
void operator()(Solution &moeo){
void operator()(Solution &/*moeo*/){
}
} eval;
//-----------------------------------------------------------------------------

View file

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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;
}
@ -66,7 +66,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
typedef MOEO < ObjectiveVector, double, double > Solution;
class DummyEval: public eoEvalFunc<Solution>{
void operator()(Solution &moeo){
void operator()(Solution &/*moeo*/){
}
} defaultEval;
//-----------------------------------------------------------------------------

View file

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -48,11 +48,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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;
}
@ -88,7 +88,7 @@ int main()
for(int i=0; i< pop.size()/2; i++){
for(unsigned i=0; i< pop.size()/2; i++){
// tmp=rng.uniform()*100;
obj[0]=o1;
obj[1]=o2;
@ -132,10 +132,10 @@ int main()
std::cout << "nadir: " << nadir << std::endl;
std::cout << "ideal: " << ideal << std::endl;
for(int i=0; i<pop.size() ; i++)
for(unsigned i=0; i<pop.size() ; i++)
std::cout << pop[i].objectiveVector() << std::endl;
for(int i=0; i<pop.size() ; i++){
for(unsigned i=0; i<pop.size() ; i++){
arch(pop[i]);
// nadir = arch.getNadir();
// ideal = arch.getIdeal();

View file

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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;
}
@ -66,11 +66,11 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
class ObjectiveVectorTraits2 : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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;
}
@ -66,11 +66,11 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
class ObjectiveVectorTraits2 : 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

@ -44,11 +44,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

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

View file

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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

@ -48,11 +48,11 @@
class ObjectiveVectorTraits : 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

@ -46,11 +46,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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

@ -47,11 +47,11 @@
class ObjectiveVectorTraits : 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

@ -45,11 +45,11 @@
class ObjectiveVectorTraits : 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

@ -114,7 +114,7 @@ public:
void deleteTables()
{
if (links != NULL) {
for(int i = 0; i < N; i++) {
for(unsigned i = 0; i < N; i++) {
delete [] (links[i]);
}
delete [] links;
@ -122,7 +122,7 @@ public:
}
if (tables != NULL) {
for(int i = 0; i < N; i++) {
for(unsigned i = 0; i < N; i++) {
delete [] (tables[i]);
}
delete [] tables;
@ -210,8 +210,8 @@ public:
* @param file the file to read
*/
void loadLinks(std::fstream & file) {
for(int j = 0; j < K+1; j++)
for(int i = 0; i < N; i++) {
for(unsigned j = 0; j < K+1; j++)
for(unsigned i = 0; i < N; i++) {
file >> links[i][j];
}
}
@ -222,8 +222,8 @@ public:
* @param file the file to read
*/
void loadTables(std::fstream & file) {
for(int j = 0; j < (1<<(K+1)); j++)
for(int i = 0; i < N; i++)
for(unsigned j = 0; j < (1<<(K+1)); j++)
for(unsigned i = 0; i < N; i++)
file >> tables[i][j];
}
@ -241,13 +241,13 @@ public:
file << "p NK " << N << " " << K <<std::endl;
file << "p links" << std::endl;
for(int j=0; j<K+1; j++)
for(int i=0; i<N; i++)
for(unsigned j=0; j<K+1; j++)
for(unsigned i=0; i<N; i++)
file << links[i][j] << std::endl;
file << "p tables" << std::endl;
for(int j=0; j<(1<<(K+1)); j++) {
for(int i=0; i<N; i++)
for(unsigned j=0; j<(1<<(K+1)); j++) {
for(unsigned i=0; i<N; i++)
file << tables[i][j] << " ";
file << std::endl;
}
@ -264,7 +264,7 @@ public:
*/
void print() {
int j;
for(int i=0; i<N; i++) {
for(unsigned i=0; i<N; i++) {
std::cout <<"link " <<i <<" : ";
for(j = 0; j <= K; j++)
std::cout <<links[i][j] <<" ";
@ -272,7 +272,7 @@ public:
}
std::cout << std::endl;
for(int i=0; i<N; i++) {
for(unsigned i=0; i<N; i++) {
std::cout <<"table " << i << std::endl;
for(j=0; j<(1<<(K+1)); j++)
std::cout << tables[i][j] << std::endl;
@ -287,7 +287,7 @@ public:
virtual void operator() (EOT & _solution) {
double accu = 0.0;
for(int i = 0; i < N; i++)
for(unsigned i = 0; i < N; i++)
accu += tables[ i ][ sigma(_solution, i) ];
_solution.fitness( accu / (double) N );
@ -305,7 +305,7 @@ protected:
unsigned int n = 1;
unsigned int accu = 0;
for(int j = 0; j < K+1; j++) {
for(unsigned j = 0; j < K+1; j++) {
if (_solution[ links[i][j] ] == 1)
accu = accu | n;
n = n << 1;
@ -320,7 +320,7 @@ protected:
* @param tabTirage the table to initialize
*/
void initTirage(int tabTirage[]) {
for(int i = 0; i<N; i++)
for(unsigned i = 0; i<N; i++)
tabTirage[i] = i;
};
@ -346,7 +346,7 @@ protected:
*/
void choose(int i, int tabTirage[]) {
int t[K+1];
for(int j=0; j<K+1; j++) {
for(unsigned j=0; j<K+1; j++) {
if (j==0) t[j]=i;
else t[j] = rng.random(N-j);
links[i][j] = tabTirage[t[j]];
@ -362,7 +362,7 @@ protected:
* @param i the bit of contribution
*/
void consecutiveLinks(int i) {
for(int j = 0; j < K+1; j++) {
for(unsigned j = 0; j < K+1; j++) {
links[i][j] = (i + j) % N;
}
}
@ -375,8 +375,8 @@ protected:
*
*/
virtual void generateTables() {
for(int i = 0; i < N; i++) {
for(int j = 0; j < (1<<(K+1)); j++)
for(unsigned i = 0; i < N; i++) {
for(unsigned j = 0; j < (1<<(K+1)); j++)
tables[i][j] = contribution();
}
}
@ -399,7 +399,7 @@ protected:
int tabTirage[N];
initTirage(tabTirage);
for(int i = 0; i < N; i++) {
for(unsigned i = 0; i < N; i++) {
// random links to the bit
choose(i, tabTirage);
}
@ -412,7 +412,7 @@ protected:
virtual void consecutiveTables() {
buildTables();
for(int i = 0; i < N; i++) {
for(unsigned i = 0; i < N; i++) {
// consecutive link to bit i
consecutiveLinks(i);
}