From 5ac5a72db20363b3995cd3c6c694ea88d7e764af Mon Sep 17 00:00:00 2001 From: gustavoromero Date: Fri, 24 Nov 2000 09:51:31 +0000 Subject: [PATCH] adding new parameters --- eo/app/gprop/gprop.cc | 8 +++++++- eo/app/gprop/gprop.h | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/eo/app/gprop/gprop.cc b/eo/app/gprop/gprop.cc index 7890b18a..d2b11a3a 100644 --- a/eo/app/gprop/gprop.cc +++ b/eo/app/gprop/gprop.cc @@ -18,7 +18,7 @@ // global variables //----------------------------------------------------------------------------- - +unsigned in, out, hidden; //----------------------------------------------------------------------------- // parameters @@ -29,6 +29,7 @@ eoValueParam generations(10, "generations", "default generation number eoValueParam mut_rate(0.1, "mut_rate", "default mutation rate", 'm'); eoValueParam xover_rate(0.1, "xover_rate", "default crossover rate", 'x'); eoValueParam file("", "file", "common part of patterns filenames *.trn *.val and *.tst", 'f'); +eoValueParam hiddenp(8, "hidden", "default number of neurons in hidden layer", 'h'); //----------------------------------------------------------------------------- // auxiliar functions @@ -71,6 +72,7 @@ void arg(int argc, char** argv) parser.processParam(mut_rate, "genetic operators"); parser.processParam(xover_rate, "genetic operators"); parser.processParam(file, "files"); + parser.processParam(hiddenp, "genetic operators"); if (parser.userNeedsHelp()) { @@ -85,6 +87,10 @@ void arg(int argc, char** argv) phenotype::trn_max = trn_set.size(); phenotype::val_max = val_set.size(); phenotype::tst_max = tst_set.size(); + + in = trn_set.front().input.size(); + out = trn_set.front().output.size(); + hidden = hiddenp.value(); } //----------------------------------------------------------------------------- diff --git a/eo/app/gprop/gprop.h b/eo/app/gprop/gprop.h index 392a51bb..8b5f3c82 100644 --- a/eo/app/gprop/gprop.h +++ b/eo/app/gprop/gprop.h @@ -64,10 +64,15 @@ typedef mlp::net genotype; // Chrom //----------------------------------------------------------------------------- +extern unsigned in, out, hidden; + class Chrom: public EO, public genotype { public: - Chrom(): genotype(25, 2) {} + Chrom(): genotype(in, out, vector(1, hidden)) + { + cout << "in = " << in << " out = " << out << " hidden = " << hidden << endl; + } string className() const { return "Chrom"; }