diff --git a/eo/app/gprop/gprop.h b/eo/app/gprop/gprop.h index da2f41d7..7c96b14c 100644 --- a/eo/app/gprop/gprop.h +++ b/eo/app/gprop/gprop.h @@ -45,10 +45,10 @@ struct phenotype { - unsigned trn_ok, val_ok, tst_ok; + int trn_ok, val_ok, tst_ok; double mse_error; - static unsigned trn_max, val_max, tst_max; + static int trn_max, val_max, tst_max; friend bool operator<(const phenotype& a, const phenotype& b) { @@ -87,13 +87,16 @@ struct phenotype }; -unsigned phenotype::trn_max = 0, phenotype::val_max = 0, phenotype::tst_max = 0; +int phenotype::trn_max = 0, phenotype::val_max = 0, phenotype::tst_max = 0; //----------------------------------------------------------------------------- // genotype //----------------------------------------------------------------------------- +#ifndef GPROP_GENOTYPE +#define GPROP_GENOTYPE mlp::net +#endif -typedef mlp::net genotype; +typedef GPROP_GENOTYPE genotype; //----------------------------------------------------------------------------- // Chrom @@ -195,13 +198,13 @@ public: // eoChromEvaluator //----------------------------------------------------------------------------- -unsigned correct(const mlp::net& net, const mlp::set& set) +int correct(const mlp::net& net, const mlp::set& set) { - unsigned sum = 0; + int sum = 0; for (mlp::set::const_iterator s = set.begin(); s != set.end(); ++s) { - unsigned partial = 0; + int partial = 0; for (unsigned i = 0; i < s->output.size(); ++i) if (s->output[i] < 0.5 && net(s->input)[i] < 0.5 || diff --git a/eo/app/gprop/mlp.h b/eo/app/gprop/mlp.h index 1205f3b2..779e53e8 100644 --- a/eo/app/gprop/mlp.h +++ b/eo/app/gprop/mlp.h @@ -274,7 +274,7 @@ namespace mlp { return (max_element(tmp.begin(), tmp.end()) - tmp.begin()); } - void save(ostream &os) { + void save(ostream &os) const { // Save the number of inputs, number of outputs, and number of hidden layers os << num_inputs() << "\n" << num_outputs() << "\n" << num_hidden_layers() << "\n"; for(const_iterator l = begin(); l != end(); ++l) @@ -362,7 +362,7 @@ namespace mlp { while (is >> samp) { push_back(samp); } } - void save(ostream &os) { + void save(ostream &os) const { os << front().input.size() << " " << front().output.size() << endl; copy(begin(), end(), ostream_iterator(os,"\n")); }