updated Makefiles and removed a few unneeded files. note: ES files are pending
This commit is contained in:
parent
87cdfa00c4
commit
64a5d2de58
7 changed files with 17 additions and 313 deletions
|
|
@ -10,4 +10,4 @@ lib_LIBRARIES = libeo.a
|
||||||
libeo_a_SOURCES = eoPrintable.cpp eoPersistent.cpp
|
libeo_a_SOURCES = eoPrintable.cpp eoPersistent.cpp
|
||||||
|
|
||||||
libeoincdir = $(includedir)/eo
|
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
|
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
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public :
|
||||||
/** Returns the operator proportionally selected */
|
/** Returns the operator proportionally selected */
|
||||||
virtual eoGeneralOp<EOT>& selectOp()
|
virtual eoGeneralOp<EOT>& selectOp()
|
||||||
{
|
{
|
||||||
unsigned what = rng.roulette_wheel(rates);
|
unsigned what = rng.roulette_wheel(getRates());
|
||||||
return *operator[](what);
|
return *operator[](what);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 EOT>
|
|
||||||
class eoProportionalGOpSel : public eoGOpSelector<EOT>
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
eoProportionalGOpSel() : eoGOpSelector<EOT>() {}
|
|
||||||
|
|
||||||
/** Returns the operator proportionally selected */
|
|
||||||
virtual eoGeneralOp<EOT>& selectOp()
|
|
||||||
{
|
|
||||||
unsigned what = rng.roulette_wheel(getRates());
|
|
||||||
return *operator[](what);
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
virtual string className() const { return "eoGOpSelector"; };
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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 \
|
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-eoproblem t-eobin t-eolottery t-eo2dVector t-eogeneration t-eoEasyEA\
|
||||||
t-eoNonUniform t-eoUniform t-eoRandom t-parser t-eoESFull t-eoESOps\
|
t-eoNonUniform t-eoUniform t-eoRandom t-eoStateAndParser \
|
||||||
t-eoAtomOps t-selectOne t-eoaltbreeder t-eoGeneralOps t-eoGOpSel \
|
t-eoAtomOps t-selectOne t-eoGOpSel \
|
||||||
t-eoVector t-eoCheckpointing
|
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_SOURCES = t-selectOne.cpp
|
||||||
t_selectOne_DEPENDENCIES = $(DEPS)
|
t_selectOne_DEPENDENCIES = $(DEPS)
|
||||||
t_selectOne_LDFLAGS = -lm
|
t_selectOne_LDFLAGS = -lm
|
||||||
|
|
@ -63,18 +49,18 @@ t_eoAtomOps_LDFLAGS = -lm
|
||||||
t_eoAtomOps_LDADD = $(LDADDS)
|
t_eoAtomOps_LDADD = $(LDADDS)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
#disabled
|
||||||
t_eoESOps_SOURCES = t-eoESOps.cpp
|
#t_eoESOps_SOURCES = t-eoESOps.cpp
|
||||||
t_eoESOps_DEPENDENCIES = $(DEPS)
|
#t_eoESOps_DEPENDENCIES = $(DEPS)
|
||||||
t_eoESOps_LDFLAGS = -lm
|
#t_eoESOps_LDFLAGS = -lm
|
||||||
t_eoESOps_LDADD = $(LDADDS)
|
#t_eoESOps_LDADD = $(LDADDS)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
t_eoESFull_SOURCES = t-eoESFull.cpp real_value.h
|
#t_eoESFull_SOURCES = t-eoESFull.cpp real_value.h
|
||||||
t_eoESFull_DEPENDENCIES = $(DEPS)
|
#t_eoESFull_DEPENDENCIES = $(DEPS)
|
||||||
t_eoESFull_LDFLAGS = -lm
|
#t_eoESFull_LDFLAGS = -lm
|
||||||
t_eoESFull_LDADD = $(LDADDS)
|
#t_eoESFull_LDADD = $(LDADDS)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
@ -171,10 +157,10 @@ t_eo2dVector_LDADD = $(LDADDS)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
t_parser_SOURCES = t-parser.cpp
|
t_eoStateAndParser_SOURCES = t-eoStateAndParser.cpp
|
||||||
t_parser_DEPENDENCIES = $(DEPS)
|
t_eoStateAndParser_DEPENDENCIES = $(DEPS)
|
||||||
t_parser_LDFLAGS = -lm
|
t_eoStateAndParser_LDFLAGS = -lm
|
||||||
t_parser_LDADD = $(LDADDS)
|
t_eoStateAndParser_LDADD = $(LDADDS)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,31 +76,8 @@ main()
|
||||||
propSel.addOp(xover, 0.5);
|
propSel.addOp(xover, 0.5);
|
||||||
for ( i = 0; i < POP_SIZE; i ++ ) {
|
for ( i = 0; i < POP_SIZE; i ++ ) {
|
||||||
eoGeneralOp<Chrom>& foo = propSel.selectOp();
|
eoGeneralOp<Chrom>& foo = propSel.selectOp();
|
||||||
cout << foo.nInputs() << " "
|
|
||||||
<< foo.nOutputs() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// eoAltBreeder<Chrom> breeder( propSel );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// breeder(pop);
|
|
||||||
|
|
||||||
// eoSequentialOpSelector<Chrom, eoAltBreeder<Chrom>::outIt > seqSel;
|
|
||||||
|
|
||||||
// eoAltBreeder<Chrom> 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <string>
|
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
// Operators we are going to test
|
|
||||||
#include <eoAtomCreep.h>
|
|
||||||
#include <eoAtomBitFlip.h>
|
|
||||||
#include <eoAtomRandom.h>
|
|
||||||
#include <eoAtomMutation.h>
|
|
||||||
|
|
||||||
// Several EOs
|
|
||||||
#include <other/eoString.h>
|
|
||||||
|
|
||||||
// generalOp we are testing
|
|
||||||
#include <eoGeneralOp.h>
|
|
||||||
|
|
||||||
main(int argc, char *argv[]) {
|
|
||||||
eoString<float> aString("123456");
|
|
||||||
eoAtomCreep<char> creeper;
|
|
||||||
eoAtomMutation< eoString<float> > mutator( creeper, 0.5 );
|
|
||||||
|
|
||||||
eoWrappedMonOp< eoString<float> > wCreeper( mutator );
|
|
||||||
cout << "Before aString " << aString;
|
|
||||||
mutator( aString);
|
|
||||||
cout << " after mutator " << aString;
|
|
||||||
|
|
||||||
// Test now the alternative interface
|
|
||||||
eoPop< eoString<float> > vIn, vOut;
|
|
||||||
insert_iterator<eoPop<eoString<float> > > 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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -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 <utils/eoParser.h>
|
|
||||||
#include <utils/eoRNG.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
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<string> & _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<string> 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<string>::const_iterator i;
|
|
||||||
for (i=a.begin() ; i<a.end() ; i++) {
|
|
||||||
cout << *i << " ";
|
|
||||||
}
|
|
||||||
cout << ">" << 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in a new issue