From 64a5d2de5838095403f635a1a5cfd086444b94b7 Mon Sep 17 00:00:00 2001 From: mac Date: Fri, 7 Apr 2000 14:23:59 +0000 Subject: [PATCH] updated Makefiles and removed a few unneeded files. note: ES files are pending --- eo/src/Makefile.am | 2 +- eo/src/eoProportionalGOpSel.h | 2 +- eo/src/eoProportionalGOpSelector.h | 55 ------------ eo/test/Makefile.am | 44 ++++------ eo/test/t-eoGOpSel.cpp | 23 ----- eo/test/t-eoGeneralOps.cpp | 71 --------------- eo/test/t-parser.cpp | 133 ----------------------------- 7 files changed, 17 insertions(+), 313 deletions(-) delete mode 100644 eo/src/eoProportionalGOpSelector.h delete mode 100644 eo/test/t-eoGeneralOps.cpp delete mode 100644 eo/test/t-parser.cpp diff --git a/eo/src/Makefile.am b/eo/src/Makefile.am index ae2e7497..dad35875 100644 --- a/eo/src/Makefile.am +++ b/eo/src/Makefile.am @@ -10,4 +10,4 @@ lib_LIBRARIES = libeo.a libeo_a_SOURCES = eoPrintable.cpp eoPersistent.cpp libeoincdir = $(includedir)/eo -libeoinc_HEADERS = EO.h eoDup.h eoKill.h eoProportionalGOpSelector.h eoTournament.h eo1d.h eoEasyEA.h eoLottery.h eoProportionalOpSel.h eoTranspose.h eo1dWDistance.h eoEvalFunc.h eoMerge.h eoRandomBreed.h eoUniform.h eo2d.h eoEvalFuncPtr.h eoMutation.h eoRandomIndiSelector.h eoUniformSelect.h eo2dVector.h eoEvalFuncPtrCnt.h eoNegExp.h eoRandomSelect.h eoUniformXOver.h eoAlgo.h eoFactory.h eoNonUniform.h eoRank.h eoVector.h eoAtomBitFlip.h eoFitTerm.h eoNormal.h eoRnd.h eoWrappedOps.h eoAtomCreep.h eoFitness.h eoObject.h eoScalarFitness.h eoXOver2.h eoAtomMutation.h eoGOpBreeder.h eoOp.h eoScheme.h eoAtomMutator.h eoGOpSelector.h eoOpFactory.h eoSelectFactory.h eoBreeder.h eoID.h eoPersistent.h eoSteadyStateGeneration.h eoAtomRandom.h eoGenTerm.h eoOpSelMason.h eoSequentialGOpSelector.h eoBackInserter.h eoGeneration.h eoOpSelector.h eoSteadyStateEA.h eoDetTournament.h eoInclusion.h eoPop.h eoSteadyStateInserter.h eoDetTournamentIndiSelector.h eoIndiSelector.h eoPopOps.h eoStochTournament.h eoDetTournamentInserter.h eoInserter.h eoPrintable.h eoStochTournamentInserter.h eoDistance.h eoInsertion.h eoProportionalGOpSel.h eoTerm.h \ No newline at end of file +libeoinc_HEADERS = EO.h eoDup.h eoKill.h eoTournament.h eo1d.h eoEasyEA.h eoLottery.h eoProportionalOpSel.h eoTranspose.h eo1dWDistance.h eoEvalFunc.h eoMerge.h eoRandomBreed.h eoUniform.h eo2d.h eoEvalFuncPtr.h eoMutation.h eoRandomIndiSelector.h eoUniformSelect.h eo2dVector.h eoEvalFuncPtrCnt.h eoNegExp.h eoRandomSelect.h eoUniformXOver.h eoAlgo.h eoFactory.h eoNonUniform.h eoRank.h eoVector.h eoAtomBitFlip.h eoFitTerm.h eoNormal.h eoRnd.h eoWrappedOps.h eoAtomCreep.h eoFitness.h eoObject.h eoScalarFitness.h eoXOver2.h eoAtomMutation.h eoGOpBreeder.h eoOp.h eoScheme.h eoAtomMutator.h eoGOpSelector.h eoOpFactory.h eoSelectFactory.h eoBreeder.h eoID.h eoPersistent.h eoSteadyStateGeneration.h eoAtomRandom.h eoGenTerm.h eoOpSelMason.h eoSequentialGOpSelector.h eoBackInserter.h eoGeneration.h eoOpSelector.h eoSteadyStateEA.h eoDetTournament.h eoInclusion.h eoPop.h eoSteadyStateInserter.h eoDetTournamentIndiSelector.h eoIndiSelector.h eoPopOps.h eoStochTournament.h eoDetTournamentInserter.h eoInserter.h eoPrintable.h eoStochTournamentInserter.h eoDistance.h eoInsertion.h eoProportionalGOpSel.h eoTerm.h diff --git a/eo/src/eoProportionalGOpSel.h b/eo/src/eoProportionalGOpSel.h index bc7d1c08..68eb8ce6 100644 --- a/eo/src/eoProportionalGOpSel.h +++ b/eo/src/eoProportionalGOpSel.h @@ -39,7 +39,7 @@ public : /** Returns the operator proportionally selected */ virtual eoGeneralOp& selectOp() { - unsigned what = rng.roulette_wheel(rates); + unsigned what = rng.roulette_wheel(getRates()); return *operator[](what); } diff --git a/eo/src/eoProportionalGOpSelector.h b/eo/src/eoProportionalGOpSelector.h deleted file mode 100644 index 580b7bf1..00000000 --- a/eo/src/eoProportionalGOpSelector.h +++ /dev/null @@ -1,55 +0,0 @@ -/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - - ----------------------------------------------------------------------------- - eoProportionalGOpSelector.h - Proportional Generalized Operator Selector. - - (c) Maarten Keijzer (mkeijzer@mad.scientist.com), GeNeura Team 1998, 1999, 2000 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Contact: todos@geneura.ugr.es, http://geneura.ugr.es -*/ - -#ifndef eoProportionalGOpSelector_h -#define eoProportionalGOpSelector_h - -//----------------------------------------------------------------------------- - -#include "eoGOpSelector.h" - -/** eoProportionalGOpSel: do proportional selection, returns one of the - operators -*/ -template -class eoProportionalGOpSel : public eoGOpSelector -{ -public : - eoProportionalGOpSel() : eoGOpSelector() {} - - /** Returns the operator proportionally selected */ - virtual eoGeneralOp& selectOp() - { - unsigned what = rng.roulette_wheel(getRates()); - return *operator[](what); - } - - /// - virtual string className() const { return "eoGOpSelector"; }; -}; - -#endif - - diff --git a/eo/test/Makefile.am b/eo/test/Makefile.am index 075e5442..33124b50 100644 --- a/eo/test/Makefile.am +++ b/eo/test/Makefile.am @@ -16,8 +16,8 @@ LDADDS = $(top_builddir)/src/libeo.a $(top_builddir)/src/obsolete/libeoobsolete. noinst_PROGRAMS = t-eobreeder t-eoinclusion t-eoinsertion t-eo t-eofitness \ t-eoproblem t-eobin t-eolottery t-eo2dVector t-eogeneration t-eoEasyEA\ - t-eoNonUniform t-eoUniform t-eoRandom t-parser t-eoESFull t-eoESOps\ - t-eoAtomOps t-selectOne t-eoaltbreeder t-eoGeneralOps t-eoGOpSel \ + t-eoNonUniform t-eoUniform t-eoRandom t-eoStateAndParser \ + t-eoAtomOps t-selectOne t-eoGOpSel \ t-eoVector t-eoCheckpointing ############################################################################### @@ -36,20 +36,6 @@ t_eoGOpSel_LDADD = $(LDADDS) ############################################################################### -t_eoGeneralOps_SOURCES = t-eoGeneralOps.cpp -t_eoGeneralOps_DEPENDENCIES = $(DEPS) -t_eoGeneralOps_LDFLAGS = -lm -t_eoGeneralOps_LDADD = $(LDADDS) - -############################################################################### - -t_eoaltbreeder_SOURCES = t-eoaltbreeder.cpp -t_eoaltbreeder_DEPENDENCIES = $(DEPS) -t_eoaltbreeder_LDFLAGS = -lm -t_eoaltbreeder_LDADD = $(LDADDS) - -############################################################################### - t_selectOne_SOURCES = t-selectOne.cpp t_selectOne_DEPENDENCIES = $(DEPS) t_selectOne_LDFLAGS = -lm @@ -63,18 +49,18 @@ t_eoAtomOps_LDFLAGS = -lm t_eoAtomOps_LDADD = $(LDADDS) ############################################################################### - -t_eoESOps_SOURCES = t-eoESOps.cpp -t_eoESOps_DEPENDENCIES = $(DEPS) -t_eoESOps_LDFLAGS = -lm -t_eoESOps_LDADD = $(LDADDS) +#disabled +#t_eoESOps_SOURCES = t-eoESOps.cpp +#t_eoESOps_DEPENDENCIES = $(DEPS) +#t_eoESOps_LDFLAGS = -lm +#t_eoESOps_LDADD = $(LDADDS) ############################################################################### -t_eoESFull_SOURCES = t-eoESFull.cpp real_value.h -t_eoESFull_DEPENDENCIES = $(DEPS) -t_eoESFull_LDFLAGS = -lm -t_eoESFull_LDADD = $(LDADDS) +#t_eoESFull_SOURCES = t-eoESFull.cpp real_value.h +#t_eoESFull_DEPENDENCIES = $(DEPS) +#t_eoESFull_LDFLAGS = -lm +#t_eoESFull_LDADD = $(LDADDS) ############################################################################### @@ -171,10 +157,10 @@ t_eo2dVector_LDADD = $(LDADDS) ############################################################################### -t_parser_SOURCES = t-parser.cpp -t_parser_DEPENDENCIES = $(DEPS) -t_parser_LDFLAGS = -lm -t_parser_LDADD = $(LDADDS) +t_eoStateAndParser_SOURCES = t-eoStateAndParser.cpp +t_eoStateAndParser_DEPENDENCIES = $(DEPS) +t_eoStateAndParser_LDFLAGS = -lm +t_eoStateAndParser_LDADD = $(LDADDS) ############################################################################### diff --git a/eo/test/t-eoGOpSel.cpp b/eo/test/t-eoGOpSel.cpp index 278303d5..efcae7e8 100644 --- a/eo/test/t-eoGOpSel.cpp +++ b/eo/test/t-eoGOpSel.cpp @@ -76,31 +76,8 @@ main() propSel.addOp(xover, 0.5); for ( i = 0; i < POP_SIZE; i ++ ) { eoGeneralOp& foo = propSel.selectOp(); - cout << foo.nInputs() << " " - << foo.nOutputs() << endl; } - // eoAltBreeder breeder( propSel ); - - - -// breeder(pop); - -// eoSequentialOpSelector::outIt > seqSel; - -// eoAltBreeder breeder2( seqSel ); -// seqSel.addOp(bitflip, 0.25); -// seqSel.addOp(xover, 0.75); - -// breeder2(pop); - -// // reevaluation of fitness -// for_each(pop.begin(), pop.end(), binary_value); - -// cout << "new population:" << endl; -// for (i = 0; i < pop.size(); ++i) -// cout << pop[i] << " " << pop[i].fitness() << endl; - return 0; } diff --git a/eo/test/t-eoGeneralOps.cpp b/eo/test/t-eoGeneralOps.cpp deleted file mode 100644 index 821a82b1..00000000 --- a/eo/test/t-eoGeneralOps.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - - t-eoGeneralOps.cpp - Program that tests the General operator interface, and the wrappers - for monary and unary operators. - - (c) GeNeura Team, 1999 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Contact: todos@geneura.ugr.es, http://geneura.ugr.es - -*/ - -//-----------------------------------------------------------------------------// - -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif - -#include -#include -#include - -using namespace std; - -// Operators we are going to test -#include -#include -#include -#include - -// Several EOs -#include - -// generalOp we are testing -#include - -main(int argc, char *argv[]) { - eoString aString("123456"); - eoAtomCreep creeper; - eoAtomMutation< eoString > mutator( creeper, 0.5 ); - - eoWrappedMonOp< eoString > wCreeper( mutator ); - cout << "Before aString " << aString; - mutator( aString); - cout << " after mutator " << aString; - - // Test now the alternative interface - eoPop< eoString > vIn, vOut; - insert_iterator > > ins( vOut, vOut.begin() ); - vIn.push_back( aString ); - wCreeper( vIn.begin(), ins ); - - cout << endl << "Before " << vIn[0] << endl << " after " << vOut[0] << endl;; - - return 0; // to avoid VC++ complaints -} - diff --git a/eo/test/t-parser.cpp b/eo/test/t-parser.cpp deleted file mode 100644 index 492d58a4..00000000 --- a/eo/test/t-parser.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -//----------------------------------------------------------------------------- -/* parser.cpp - example of use of Parser.h - - (c) geneura team, 1999 ------------------------------------------------------------------------------*/ - -#include -#include -#include - -void GetOutputParam(eoParser & parser, - string & _string) { - - try { - parser.AddTitle("Separate parameter: the output file name"); - _string = parser.getString("-O", "--OutputFile", "", "The output file name" ); - } catch (logic_error & e) { - cout << e.what() << endl; - parser.printHelp(); - exit(1); - } catch (exception & e) { - cout << e.what() << endl; - exit(1); - } -} - -void sub(Parser & parser) { - int i; - cout << "Function sub:" << endl; - - try { - parser.AddTitle("Private parameters of subroutine sub"); - i = parser.getInt("-j", "--sint", "5", "private integer of subroutine" ); - } catch (logic_error & e) { - cout << e.what() << endl; - parser.printHelp(); - exit(1); - } catch (exception & e) { - cout << e.what() << endl; - exit(1); - } - - cout << "Read " << i << endl; -} - - -/// Uses the parser and returns param values -void getParams( Parser & parser, - unsigned & _integer, - float & _floating, - string & _string, - vector & _array, - bool & _boolean) { - - try { - _integer = parser.getInt("-i", "--int", "2", "interger number" ); - _floating = parser.getFloat("-f", "--float", "0.2", "floating point number" ); - _string = parser.getString("-s", "--string", "string", "a string" ); - _array = parser.getArray("-a", "--array", "a b", "an array enclosed within < >" ); - _boolean = parser.getBool("-b","--bool", "a bool value" ); - } - catch (logic_error & e) - { - cout << e.what() << endl; - parser.printHelp(); - exit(1); - } - catch (exception & e) - { - cout << e.what() << endl; - exit(1); - } - -} - -int main( int argc, char* argv[]) { - - unsigned in; - float f; - string s; - vector a; - bool b; - - // Create the command-line parser - Parser parser( argc, argv, "Parser example"); - InitRandom(parser); - parser.AddTitle("General parameters"); - getParams(parser, in, f, s, a, b); - - cout << "\n integer: " << in << endl - << " float: "<< f << endl - << " string: /"<< s << "/" << endl - << " boolean: "<< b << endl - << " array: < "; - vector::const_iterator i; - for (i=a.begin() ; i" << endl << endl ; - - // call to the subroutine that also needs some parameters - sub(parser); - - // writing all parameters - // - // if programmer wishes, the name of the output file can be set as a parameter itself - // otherwise it will be argv[0].status - string OutputFileName; - GetOutputParam(parser, OutputFileName); - - parser.outputParam(OutputFileName); - if( parser.getBool("-h" , "--help" , "Shows this help")) { - parser.printHelp(); - exit(1); - } - - // but progrmamer should be careful to write the parser parameters - // after the last bit that uses it has finished - - - // Now the main body of the program - - for (int i=0; i<20; i++) { - cout << rng.normal() << endl; - } - cout << "C'est fini" << endl; - - return 0; -} -