warning hunting
This commit is contained in:
parent
9aaafc2cdb
commit
0363af1289
13 changed files with 153 additions and 145 deletions
|
|
@ -40,9 +40,11 @@
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
class eoDetTournamentInserter : public eoSteadyStateInserter<EOT>
|
class eoDetTournamentInserter : public eoSteadyStateInserter<EOT>
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
eoDetTournamentInserter(eoEvalFunc<EOT>& _eval, unsigned _t_size) : t_size(_t_size), eoSteadyStateInserter<EOT>(_eval)
|
eoDetTournamentInserter(eoEvalFunc<EOT>& _eval, unsigned _t_size):
|
||||||
|
eoSteadyStateInserter<EOT>(_eval),
|
||||||
|
t_size(_t_size)
|
||||||
{
|
{
|
||||||
if (t_size < 2)
|
if (t_size < 2)
|
||||||
{ // warning, error?
|
{ // warning, error?
|
||||||
|
|
@ -62,8 +64,7 @@ class eoDetTournamentInserter : public eoSteadyStateInserter<EOT>
|
||||||
|
|
||||||
string className(void) const { return "eoDetTournamentInserter"; }
|
string className(void) const { return "eoDetTournamentInserter"; }
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
unsigned t_size;
|
unsigned t_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class eoGOpBreeder: public eoMonPopOp<EOT>
|
||||||
*/
|
*/
|
||||||
void operator()(eoPop<EOT>& _pop)
|
void operator()(eoPop<EOT>& _pop)
|
||||||
{
|
{
|
||||||
int size = _pop.size();
|
unsigned size = _pop.size();
|
||||||
|
|
||||||
for (unsigned i = 0; i < size; i++)
|
for (unsigned i = 0; i < size; i++)
|
||||||
{ // and the one liner
|
{ // and the one liner
|
||||||
|
|
|
||||||
|
|
@ -109,9 +109,9 @@ private :
|
||||||
/* Implementation of longish functions defined above */
|
/* Implementation of longish functions defined above */
|
||||||
|
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
inline eoOpSelector<EOT>::ID eoGOpSelector<EOT>::addOp( eoOp<EOT>& _op, float _arg )
|
inline eoOpSelector<EOT>::ID eoGOpSelector<EOT>::addOp( eoOp<EOT>& _op,
|
||||||
|
float _arg )
|
||||||
{
|
{
|
||||||
|
|
||||||
eoGeneralOp<EOT>* op;
|
eoGeneralOp<EOT>* op;
|
||||||
|
|
||||||
if (_op.getType() == eoOp<EOT>::general)
|
if (_op.getType() == eoOp<EOT>::general)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
class eoSequentialGOpSel : public eoGOpSelector<EOT>
|
class eoSequentialGOpSel : public eoGOpSelector<EOT>
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
virtual ~eoSequentialGOpSel(void) {}
|
virtual ~eoSequentialGOpSel(void) {}
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ class eoSequentialGOpSel : public eoGOpSelector<EOT>
|
||||||
{
|
{
|
||||||
combined.clear();
|
combined.clear();
|
||||||
|
|
||||||
for (int i = 0; i < size(); ++i)
|
for (unsigned i = 0; i < size(); ++i)
|
||||||
{
|
{
|
||||||
if (operator[](i) == 0)
|
if (operator[](i) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -55,7 +55,7 @@ class eoSequentialGOpSel : public eoGOpSelector<EOT>
|
||||||
return combined;
|
return combined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
eoCombinedOp<EOT> combined;
|
eoCombinedOp<EOT> combined;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,12 @@
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
class eoSteadyStateInserter : public eoPopInserter<EOT>
|
class eoSteadyStateInserter : public eoPopInserter<EOT>
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
eoSteadyStateInserter(eoEvalFunc<EOT>& _eval) : eval(_eval) , eoPopInserter<EOT>() {}
|
eoSteadyStateInserter(eoEvalFunc<EOT>& _eval):
|
||||||
|
eoPopInserter<EOT>(),
|
||||||
protected :
|
eval(_eval) {}
|
||||||
|
|
||||||
|
protected :
|
||||||
eoEvalFunc<EOT>& eval;
|
eoEvalFunc<EOT>& eval;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,10 @@
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
class eoStochTournamentInserter : public eoSteadyStateInserter<EOT>
|
class eoStochTournamentInserter : public eoSteadyStateInserter<EOT>
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
eoStochTournamentInserter(eoEvalFunc<EOT>& _eval, double _t_rate) : t_rate(_t_rate), eoSteadyStateInserter<EOT>(_eval)
|
eoStochTournamentInserter(eoEvalFunc<EOT>& _eval, double _t_rate):
|
||||||
|
eoSteadyStateInserter<EOT>(_eval), t_rate(_t_rate)
|
||||||
{
|
{
|
||||||
if (t_rate < 0.5)
|
if (t_rate < 0.5)
|
||||||
{ // warning, error?
|
{ // warning, error?
|
||||||
|
|
@ -68,7 +69,7 @@ class eoStochTournamentInserter : public eoSteadyStateInserter<EOT>
|
||||||
|
|
||||||
string className(void) const { return "eoStochTournamentInserter"; }
|
string className(void) const { return "eoStochTournamentInserter"; }
|
||||||
|
|
||||||
private :
|
private :
|
||||||
double t_rate;
|
double t_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ int the_main(int argc, char **argv)
|
||||||
eoParser parser(argc, argv);
|
eoParser parser(argc, argv);
|
||||||
|
|
||||||
// Define Parameters
|
// Define Parameters
|
||||||
eoValueParam<unsigned>& chrom_size = parser.createParam(unsigned(2), "chrom-size", "Chromosome size");
|
|
||||||
eoValueParam<double> rate(0.01, "mutationRatePerBit", "Initial value for mutation rate per bit");
|
eoValueParam<double> rate(0.01, "mutationRatePerBit", "Initial value for mutation rate per bit");
|
||||||
eoValueParam<double> factor(0.99, "mutationFactor", "Decrease factor for mutation rate");
|
eoValueParam<double> factor(0.99, "mutationFactor", "Decrease factor for mutation rate");
|
||||||
eoValueParam<uint32> seed(time(0), "seed", "Random number seed");
|
eoValueParam<uint32> seed(time(0), "seed", "Random number seed");
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,10 @@
|
||||||
// t-eoEasyEA.cpp
|
// t-eoEasyEA.cpp
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef __GNUG__
|
||||||
// to avoid long name warnings
|
// to avoid long name warnings
|
||||||
#pragma warning(disable:4786)
|
#pragma warning(disable:4786)
|
||||||
|
#endif // __GNUG__
|
||||||
|
|
||||||
#include <eo>
|
#include <eo>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ int main()
|
||||||
eoExternalBinOp<FitnessType, External> cross1(UserDefBinCrossover);
|
eoExternalBinOp<FitnessType, External> cross1(UserDefBinCrossover);
|
||||||
eoExternalQuadraticOp<FitnessType, External> cross2(UserDefQuadCrossover);
|
eoExternalQuadraticOp<FitnessType, External> cross2(UserDefQuadCrossover);
|
||||||
|
|
||||||
eoExternalEvalFunc<FitnessType, External> eval(UserDefEvalFunc);
|
// eoExternalEvalFunc<FitnessType, External> eval(UserDefEvalFunc);
|
||||||
|
|
||||||
EoType eo1 = init();
|
EoType eo1 = init();
|
||||||
EoType eo2 = init();
|
EoType eo2 = init();
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,10 @@
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------//
|
//-----------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
#ifndef __GNUG__
|
||||||
// to avoid long name warnings
|
// to avoid long name warnings
|
||||||
#pragma warning(disable:4786)
|
#pragma warning(disable:4786)
|
||||||
|
#endif // __GNUG__
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ int the_main(int argc, char **argv)
|
||||||
eoParser parser(argc, argv);
|
eoParser parser(argc, argv);
|
||||||
|
|
||||||
// Define Parameters
|
// Define Parameters
|
||||||
eoValueParam<unsigned>& chrom_size = parser.createParam(unsigned(2), "chrom-size", "Chromosome size");
|
|
||||||
eoValueParam<double> rate(0.01, "mutationRatePerBit", "Initial value for mutation rate per bit");
|
eoValueParam<double> rate(0.01, "mutationRatePerBit", "Initial value for mutation rate per bit");
|
||||||
eoValueParam<double> factor(0.99, "mutationFactor", "Decrease factor for mutation rate");
|
eoValueParam<double> factor(0.99, "mutationFactor", "Decrease factor for mutation rate");
|
||||||
eoValueParam<uint32> seed(time(0), "seed", "Random number seed");
|
eoValueParam<uint32> seed(time(0), "seed", "Random number seed");
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,10 @@
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef __GNUG__
|
||||||
// to avoid long name warnings
|
// to avoid long name warnings
|
||||||
#pragma warning(disable:4786)
|
#pragma warning(disable:4786)
|
||||||
|
#endif // __GNUG__
|
||||||
|
|
||||||
#include <ga/eoBin.h> // eoBin, eoPop, eoBreeder
|
#include <ga/eoBin.h> // eoBin, eoPop, eoBreeder
|
||||||
#include <eoPop.h>
|
#include <eoPop.h>
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,10 @@
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef __GNUG__
|
||||||
// to avoid long name warnings
|
// to avoid long name warnings
|
||||||
#pragma warning(disable:4786)
|
#pragma warning(disable:4786)
|
||||||
|
#endif // __GNUG__
|
||||||
|
|
||||||
#include <ga/eoBin.h> // eoBin, eoPop, eoBreeder
|
#include <ga/eoBin.h> // eoBin, eoPop, eoBreeder
|
||||||
#include <eoPop.h>
|
#include <eoPop.h>
|
||||||
|
|
|
||||||
Reference in a new issue