now works
This commit is contained in:
parent
afdcdf5d07
commit
65a985631c
2 changed files with 5 additions and 8 deletions
|
|
@ -11,7 +11,7 @@
|
||||||
#include <eoPop.h> // eoPop
|
#include <eoPop.h> // eoPop
|
||||||
#include <eoGenContinue.h> // eoGenContinue
|
#include <eoGenContinue.h> // eoGenContinue
|
||||||
#include <eoProportional.h> // eoProportional
|
#include <eoProportional.h> // eoProportional
|
||||||
#include <eoStochTournament.h>
|
#include <eoStochTournament.h> // eoStochTournament
|
||||||
#include <eoSGA.h> // eoSGA
|
#include <eoSGA.h> // eoSGA
|
||||||
#include "gprop.h" // Chrom eoChromInit eoChromMutation eoChromXover eoChromEvaluator
|
#include "gprop.h" // Chrom eoChromInit eoChromMutation eoChromXover eoChromEvaluator
|
||||||
|
|
||||||
|
|
@ -92,10 +92,6 @@ void arg(int argc, char** argv)
|
||||||
in = trn_set.front().input.size();
|
in = trn_set.front().input.size();
|
||||||
out = trn_set.front().output.size();
|
out = trn_set.front().output.size();
|
||||||
hidden = hiddenp.value();
|
hidden = hiddenp.value();
|
||||||
|
|
||||||
cout << trn_set << endl;
|
|
||||||
|
|
||||||
cout << in << " " << out << " " << hidden << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,9 @@ struct phenotype
|
||||||
|
|
||||||
static unsigned trn_max, val_max, tst_max;
|
static unsigned trn_max, val_max, tst_max;
|
||||||
|
|
||||||
// operator double(void) const { return val_ok; }
|
|
||||||
|
|
||||||
friend bool operator<(const phenotype& a, const phenotype& b)
|
friend bool operator<(const phenotype& a, const phenotype& b)
|
||||||
{
|
{
|
||||||
return a.val_ok < b.val_ok; // || (!(a.val_ok < b.val_ok) && a.mse_error < b.mse_error);
|
return a.val_ok < b.val_ok || !(b.val_ok < a.val_ok) && b.mse_error < a.mse_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend ostream& operator<<(ostream& os, const phenotype& p)
|
friend ostream& operator<<(ostream& os, const phenotype& p)
|
||||||
|
|
@ -119,6 +117,7 @@ public:
|
||||||
{
|
{
|
||||||
mse::net tmp(chrom);
|
mse::net tmp(chrom);
|
||||||
tmp.train(trn_set, 10, 0, 0.001);
|
tmp.train(trn_set, 10, 0, 0.001);
|
||||||
|
chrom.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -140,6 +139,8 @@ public:
|
||||||
mse::net tmp1(chrom1), tmp2(chrom2);
|
mse::net tmp1(chrom1), tmp2(chrom2);
|
||||||
tmp1.train(trn_set, 100, 0, 0.001);
|
tmp1.train(trn_set, 100, 0, 0.001);
|
||||||
tmp2.train(trn_set, 100, 0, 0.001);
|
tmp2.train(trn_set, 100, 0, 0.001);
|
||||||
|
chrom1.invalidate();
|
||||||
|
chrom2.invalidate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue