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

View file

@ -78,7 +78,7 @@ class moeoFrontByFrontSharingDiversityAssignment : public moeoSharingDiversityAs
* @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 moeoSharingDiversityAssignment" << std::endl; std::cout << "WARNING : updateByDeleting not implemented in moeoSharingDiversityAssignment" << std::endl;
} }

View file

@ -143,7 +143,7 @@ public:
* @param _objVec the objective vector * @param _objVec the objective vector
* @warning NOT IMPLEMENTED, DOES NOTHING ! * @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; 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 * @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 moeoSharingDiversityAssignment" << std::endl; 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 _pop the population
* @param _objVec the objective vector * @param _objVec the objective vector
*/ */
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){}
private: private:
class DummyEval: public eoEvalFunc<MOEOT>{ class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){} void operator()(MOEOT &/*moeo*/){}
}defaultEval; }defaultEval;
//the vector of weight //the vector of weight

View file

@ -135,7 +135,7 @@ class moeoConstraintFitnessAssignment : public moeoSingleObjectivization < MOEOT
* @param _pop the population * @param _pop the population
* @param _objVec the objective vector * @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; //std::cout << "WARNING : updateByDeleting not implemented in moeoAssignmentFitnessAssignment" << std::endl;
} }
@ -144,7 +144,7 @@ class moeoConstraintFitnessAssignment : public moeoSingleObjectivization < MOEOT
//dummy evaluation function //dummy evaluation function
class DummyEval: public eoEvalFunc<MOEOT>{ class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){ void operator()(MOEOT &/*moeo*/){
} }
} defaultEval; } defaultEval;

View file

@ -119,7 +119,7 @@ public:
* @param _pop the population * @param _pop the population
* @param _objVec the objective vector * @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; std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountFitnessAssignment" << std::endl;
} }

View file

@ -123,7 +123,7 @@ public:
* @param _pop the population * @param _pop the population
* @param _objVec the objective vector * @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; std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountRankingFitnessAssignment" << std::endl;
} }

View file

@ -123,7 +123,7 @@ public:
* @param _pop the population * @param _pop the population
* @param _objVec the objective vector * @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; 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 _pop the population
* @param _objVec the objective vector * @param _objVec the objective vector
*/ */
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/)
{ {
// nothing to do... ;-) // nothing to do... ;-)
} }

View file

@ -108,8 +108,8 @@ class moeoDMLSMonOp : public eoMonOp < typename Neighbor::EOT >
tmp = rng.random(dmlsArchive.size()); tmp = rng.random(dmlsArchive.size());
_moeo = dmlsArchive[tmp]; _moeo = dmlsArchive[tmp];
defaultContinuator.totalGenerations(defaultContinuator.totalGenerations()); defaultContinuator.totalGenerations(defaultContinuator.totalGenerations());
if(verbose) if(verbose) {
std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl; std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl; }
return false; 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 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 < 3){
if(_no_objectives < 1) if(_no_objectives < 1) {
throw("Error in moeoHyperVolumeUnaryMetric::calc_hypervolume -> argument3: _no_objectives must be greater than 0"); throw("Error in moeoHyperVolumeUnaryMetric::calc_hypervolume -> argument3: _no_objectives must be greater than 0"); }
temp_vol=_front[0][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. //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 * equivalent to "number one element should be on top of number two element" in the list by looking to the first obj
*/ */
struct CompareByFirst struct CompareByFirst
#if __cplusplus >= 201103L
: std::function< bool(entree, entree) > {
#else
: std::binary_function< bool, entree, entree > { : std::binary_function< bool, entree, entree > {
#endif
bool operator ()( bool operator ()(
const entree& elem1, const entree& elem1,
const entree& elem2 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 * equivalent to "number one element should be on top of number two element" in the list by looking to the 2nd obj
*/ */
struct CompareByLast struct CompareByLast
#if __cplusplus >= 201103L
: std::function< bool(entree, entree) > {
#else
: std::binary_function< bool, entree, entree > { : std::binary_function< bool, entree, entree > {
#endif
bool operator ()( bool operator ()(
const entree& elem1, const entree& elem1,
const entree& elem2 const entree& elem2
@ -87,7 +95,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT >
struct CompareByLast2 struct CompareByLast2
#if __cplusplus >= 201103L
: std::function< bool(MOEOT, MOEOT) > {
#else
: std::binary_function< bool, MOEOT, MOEOT > { : std::binary_function< bool, MOEOT, MOEOT > {
#endif
bool operator ()( bool operator ()(
const MOEOT& elem1, const MOEOT& elem1,
const MOEOT& elem2 const MOEOT& elem2

View file

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

View file

@ -127,12 +127,12 @@ class moeoAchievementScalarizingFunctionMetricFitnessAssignment : public moeoSin
* @param _pop the populing * @param _pop the populing
* @param _objVec the objective vector * @param _objVec the objective vector
*/ */
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){}
private: private:
class DummyEval: public eoEvalFunc<MOEOT>{ class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){ void operator()(MOEOT &/*moeo*/){
} }
} defaultEval; } defaultEval;

View file

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

View file

@ -124,12 +124,12 @@ class moeoAugmentedWeightedChebychevMetricFitnessAssignment : public moeoSingleO
* @param _pop the population * @param _pop the population
* @param _objVec the objective vector * @param _objVec the objective vector
*/ */
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){}
private: private:
class DummyEval: public eoEvalFunc<MOEOT>{ class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){ void operator()(MOEOT &/*moeo*/){
} }
} defaultEval; } defaultEval;

View file

@ -129,12 +129,12 @@ class moeoWeightedChebychevMetricFitnessAssignment : public moeoSingleObjectiviz
* @param _pop the population * @param _pop the population
* @param _objVec the objective vector * @param _objVec the objective vector
*/ */
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){}
private: private:
class DummyEval: public eoEvalFunc<MOEOT>{ class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){ void operator()(MOEOT &/*moeo*/){
} }
} defaultEval; } defaultEval;

View file

@ -57,7 +57,7 @@ class moeoDetArchiveSelect : public eoSelect<MOEOT>
* @param _source compatibility parameter, not used * @param _source compatibility parameter, not used
* @param _dest destination population, selected from archive * @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){ if(max < min){
std::cout << "Warning! moeoDetArchiveSelect: min value > max value!!! Nothing is done." << std::endl; 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; std::vector <int> permutation;
for(unsigned int i=0; i < archive_size; i++) for(unsigned int i=0; i < archive_size; i++)
permutation.push_back(i); permutation.push_back(i);
UF_random_generator<unsigned int> rndGen(permutation.size()); // UF_random_generator<unsigned int> rndGen(permutation.size());
random_shuffle(permutation.begin(), permutation.end(), rndGen); // 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++) for (unsigned int i=0; i<max; i++)
_dest.push_back(archive[permutation[i]]); _dest.push_back(archive[permutation[i]]);
} }

View file

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

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

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

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

View file

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

View file

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

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

View file

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

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

View file

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

View file

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

View file

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

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

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

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

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

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

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

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

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

View file

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

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

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

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

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

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

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

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

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

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

View file

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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