* whitespace cleanup
This commit is contained in:
parent
56c6edab04
commit
70e60a50d2
146 changed files with 1763 additions and 1873 deletions
226
eo/CHANGELOG
226
eo/CHANGELOG
|
|
@ -1274,11 +1274,11 @@ Date: Thu Feb 22 08:27:32 2007 +0000
|
|||
|
||||
* mutation.tmpl, quadCrossover.tmpl, stat.tmpl: Initialize formerly
|
||||
uninitialized variables.
|
||||
|
||||
|
||||
* README.tmpl: Hint to regular Templates/README for details.
|
||||
|
||||
|
||||
* README: Add documentation for adding new source-files.
|
||||
|
||||
|
||||
* Makefile.am.src-tmpl (noinst_HEADERS): Add
|
||||
(MyStruct_SOURCES): Move header files from here to the new
|
||||
noinst_HEADERS variable.
|
||||
|
|
@ -1315,7 +1315,7 @@ Date: Sun Jan 14 18:56:31 2007 +0000
|
|||
for automake finding the scripts of eo itself if we run it in a embedded
|
||||
subdirectory.
|
||||
(COPYING, INSTALL): create.
|
||||
|
||||
|
||||
* README: State more explicitly what a "complete installation" means.
|
||||
Give build-instructions for moved directories.
|
||||
|
||||
|
|
@ -1359,9 +1359,9 @@ Author: kuepper <kuepper>
|
|||
Date: Mon Dec 18 11:17:55 2006 +0000
|
||||
|
||||
* TODO.html, README.html: Remove these old files.
|
||||
|
||||
|
||||
* AUTHORS, COPYING, ForRelease, NEWS, ToDo: Update for release.
|
||||
|
||||
|
||||
* eo.cfg (PROJECT_NUMBER): Bump version to 1.0
|
||||
|
||||
Author: kuepper <kuepper>
|
||||
|
|
@ -1373,7 +1373,7 @@ Author: kuepper <kuepper>
|
|||
Date: Sun Dec 17 22:59:53 2006 +0000
|
||||
|
||||
* README: Better links to Templates/
|
||||
|
||||
|
||||
* configure.in: Bump version to 1.0-beta2.
|
||||
|
||||
Author: kuepper <kuepper>
|
||||
|
|
@ -1402,11 +1402,11 @@ Date: Sat Dec 16 21:55:03 2006 +0000
|
|||
|
||||
* EO.tpl, MyStructEA.cpp, MyStructSEA.cpp, make_MyStruct.cpp: Use
|
||||
correct names for includes.
|
||||
|
||||
|
||||
* README.manual: This is a copy of the old README.
|
||||
|
||||
|
||||
* README: Describe the new way and setup of creating a new EO project.
|
||||
|
||||
|
||||
* createEOproject.sh, Makefile.am.src-tmpl, Makefile.am.top-tmpl:
|
||||
* configure.ac.tmpl: New files to create a standalone EO project from
|
||||
templates.
|
||||
|
|
@ -1435,7 +1435,7 @@ Author: kuepper <kuepper>
|
|||
Date: Mon Dec 4 22:27:41 2006 +0000
|
||||
|
||||
* Makefile.am: Add t-eoRNG
|
||||
|
||||
|
||||
* t-eoRNG.cpp: Start test for random number generator.
|
||||
|
||||
Author: kuepper <kuepper>
|
||||
|
|
@ -1472,11 +1472,11 @@ Author: kuepper <kuepper>
|
|||
Date: Sun Dec 3 10:41:54 2006 +0000
|
||||
|
||||
* mainpage.html: update, add link to Niko Hansen's comparison
|
||||
|
||||
|
||||
* README: Add more specific note about tutorial.
|
||||
|
||||
|
||||
* configure.in: Bump version to 1.0-beta1
|
||||
|
||||
|
||||
* tutorial/Makefile.am: Add all necessary files, including html and
|
||||
Templates to distribution.
|
||||
|
||||
|
|
@ -1517,13 +1517,13 @@ Author: kuepper <kuepper>
|
|||
Date: Sat Dec 2 10:18:57 2006 +0000
|
||||
|
||||
* eoTimedMonitor.h (eoTimedMonitor::seconds): Make unsigned.
|
||||
|
||||
|
||||
* eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp.
|
||||
|
||||
|
||||
* t-eoGenOp.cpp (init): Do not add std::ends to end of string, as this
|
||||
results in escape-codes (^@) to be printed at runtime and is not
|
||||
necessary anyway.
|
||||
|
||||
|
||||
* test/t-eoSymreg.cpp (SymregNode::operator()): Initialize r1 and r2 to
|
||||
avoid compiler warnings.
|
||||
|
||||
|
|
@ -1531,7 +1531,7 @@ Author: kuepper <kuepper>
|
|||
Date: Sat Dec 2 09:39:13 2006 +0000
|
||||
|
||||
* eoRNG.h: Cleanup docs and document /all/ members.
|
||||
|
||||
|
||||
* eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp.
|
||||
|
||||
Author: kuepper <kuepper>
|
||||
|
|
@ -1548,9 +1548,9 @@ Author: kuepper <kuepper>
|
|||
Date: Fri Dec 1 20:08:51 2006 +0000
|
||||
|
||||
* Makefile.am: Update for release-distribution.
|
||||
|
||||
|
||||
* Makefile.am: Add missing CMA header for distribution.
|
||||
|
||||
|
||||
* Makefile.am: Add missing header for distribution.
|
||||
|
||||
Author: kuepper <kuepper>
|
||||
|
|
@ -1603,7 +1603,7 @@ Author: kuepper <kuepper>
|
|||
Date: Thu Nov 16 12:52:46 2006 +0000
|
||||
|
||||
* configure.in (AC_DEBUG): add test
|
||||
|
||||
|
||||
* acinclude.m4 (AC_DEBUG): Define debug-feature and set DEBUG, NODEBUG,
|
||||
or NDEBUG according to its value.
|
||||
|
||||
|
|
@ -1613,10 +1613,10 @@ Date: Thu Nov 16 12:35:46 2006 +0000
|
|||
* make_genotype_real.h (eoEsChromInit): Rewrite vecSigmaInit-handling:
|
||||
If sigmaInit is relative (%), do not read vecSigmaInit. Otherwise
|
||||
always use vecSigmaInit with default all values of sigmaInit.
|
||||
|
||||
|
||||
* eoParser.h (eoParser::getORcreateParam): Make this a real if-then-else
|
||||
clause around ptParam (found or not).
|
||||
|
||||
|
||||
* eoParam.h (eoValueParam::setValue): Document.
|
||||
(eoValueParam<std::vector<double> >::setValue): Allow delimiters ',' and
|
||||
';'. A plain ' ' does not work, as it is not correctly read by
|
||||
|
|
@ -1973,9 +1973,9 @@ Date: Sun Oct 2 21:42:08 2005 +0000
|
|||
- add a user-option for gnuplot-support
|
||||
- separate gnuplot-code into declaration and implementation,
|
||||
so we can define at EO-build-time whether to use it or not.
|
||||
|
||||
|
||||
Adopt code and Makefiles to above changes.
|
||||
|
||||
|
||||
Some minor fixes.
|
||||
|
||||
Author: kuepper <kuepper>
|
||||
|
|
@ -2311,7 +2311,7 @@ Date: Thu Dec 23 15:29:07 2004 +0000
|
|||
|
||||
Adjust code to perform to C++ standard according to gcc-3.4
|
||||
interpretation... (Have not compiled/checked/changed paradisEO.)
|
||||
|
||||
|
||||
That is, the current code compiles with gcc-3.4 and the checks
|
||||
(besides t-MGE1bit) all pass.
|
||||
|
||||
|
|
@ -2362,7 +2362,7 @@ Date: Fri Nov 5 08:57:34 2004 +0000
|
|||
easily read as a parameter)
|
||||
- eoIntBound and all other integer-equivalent of the classes in eoRealBound.h
|
||||
Note that there is no equivalent to eoRealVectorBounds for vector of integers
|
||||
|
||||
|
||||
In file eo, I have added the 2 includes of eoRealBounds.h and eoIntBounds.h
|
||||
The first one was already there by chance, through eoUniformInit.h
|
||||
|
||||
|
|
@ -2569,13 +2569,13 @@ Author: kuepper <kuepper>
|
|||
Date: Fri Sep 17 16:53:31 2004 +0000
|
||||
|
||||
Updated build-prcess to be completely under automake control.
|
||||
|
||||
|
||||
For the tutorial the old Makefiles are saved as Makefile.simple in all
|
||||
the respective directories.
|
||||
|
||||
|
||||
Use generated config.h instead of command-line passing of preprocessor
|
||||
flags.
|
||||
|
||||
|
||||
Updated support files from current automake.
|
||||
|
||||
Author: kuepper <kuepper>
|
||||
|
|
@ -3300,7 +3300,7 @@ Date: Sun Jan 5 16:31:50 2003 +0000
|
|||
|
||||
Added pyeo. Some changes needed to be made for include files and the like
|
||||
in some files (and some bugs were fixed as well [Marc: eoOneToOneBreeder was a mess])
|
||||
|
||||
|
||||
eoFunctor.h now contains static functor_category members, this shouldn't hurt anyone.
|
||||
|
||||
Author: maartenkeijzer <maartenkeijzer>
|
||||
|
|
@ -3398,7 +3398,7 @@ Date: Wed Sep 18 12:40:46 2002 +0000
|
|||
|
||||
A new readFrom & printOn function for EO.h
|
||||
Now it CAN handle VALID/INVALID fitnesses.
|
||||
|
||||
|
||||
The problems are over at last
|
||||
|
||||
Author: cahon <cahon>
|
||||
|
|
@ -3592,7 +3592,7 @@ Date: Mon Jun 17 04:13:45 2002 +0000
|
|||
|
||||
Adding the truncation selectors.
|
||||
2 versions: eoTruncatedSelectOne is an eoSelectOne, and
|
||||
eoTruncatedSelectMany works like an eoSelectMany (but is NOT)
|
||||
eoTruncatedSelectMany works like an eoSelectMany (but is NOT)
|
||||
|
||||
Author: jeggermo <jeggermo>
|
||||
Date: Mon Jun 10 14:10:35 2002 +0000
|
||||
|
|
@ -3609,7 +3609,7 @@ Date: Mon May 13 11:31:32 2002 +0000
|
|||
|
||||
EO::printOn has been changed so that the printOn function will
|
||||
always print a valid fitness value even if the fitness is invalid
|
||||
|
||||
|
||||
Jeroen
|
||||
|
||||
Author: jeggermo <jeggermo>
|
||||
|
|
@ -3827,7 +3827,7 @@ Date: Mon Apr 15 12:56:35 2002 +0000
|
|||
|
||||
eoParseTree printOn and readFrom functions changed for
|
||||
compatibility with paradisEO
|
||||
|
||||
|
||||
The fitness is now printed in the same way as in eoBit
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
|
|
@ -4138,9 +4138,9 @@ Date: Mon Feb 4 14:28:00 2002 +0000
|
|||
|
||||
the gpsymreg code has been slightly altered to allow compilation using the
|
||||
Intel C++ Compiler for Linux.
|
||||
|
||||
|
||||
Other compilers should not be affected.
|
||||
|
||||
|
||||
A slightly different makefile is needed
|
||||
|
||||
Author: jeggermo <jeggermo>
|
||||
|
|
@ -4317,7 +4317,7 @@ Date: Tue Dec 4 21:15:16 2001 +0000
|
|||
some template classes and functions which did not need
|
||||
to be templates have been changed to normal classes and functions
|
||||
with hard coded typed
|
||||
|
||||
|
||||
This might help with M$VC++ 6.0 compatibility
|
||||
|
||||
Author: jeggermo <jeggermo>
|
||||
|
|
@ -4537,8 +4537,8 @@ Date: Sat Nov 10 09:02:17 2001 +0000
|
|||
|
||||
Small modifications here and there to be MSVC++ compatible
|
||||
Mainly, time.h -> ctime
|
||||
definition of loop index out of loops when multiply used
|
||||
no typename in declaration using template typename
|
||||
definition of loop index out of loops when multiply used
|
||||
no typename in declaration using template typename
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
Date: Sat Nov 10 06:59:02 2001 +0000
|
||||
|
|
@ -4628,15 +4628,15 @@ Date: Sat Nov 3 22:10:11 2001 +0000
|
|||
|
||||
the name of the eoGpDepthInitializer class (initializer for
|
||||
parse_tree's has been changed to
|
||||
|
||||
|
||||
eoParseTreeDepthInit but backward compatibility is maintained by
|
||||
using a #define statement:
|
||||
|
||||
|
||||
#define eoGpDepthInitializer eoParseTreeDepthInit
|
||||
|
||||
|
||||
The initializer for strongly typed GP has been changed to
|
||||
eoStParseTreeDepthInit
|
||||
|
||||
|
||||
the gpsymreg application has been changed to use the new name
|
||||
|
||||
Author: jeggermo <jeggermo>
|
||||
|
|
@ -4839,7 +4839,7 @@ Author: jeggermo <jeggermo>
|
|||
Date: Tue Jul 17 08:58:52 2001 +0000
|
||||
|
||||
small documentation change for eoParseTree.h.
|
||||
|
||||
|
||||
added a depth initializer for strongly typed genetic programming
|
||||
added subtree xover for strongly typed genetic programming
|
||||
added branch mutation for strongly typed genetic programming
|
||||
|
|
@ -4862,7 +4862,7 @@ Date: Wed Jul 4 04:44:30 2001 +0000
|
|||
Adding eoPopEvalFunc, that handles evaluation globally: it receives
|
||||
two populations, parents and offspring, and does whatever necessary.
|
||||
The subclass eoPopLoopEval does the simple loop on the offspring.
|
||||
|
||||
|
||||
eoEasyEA was subsequently modified to handle an eoPopEval passed in Ctor,
|
||||
but also to encapsulate an eoEvalFunc into an eoPopLoopEval tranparently.
|
||||
|
||||
|
|
@ -4874,7 +4874,7 @@ Date: Tue Jul 3 12:56:44 2001 +0000
|
|||
Modified eoEaseyEA accordingly - you can either pass an eoEvalFunc, as
|
||||
before (it is then encapsulated into an eoPopLoopEval that does the good
|
||||
old loop on the offspring - or directly pass a full eoPopEvalFunc
|
||||
|
||||
|
||||
Small modification also in make_op_es -> keyword "none" is now recognized
|
||||
for one of the crossover of either object variables or stdev's
|
||||
|
||||
|
|
@ -4883,9 +4883,9 @@ Date: Mon Jul 2 13:31:04 2001 +0000
|
|||
|
||||
Changed the directory structure for gp
|
||||
now: eoParseTree <-- the eoParseTree class
|
||||
eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer)
|
||||
eoParseTreeOp <-- the operators (xover and mutation)
|
||||
|
||||
eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer)
|
||||
eoParseTreeOp <-- the operators (xover and mutation)
|
||||
|
||||
base documentation written for:
|
||||
* eoParseTree
|
||||
* eoGpDepthInitializer
|
||||
|
|
@ -4895,9 +4895,9 @@ Date: Mon Jul 2 13:31:04 2001 +0000
|
|||
* eoExpansionMutation
|
||||
* eoCollapseSubtreeMutation
|
||||
* eoHoistMutation
|
||||
|
||||
|
||||
I also created a group ParseTree which contains all classes related to eoParseTree
|
||||
|
||||
|
||||
eoGpMutate.h has been removed (merged with eoParseTree operators into eoParseTreeOp
|
||||
|
||||
Author: jeggermo <jeggermo>
|
||||
|
|
@ -4978,16 +4978,16 @@ Author: jeggermo <jeggermo>
|
|||
Date: Thu Jun 28 14:03:59 2001 +0000
|
||||
|
||||
new Mutation operators for eoParseTree in src/gp/eoGpMutate.h
|
||||
|
||||
|
||||
a symbolic regression example program added to the app-dir
|
||||
|
||||
|
||||
configure.in and Makefile(s).am changed
|
||||
|
||||
Author: jeggermo <jeggermo>
|
||||
Date: Thu Jun 28 13:55:14 2001 +0000
|
||||
|
||||
Additional mutation operators for eoParseTree
|
||||
|
||||
|
||||
* Point Mutation
|
||||
* Expansion Mutation
|
||||
* Collapse Subtree Mutation
|
||||
|
|
@ -5195,7 +5195,7 @@ Date: Wed May 2 10:42:32 2001 +0000
|
|||
src/es/eoEsGlobalXover.h and src/es/eoEsLocalXover.h for crossover
|
||||
src/es/make_XXX_es.h for user-input
|
||||
test/t-eoEsAll.cpp to test
|
||||
|
||||
|
||||
However, an old bug appeared: className was not const in eoGenOp (and derived classes)
|
||||
so I had to change that throughtout the hierarchy
|
||||
|
||||
|
|
@ -5212,7 +5212,7 @@ Date: Mon Apr 30 13:24:42 2001 +0000
|
|||
Changed the interface of make_genotype - now templatized by the EOT
|
||||
and not the fitness - this is mandatory for ES genoptypes as it allows to
|
||||
choose the type of gentype at run-time (from existing types, of course!)
|
||||
|
||||
|
||||
Also moved make_help.cpp into utils dir (otherwise you'd had to maintain
|
||||
a copy into each representation dir!).
|
||||
|
||||
|
|
@ -5224,7 +5224,7 @@ Date: Mon Apr 30 13:01:07 2001 +0000
|
|||
Changed the interface of make_genotype - now templatized by the EOT
|
||||
and not the fitness - this is mandatory for ES genoptypes as it allows to
|
||||
choose the type of gentype at run-time (from existing types, of course!)
|
||||
|
||||
|
||||
Also moved make_help.cpp into utils dir (otherwise you'd had to maintain
|
||||
a copy into each representation dir!).
|
||||
|
||||
|
|
@ -5427,7 +5427,7 @@ Date: Wed Apr 4 03:47:33 2001 +0000
|
|||
|
||||
Added the signal handling - see eoCtrlCContinue.h
|
||||
I've disabled it in case of MSC as I don't know if this works there ...
|
||||
|
||||
|
||||
Also added a couple of "virtual" in the ga dir
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
|
|
@ -5455,7 +5455,7 @@ Date: Wed Mar 28 09:00:54 2001 +0000
|
|||
FDCStat and FileSnapshot: better error messageing
|
||||
Scalar fitness: is now a vector of doubles
|
||||
exercise3.1 added gnuplot again
|
||||
|
||||
|
||||
Don't know about eoCombinedContinue
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
|
|
@ -5646,7 +5646,7 @@ Author: maartenkeijzer <maartenkeijzer>
|
|||
Date: Mon Mar 12 16:00:58 2001 +0000
|
||||
|
||||
EO: added overloaded printing of fitness (for vectors and pairs)
|
||||
|
||||
|
||||
Various bugs and ommissions in eoPerf2Worth and eoSelectFromWorth
|
||||
|
||||
Author: maartenkeijzer <maartenkeijzer>
|
||||
|
|
@ -5658,12 +5658,12 @@ Author: maartenkeijzer <maartenkeijzer>
|
|||
Date: Sat Mar 10 14:02:23 2001 +0000
|
||||
|
||||
Changed the populator to be a) more efficient and b) more useable
|
||||
|
||||
|
||||
It is no longer derived from eoPop, it now gets a destination population.
|
||||
This saves a lot of copying. The semantics has changed a little as well. It is
|
||||
now an _infinite_ iterator. operator++ will *not* dispense new individuals, but
|
||||
will merely stay at the end. To get a new indy, use operator*() as before.
|
||||
|
||||
|
||||
eoEasyEA now checks the checkpoint *after* making a generation and clears the offspring
|
||||
eoGeneralBreeder is changed to reflect the changes in eoPopulator
|
||||
eoSequentialSelect now uses setup() rather than init()
|
||||
|
|
@ -5717,7 +5717,7 @@ Date: Mon Feb 19 12:23:13 2001 +0000
|
|||
To be able to use the primitive std::generate function, added a
|
||||
set of wrappers in eoSTLFunctor.h that have the copy semantics most
|
||||
STL functions expect (namely pass-by-value rather then pass-by-reference).
|
||||
|
||||
|
||||
Updated test/Makefile.am to also test t-eoRandom
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
|
|
@ -5736,14 +5736,14 @@ Author: maartenkeijzer <maartenkeijzer>
|
|||
Date: Sat Feb 17 10:51:31 2001 +0000
|
||||
|
||||
eoVector is back (eoFixedLength and eoVariableLength are gone)
|
||||
|
||||
|
||||
Also: introducing eoRndGenerators.h for eoRndGenerator derived classes:
|
||||
|
||||
|
||||
eoNormalGenerator
|
||||
eoUniformGenerator
|
||||
eoBooleanGenerator
|
||||
eoNegExpGenerator
|
||||
|
||||
|
||||
Note the suffix that are added to aid in determining what these classes do
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
|
|
@ -5829,13 +5829,13 @@ Date: Wed Feb 14 14:09:16 2001 +0000
|
|||
Author: maartenkeijzer <maartenkeijzer>
|
||||
Date: Wed Feb 14 10:35:26 2001 +0000
|
||||
|
||||
|
||||
|
||||
Changed the signature of eoMon, eoBin and eoQuadOp to return a bool,
|
||||
without invalidating fitness. Added a set of invalidators to take over
|
||||
that job (see for instance eoSGA and eoSGATransform how this can transparantly used)
|
||||
|
||||
|
||||
Derived eoState from eoFunctorStore (for convenience, from a design perspective this may sound wrong)
|
||||
|
||||
|
||||
Added a wrap_op function that does the wrapping for you (see eoOpContainer how this made this functor
|
||||
exceedingly less hairy). Checked all the tests removed the eoGeneric*Op family (not needed anymore)
|
||||
and of course changed all the operators to reflect the change (and found a few that didn't
|
||||
|
|
@ -5865,24 +5865,24 @@ Author: maartenkeijzer <maartenkeijzer>
|
|||
Date: Tue Feb 13 12:38:19 2001 +0000
|
||||
|
||||
fixed a bug: the parser now correctly parses parameters of the form
|
||||
|
||||
|
||||
-Pvalue
|
||||
|
||||
|
||||
This will now produce 'value'. The buggy parser would parse 'alue' here. I am truly and deeply
|
||||
ashamed to have created such an off-by-one error.
|
||||
|
||||
|
||||
Marc assumed this was wanted behaviour (so that it should read: -P=value)
|
||||
I must admit that this is a logical conclusion, though it was merely a side-effect
|
||||
of the error. To not force Marc to rewrite the tutorial and his way of working with
|
||||
EO, I decided to make a feature out of the bug, so that now the parser will parse:
|
||||
|
||||
|
||||
-Pvalue
|
||||
-P=value
|
||||
|
||||
|
||||
and of course the true and blue:
|
||||
|
||||
|
||||
-Parameter=value
|
||||
|
||||
|
||||
I will now go and check if I sent out some crappy papers caused by this bug (as I've been using eo!)
|
||||
|
||||
Author: maartenkeijzer <maartenkeijzer>
|
||||
|
|
@ -5894,14 +5894,14 @@ Author: maartenkeijzer <maartenkeijzer>
|
|||
Date: Mon Feb 12 13:58:51 2001 +0000
|
||||
|
||||
Ok, updated the Makefile.am again to use the
|
||||
|
||||
|
||||
make check
|
||||
|
||||
|
||||
Command I picked up in the automake documentation (RTFM, you know)
|
||||
|
||||
|
||||
Tagged a lot of header functions in the GnuPlot files with 'inline',
|
||||
so they can be used from more than one sourcefile.
|
||||
|
||||
|
||||
Ok, now the interesting news. Started a new library libga (not to be confused
|
||||
with Matthew's GaLib). Here I suggest we put a fairly complete and configurable
|
||||
genetic algorithm. Just to see how far we can stretch ourselves and also to have
|
||||
|
|
@ -5920,7 +5920,7 @@ Author: maartenkeijzer <maartenkeijzer>
|
|||
Date: Sun Feb 11 16:25:03 2001 +0000
|
||||
|
||||
Removed small bug in reading outside a buffer in eoParser::readFrom
|
||||
|
||||
|
||||
This caused the parser to crash when a simple flag of the form program -f
|
||||
was given.
|
||||
|
||||
|
|
@ -6014,8 +6014,8 @@ Date: Fri Feb 9 05:09:26 2001 +0000
|
|||
I also changed
|
||||
- the eoQuadratic into eoQuad (as dicussed with Maarten)
|
||||
- the eoBin into eoBit, with more appropriate names for the "binary"
|
||||
operators (that can be unary!) as no one protested when I posted on
|
||||
eodev list
|
||||
operators (that can be unary!) as no one protested when I posted on
|
||||
eodev list
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
Date: Wed Feb 7 05:15:18 2001 +0000
|
||||
|
|
@ -6039,7 +6039,7 @@ Date: Wed Feb 7 05:04:24 2001 +0000
|
|||
Added selection methods
|
||||
eoBestSelect always return the best individual
|
||||
eoSequentialSelect a selectOne version of eoDetSelect (uses an index to
|
||||
return next offspring from sorted pop)
|
||||
return next offspring from sorted pop)
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
Date: Thu Feb 1 05:27:36 2001 +0000
|
||||
|
|
@ -6061,7 +6061,7 @@ Date: Wed Jan 31 18:38:39 2001 +0000
|
|||
every generation) which is different from the continuous monitoring (same file/plot is
|
||||
angemented every generation).
|
||||
This lead to a number of modifications in many files in utils dir
|
||||
|
||||
|
||||
But now we can watch on-line
|
||||
- fitness spreadout
|
||||
- FDC plots
|
||||
|
|
@ -6078,7 +6078,7 @@ Date: Mon Jan 29 10:25:44 2001 +0000
|
|||
Added the truncate and the hasNoBoundAtAll methods in eoRealBounds.
|
||||
The former simply set values to the boundary values in case they are out
|
||||
The latter allows to short-cut all bound-checks when no need
|
||||
|
||||
|
||||
SOme day I will put this in utils, and have a eoRealBounds.cpp in the
|
||||
pre-compiled library
|
||||
|
||||
|
|
@ -6129,12 +6129,12 @@ Date: Sat Jan 27 07:43:58 2001 +0000
|
|||
eo everything that is general to any representation
|
||||
es.h everything about real representation (in es dir)
|
||||
ga.h everything related to bitstring representation (in ga dir)
|
||||
|
||||
|
||||
To be continued by gp.h, and ...
|
||||
|
||||
|
||||
This has lead to some slight modifications in test file eobin and all tutorial
|
||||
examples files...
|
||||
|
||||
|
||||
I've also added in utils eoDistance, generic functor to compute distances,
|
||||
including also the generic Euclidian distance
|
||||
|
||||
|
|
@ -6145,9 +6145,9 @@ Date: Sat Jan 27 07:41:46 2001 +0000
|
|||
eo everything that is general to any representation
|
||||
es.h everything about real representation (in es dir)
|
||||
ga.h everything related to bitstring representation (in ga dir)
|
||||
|
||||
|
||||
To be continued by gp.h, and ...
|
||||
|
||||
|
||||
This has lead to some slight modifications in test file eobin and all tutorial
|
||||
examples files...
|
||||
|
||||
|
|
@ -6405,7 +6405,7 @@ Date: Tue Jan 2 07:03:57 2001 +0000
|
|||
permanent parameters (eoParser only holds references), and egcs did not allow
|
||||
to create them by reference, i.e. in the line
|
||||
eoValueParam<xxx> & blablaParam(...);
|
||||
|
||||
|
||||
So now everything is done in the main_function, and 3 lines are needed to create
|
||||
and read every paramter (sigh ...)
|
||||
|
||||
|
|
@ -6483,16 +6483,16 @@ Date: Tue Dec 19 18:41:19 2000 +0000
|
|||
THe big eoReplacement update:
|
||||
The interface for eoReplacement is now eoPop<EOT>&, eoPop<EOT>&
|
||||
(i.e. no const) and the result must be in the first argument in the end.
|
||||
|
||||
|
||||
Hence it is possible to do SSGA and all intermediate replacmeent procedures
|
||||
|
||||
|
||||
The classes derived from eoMergeReduce.h are now in a separate file
|
||||
The SSGA-like replcaement procedures are in eoReduceMerge.h
|
||||
A more general replacement can be found in eoSurviveAndDie.h
|
||||
(it could be made a littel more general - still open for upgrades).
|
||||
|
||||
|
||||
Also some accessors have been added to the eoPop (best and worse individuals)
|
||||
|
||||
|
||||
And include file eo has been updated
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
|
|
@ -6630,16 +6630,16 @@ Author: evomarc <evomarc>
|
|||
Date: Mon Dec 4 06:58:43 2000 +0000
|
||||
|
||||
Added the lastCall construct: if the stopping condition becomes true in eoCheckPoint,
|
||||
a method called lastCall is called for everything contained in that checkpoint
|
||||
(stats, updaters and monitors). This can be extremely useful
|
||||
- for stateSavers (see below)
|
||||
- for monitoring things like rates of success of operators, where what you
|
||||
are interested in is the final result only.
|
||||
a method called lastCall is called for everything contained in that checkpoint
|
||||
(stats, updaters and monitors). This can be extremely useful
|
||||
- for stateSavers (see below)
|
||||
- for monitoring things like rates of success of operators, where what you
|
||||
are interested in is the final result only.
|
||||
Added of course a virtual method lastCall that does nothing by default in classes
|
||||
eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor
|
||||
eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor
|
||||
Added a boolean to control the save of the state in method eoCountedStateSaver::lastCall
|
||||
so you can ask that the state is saved at final population, whatever happens.
|
||||
I also added the corresponding constructor to take this into account.
|
||||
so you can ask that the state is saved at final population, whatever happens.
|
||||
I also added the corresponding constructor to take this into account.
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
Date: Mon Dec 4 05:55:59 2000 +0000
|
||||
|
|
@ -6822,8 +6822,8 @@ Author: evomarc <evomarc>
|
|||
Date: Tue Nov 28 06:46:37 2000 +0000
|
||||
|
||||
Modified the contructor: the default value for the delimiter is now " "
|
||||
and I added a boolean argument to indicate whether or not we want to
|
||||
overwrite an existing file with same name (default is overwrite).
|
||||
and I added a boolean argument to indicate whether or not we want to
|
||||
overwrite an existing file with same name (default is overwrite).
|
||||
Added the getFileName accessor.
|
||||
|
||||
Author: evomarc <evomarc>
|
||||
|
|
@ -7085,7 +7085,7 @@ Author: maartenkeijzer <maartenkeijzer>
|
|||
Date: Fri Oct 6 10:41:38 2000 +0000
|
||||
|
||||
Added an eoSortedStatBase for more efficient statistic calculations
|
||||
|
||||
|
||||
updated a few makefiles to include the html and latex docs with the
|
||||
distribution.
|
||||
|
||||
|
|
@ -7844,12 +7844,12 @@ Author: mac <mac>
|
|||
Date: Mon Mar 6 16:05:47 2000 +0000
|
||||
|
||||
Fixed bug in eoGOpSelector (missing break!)
|
||||
|
||||
|
||||
eoOp.h: binOp's second arg is const once more
|
||||
|
||||
|
||||
all dsp and dsw files were touched by msvc, but did add some stuff (which
|
||||
will be added to eo later)
|
||||
|
||||
|
||||
Hope this all works
|
||||
|
||||
Author: mac <mac>
|
||||
|
|
@ -7879,7 +7879,7 @@ Author: marc <marc>
|
|||
Date: Tue Feb 29 05:14:40 2000 +0000
|
||||
|
||||
wherease the command "cvs ci" is OK.
|
||||
|
||||
|
||||
Here we go:
|
||||
- added the virtual destructors of all classes,
|
||||
to suppress g++ annoying warnings when using -Wall option
|
||||
|
|
@ -7930,7 +7930,7 @@ Date: Sat Feb 19 16:30:42 2000 +0000
|
|||
|
||||
Moved the static eoRNG rng to an extern eoRNG
|
||||
This external object is now defined in eoPersistent.cpp
|
||||
|
||||
|
||||
This should change...
|
||||
|
||||
Author: mac <mac>
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
|
|||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
|
|
@ -457,7 +457,7 @@ DAMAGES.
|
|||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# NOTE: only add something here if it is really needed by EO
|
||||
|
||||
include(CheckIncludeFile)
|
||||
|
|
@ -7,17 +6,17 @@ include(CheckSymbolExists)
|
|||
include(CheckFunctionExists)
|
||||
include(CheckLibraryExists)
|
||||
|
||||
check_library_exists(m cos "cos in libm" HAVE_LIBM)
|
||||
check_library_exists(m cos "cos in libm" HAVE_LIBM)
|
||||
|
||||
check_include_files(cmath.h "cmath.h" HAVE_CMATH_H)
|
||||
check_include_files(stdio.h "stdio.h" HAVE_STDIO_H)
|
||||
check_include_files(stdlib.h "stdlib.h" HAVE_STDLIB_H)
|
||||
check_include_files(string.h "string.h" HAVE_STRING_H)
|
||||
check_include_files(strings.h "strings.h" HAVE_STRINGS_H)
|
||||
check_include_files(malloc.h "malloc.h" HAVE_MALLOC_H)
|
||||
check_include_files(limits.h "limits.h" HAVE_LIMITS_H)
|
||||
check_include_files(unistd.h "unistd.h" HAVE_UNISTD_H)
|
||||
check_include_files(stdint.h "stdint.h" HAVE_STDINT_H)
|
||||
check_include_files(cmath.h "cmath.h" HAVE_CMATH_H)
|
||||
check_include_files(stdio.h "stdio.h" HAVE_STDIO_H)
|
||||
check_include_files(stdlib.h "stdlib.h" HAVE_STDLIB_H)
|
||||
check_include_files(string.h "string.h" HAVE_STRING_H)
|
||||
check_include_files(strings.h "strings.h" HAVE_STRINGS_H)
|
||||
check_include_files(malloc.h "malloc.h" HAVE_MALLOC_H)
|
||||
check_include_files(limits.h "limits.h" HAVE_LIMITS_H)
|
||||
check_include_files(unistd.h "unistd.h" HAVE_UNISTD_H)
|
||||
check_include_files(stdint.h "stdint.h" HAVE_STDINT_H)
|
||||
|
||||
|
||||
# Use check_symbol_exists to check for symbols in a reliable
|
||||
|
|
@ -27,7 +26,4 @@ check_include_files(stdint.h "stdint.h" HAVE_STDINT_H)
|
|||
# specific order. Refer to the man page for each symbol for which a
|
||||
# check is to be added to get the proper set of headers. Example :
|
||||
|
||||
#check_symbol_exists(asymbol "symbole.h" HAVE_SYMBOLE)
|
||||
|
||||
|
||||
|
||||
#check_symbol_exists(asymbol "symbole.h" HAVE_SYMBOLE)
|
||||
|
|
|
|||
|
|
@ -233,4 +233,3 @@ operates.
|
|||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
|
|||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
|
|
@ -457,7 +457,7 @@ DAMAGES.
|
|||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
|
|
@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names:
|
|||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
|
|
|
|||
13
eo/NEWS
13
eo/NEWS
|
|
@ -7,11 +7,11 @@
|
|||
- GCC 4.3 compatibility
|
||||
- new versatile log system with several nested verbose levels
|
||||
- classes using intern verbose parameters marked as deprecated, please update your code accordingly if you use one of the following files:
|
||||
eo/src/eoCombinedInit.h
|
||||
eo/src/eoGenContinue.h
|
||||
eo/src/eoProportionalCombinedOp.h
|
||||
eo/src/utils/eoData.h
|
||||
eo/src/utils/eoStdoutMonitor.h
|
||||
eo/src/eoCombinedInit.h
|
||||
eo/src/eoGenContinue.h
|
||||
eo/src/eoProportionalCombinedOp.h
|
||||
eo/src/utils/eoData.h
|
||||
eo/src/utils/eoStdoutMonitor.h
|
||||
- an evaluator that throw an exception if a maximum eval numbers has been reached, independently of the number of generations
|
||||
- new monitor that can write on any ostream
|
||||
- new continuator that can catch POSIX system user signals
|
||||
|
|
@ -33,10 +33,9 @@
|
|||
- Add Microsoft Visual C++ project support files (for Visual Studio 2003 and 2005)
|
||||
- Upgrade Teamplates/ script to create a complete standalone EO project (using autotools)
|
||||
- Remove support for pre-standard C++ compiler (i.e. gcc-2.x), which allows to
|
||||
clean up the code considerably.
|
||||
clean up the code considerably.
|
||||
Assume availability of sstream and limits.
|
||||
|
||||
* release 0.9.3z.1 (1. Oct. 2005)
|
||||
- Support gcc-3.4 and gcc.4.x.
|
||||
- Provide full automake/autoconf/configure support.
|
||||
|
||||
|
|
|
|||
23
eo/README
23
eo/README
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
EO README FILE
|
||||
EO README FILE
|
||||
|
||||
=======================================================================
|
||||
check latest news at http://eodev.sourceforge.net/
|
||||
check latest news at http://eodev.sourceforge.net/
|
||||
=======================================================================
|
||||
|
||||
Welcome to EO, the Evolving Objects library.
|
||||
|
|
@ -14,7 +13,7 @@ In case of any problem, please e-mail us at
|
|||
eodev-help@lists.sourceforge.net, eodev@egroups.com
|
||||
|
||||
To get started, take a look at the tutorial, starting with
|
||||
./tutorial/html/eoTutorial.html
|
||||
./tutorial/html/eoTutorial.html
|
||||
|
||||
The easiest way to start programming a new genome with all EO
|
||||
evolution engines handy is to create a new standalone EO project from
|
||||
|
|
@ -23,11 +22,11 @@ an introduction;)
|
|||
|
||||
|
||||
==================================================================
|
||||
BUILDING EO
|
||||
BUILDING EO
|
||||
==================================================================
|
||||
The basic installation procedure goes the following:
|
||||
|
||||
Go to your build-directory and run
|
||||
Go to your build-directory and run
|
||||
$(SRCDIR)/configure
|
||||
make
|
||||
make check
|
||||
|
|
@ -50,7 +49,7 @@ specific about EO.
|
|||
|
||||
|
||||
===================================================================
|
||||
DIRECTORY STRUCTURE
|
||||
DIRECTORY STRUCTURE
|
||||
===================================================================
|
||||
After unpacking the archive file, you should end up with the following
|
||||
structure:
|
||||
|
|
@ -63,7 +62,7 @@ structure:
|
|||
| |
|
||||
| +- ga bistring-genotypes source files
|
||||
| |
|
||||
| +- es real-valued-genotypes source files
|
||||
| +- es real-valued-genotypes source files
|
||||
| |
|
||||
| +- gp Genetic Programming source files
|
||||
| |
|
||||
|
|
@ -74,9 +73,9 @@ structure:
|
|||
+-- tutorial TUTORIAL dir (indeed :-)
|
||||
| |
|
||||
| +- html all html files - start by browsing index.html
|
||||
| |
|
||||
| |
|
||||
| +- LessonX for X=1, 2, 3, ... : example of increasing complexity
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
+-- doc DOCUMENTATION dir (generated by Doxygen)
|
||||
|
|
@ -93,7 +92,7 @@ structure:
|
|||
|
|
||||
+-- app APPLICATIONS - one dir per separate application
|
||||
| |
|
||||
| +- gprop GA/backpropagation for neural nets
|
||||
| +- gprop GA/backpropagation for neural nets
|
||||
| |
|
||||
| +- mastermind the wellknown MasterMind game
|
||||
|
|
||||
|
|
@ -103,7 +102,7 @@ structure:
|
|||
|
||||
|
||||
===================================================================
|
||||
NOTES
|
||||
NOTES
|
||||
===================================================================
|
||||
If you extracted a fresh snapshot from the cvs-repository, remember
|
||||
to run
|
||||
|
|
|
|||
|
|
@ -18,15 +18,14 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
|
|||
SET (GPROP_SOURCES gprop.cpp)
|
||||
|
||||
# especially for Visual Studio
|
||||
IF(NOT WIN32 OR CYGWIN)
|
||||
ADD_EXECUTABLE(gprop ${GPROP_SOURCES})
|
||||
IF(NOT WIN32 OR CYGWIN)
|
||||
ADD_EXECUTABLE(gprop ${GPROP_SOURCES})
|
||||
ADD_DEPENDENCIES(gprop eo eoutils)
|
||||
|
||||
TARGET_LINK_LIBRARIES(gprop eo eoutils)
|
||||
|
||||
|
||||
TARGET_LINK_LIBRARIES(gprop eo eoutils)
|
||||
|
||||
SET(GPROP_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(gprop PROPERTIES VERSION "${GPROP_VERSION}")
|
||||
ENDIF(NOT WIN32 OR CYGWIN)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -207,12 +207,12 @@ int correct(const mlp::net& net, const mlp::set& set)
|
|||
unsigned partial = 0;
|
||||
|
||||
for (unsigned i = 0; i < s->output.size(); ++i)
|
||||
if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) ||
|
||||
(s->output[i] > 0.5 && net(s->input)[i] > 0.5))
|
||||
++partial;
|
||||
if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) ||
|
||||
(s->output[i] > 0.5 && net(s->input)[i] > 0.5))
|
||||
++partial;
|
||||
|
||||
if (partial == s->output.size())
|
||||
++sum;
|
||||
++sum;
|
||||
}
|
||||
|
||||
return sum;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace l2
|
|||
//---------------------------------------------------------------------------
|
||||
// error
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
real error(const mlp::net& net, const set& ts)
|
||||
{
|
||||
real error_ = 0.0;
|
||||
|
|
@ -37,12 +37,12 @@ namespace l2
|
|||
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
|
||||
{
|
||||
vector out = net(s->input);
|
||||
|
||||
|
||||
for (unsigned i = 0; i < out.size(); ++i)
|
||||
{
|
||||
real target = s->output[i];
|
||||
real value = out[i];
|
||||
error_ -= target * log(value + min_real) +
|
||||
error_ -= target * log(value + min_real) +
|
||||
(1.0 - target) * log(1.0 - value + min_real);
|
||||
}
|
||||
}
|
||||
|
|
@ -53,25 +53,25 @@ namespace l2
|
|||
//-------------------------------------------------------------------------
|
||||
// l2
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
|
||||
class net: public qp::net
|
||||
{
|
||||
public:
|
||||
net(mlp::net& n): qp::net(n) {}
|
||||
|
||||
|
||||
real error(const set& ts)
|
||||
{
|
||||
real error_ = 0;
|
||||
|
||||
|
||||
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
|
||||
{
|
||||
forward(s->input);
|
||||
error_ -= backward(s->input, s->output);
|
||||
}
|
||||
|
||||
|
||||
return error_;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
real backward(const vector& input, const vector& output)
|
||||
{
|
||||
|
|
@ -84,7 +84,7 @@ namespace l2
|
|||
{
|
||||
neuron& n = (*current_layer)[j];
|
||||
real out = output[j];
|
||||
n.ndelta += n.delta = (out - n.out) /
|
||||
n.ndelta += n.delta = (out - n.out) /
|
||||
(n.out * (1.0 - n.out) + min_real) * n.out * (1.0 - n.out);
|
||||
|
||||
if (size() == 1) // monolayer
|
||||
|
|
@ -92,21 +92,21 @@ namespace l2
|
|||
else // multilayer
|
||||
for (unsigned k = 0; k < n.dxo.size(); ++k)
|
||||
n.dxo[k] += n.delta * (*backward_layer)[k].out;
|
||||
|
||||
error_ += out * log(n.out + min_real) +
|
||||
|
||||
error_ += out * log(n.out + min_real) +
|
||||
(1.0 - out) * log(1.0 - n.out + min_real);
|
||||
}
|
||||
|
||||
|
||||
// hidden layers
|
||||
while (++current_layer != rend())
|
||||
{
|
||||
reverse_iterator forward_layer = current_layer - 1;
|
||||
reverse_iterator backward_layer = current_layer + 1;
|
||||
|
||||
reverse_iterator backward_layer = current_layer + 1;
|
||||
|
||||
for (unsigned j = 0; j < current_layer->size(); ++j)
|
||||
{
|
||||
neuron& n = (*current_layer)[j];
|
||||
real sum = 0;
|
||||
real sum = 0;
|
||||
for (unsigned k = 0; k < forward_layer->size(); ++k)
|
||||
{
|
||||
neuron& nf = (*forward_layer)[k];
|
||||
|
|
@ -114,7 +114,7 @@ namespace l2
|
|||
}
|
||||
n.delta = n.out * (1.0 - n.out) * sum;
|
||||
n.ndelta += n.delta;
|
||||
|
||||
|
||||
if (backward_layer == rend()) // first hidden layer
|
||||
n.dxo += n.delta * input;
|
||||
else // rest of hidden layers
|
||||
|
|
@ -122,19 +122,19 @@ namespace l2
|
|||
n.dxo[k] += n.delta * (*backward_layer)[k].out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return error_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
} // namespace l2
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // l2_h
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace std {
|
|||
istream& operator>>(istream& is, mlp::vector& v)
|
||||
{
|
||||
for (mlp::vector::iterator vi = v.begin() ; vi != v.end() ; vi++) {
|
||||
is >> *vi;
|
||||
is >> *vi;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
|
@ -133,15 +133,15 @@ namespace mlp
|
|||
#ifdef HAVE_LIBYAML_CPP
|
||||
YAML_SERIALIZABLE_AUTO(neuron)
|
||||
void emit_yaml(YAML::Emitter&out) const {
|
||||
out << YAML::BeginMap;
|
||||
out << YAML::Key << "Class" << YAML::Value << "mlp::neuron";
|
||||
YAML_EMIT_MEMBER(out,bias);
|
||||
YAML_EMIT_MEMBER(out,weight);
|
||||
out << YAML::EndMap;
|
||||
out << YAML::BeginMap;
|
||||
out << YAML::Key << "Class" << YAML::Value << "mlp::neuron";
|
||||
YAML_EMIT_MEMBER(out,bias);
|
||||
YAML_EMIT_MEMBER(out,weight);
|
||||
out << YAML::EndMap;
|
||||
}
|
||||
void load_yaml(const YAML::Node& node) {
|
||||
YAML_LOAD_MEMBER(node, bias);
|
||||
YAML_LOAD_MEMBER(node, weight);
|
||||
YAML_LOAD_MEMBER(node, bias);
|
||||
YAML_LOAD_MEMBER(node, weight);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
@ -213,17 +213,17 @@ namespace mlp {
|
|||
}
|
||||
#ifdef HAVE_LIBYAML_CPP
|
||||
friend ostream& operator<<(YAML::Emitter& e, const layer &l) {
|
||||
e << ((std::vector<neuron>)l);
|
||||
e << ((std::vector<neuron>)l);
|
||||
}
|
||||
|
||||
friend void operator>>(const YAML::Node& n, layer &l) {
|
||||
// These temporary variable shenanegins are necessary because
|
||||
// the compiler gets very confused about which template operator>>
|
||||
// function to use.
|
||||
// The following does not work: n >> l;
|
||||
// So we use a temporary variable thusly:
|
||||
std::vector<mlp::neuron> *obviously_a_vector = &l;
|
||||
n >> *obviously_a_vector;
|
||||
// These temporary variable shenanegins are necessary because
|
||||
// the compiler gets very confused about which template operator>>
|
||||
// function to use.
|
||||
// The following does not work: n >> l;
|
||||
// So we use a temporary variable thusly:
|
||||
std::vector<mlp::neuron> *obviously_a_vector = &l;
|
||||
n >> *obviously_a_vector;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ namespace std {
|
|||
istream& operator>>(istream& is, mlp::layer& l)
|
||||
{
|
||||
for (mlp::layer::iterator li = l.begin() ; li != l.end() ; li++) {
|
||||
is >> *li;
|
||||
is >> *li;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
|
@ -277,15 +277,15 @@ namespace mlp {
|
|||
#ifdef HAVE_LIBYAML_CPP
|
||||
YAML_SERIALIZABLE_AUTO(net)
|
||||
void emit_members(YAML::Emitter&out) const {
|
||||
const std::vector<layer>* me_as_layer_vector = this;
|
||||
out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector;
|
||||
const std::vector<layer>* me_as_layer_vector = this;
|
||||
out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector;
|
||||
}
|
||||
|
||||
void load_members(const YAML::Node& node) {
|
||||
std::vector<layer>* me_as_layer_vector = this;
|
||||
node["layers"] >> *me_as_layer_vector;
|
||||
std::vector<layer>* me_as_layer_vector = this;
|
||||
node["layers"] >> *me_as_layer_vector;
|
||||
}
|
||||
#endif // HAVE_LIBYAML_CPP
|
||||
#endif // HAVE_LIBYAML_CPP
|
||||
|
||||
/** Virtual destructor */
|
||||
virtual ~net() {};
|
||||
|
|
@ -303,14 +303,14 @@ namespace mlp {
|
|||
is >> layer_size;
|
||||
layer_sizes.push_back(layer_size);
|
||||
}
|
||||
unsigned check_outputs;
|
||||
unsigned check_outputs;
|
||||
is >> check_outputs;
|
||||
assert (check_outputs == num_outputs);
|
||||
init (num_inputs,num_outputs,layer_sizes);
|
||||
// skip forward to pass up opening '<' char
|
||||
char c=' ';
|
||||
while (c!='<' && !is.eof()) { is >> c;}
|
||||
for (iterator l =begin() ; l != end(); l++) {
|
||||
// skip forward to pass up opening '<' char
|
||||
char c=' ';
|
||||
while (c!='<' && !is.eof()) { is >> c;}
|
||||
for (iterator l =begin() ; l != end(); l++) {
|
||||
is >> *l;
|
||||
}
|
||||
do { is >> c; } while (c == ' ' && !is.eof());
|
||||
|
|
@ -351,15 +351,15 @@ namespace mlp {
|
|||
}
|
||||
|
||||
void save(ostream &os) const {
|
||||
// Save the number of inputs, number of outputs, and number of hidden layers
|
||||
// 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)
|
||||
for(const_iterator l = begin(); l != end(); ++l)
|
||||
os << l->size() << " ";
|
||||
os << "\n";
|
||||
os << "< ";
|
||||
for(const_iterator l = begin(); l != end(); ++l)
|
||||
os << "\n";
|
||||
os << "< ";
|
||||
for(const_iterator l = begin(); l != end(); ++l)
|
||||
os << *l << " ";
|
||||
os << ">\n";
|
||||
os << ">\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -454,7 +454,7 @@ namespace mlp {
|
|||
|
||||
void load(istream &is) {
|
||||
unsigned input_size, output_size;
|
||||
is >> input_size >> output_size;
|
||||
is >> input_size >> output_size;
|
||||
sample samp(input_size, output_size);;
|
||||
while (is >> samp) { push_back(samp); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace mse
|
|||
//---------------------------------------------------------------------------
|
||||
// error
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
real error(const mlp::net& net, const set& ts)
|
||||
{
|
||||
real error_ = 0.0;
|
||||
|
|
@ -36,7 +36,7 @@ namespace mse
|
|||
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
|
||||
{
|
||||
vector out = net(s->input);
|
||||
|
||||
|
||||
for (unsigned i = 0; i < out.size(); ++i)
|
||||
{
|
||||
real diff = s->output[i] - out[i];
|
||||
|
|
@ -49,26 +49,26 @@ namespace mse
|
|||
//-------------------------------------------------------------------------
|
||||
// mse
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
|
||||
class net: public qp::net
|
||||
{
|
||||
public:
|
||||
net(mlp::net& n): qp::net(n) {}
|
||||
|
||||
|
||||
real error(const set& ts)
|
||||
{
|
||||
real error_ = 0;
|
||||
|
||||
|
||||
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
|
||||
{
|
||||
forward(s->input);
|
||||
error_ += backward(s->input, s->output);
|
||||
}
|
||||
error_ /= ts.size();
|
||||
|
||||
|
||||
return error_;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
real backward(const vector& input, const vector& output)
|
||||
{
|
||||
|
|
@ -89,22 +89,22 @@ namespace mse
|
|||
else // multilayer
|
||||
for (unsigned k = 0; k < n.dxo.size(); ++k)
|
||||
n.dxo[k] += n.delta * (*backward_layer)[k].out;
|
||||
|
||||
|
||||
error_ += diff * diff;
|
||||
}
|
||||
|
||||
|
||||
// hidden layers
|
||||
while (++current_layer != rend())
|
||||
{
|
||||
reverse_iterator forward_layer = current_layer - 1;
|
||||
reverse_iterator backward_layer = current_layer + 1;
|
||||
|
||||
|
||||
for (unsigned j = 0; j < current_layer->size(); ++j)
|
||||
{
|
||||
|
||||
|
||||
neuron& n = (*current_layer)[j];
|
||||
real sum = 0;
|
||||
|
||||
|
||||
for (unsigned k = 0; k < forward_layer->size(); ++k)
|
||||
{
|
||||
neuron& nf = (*forward_layer)[k];
|
||||
|
|
@ -113,8 +113,8 @@ namespace mse
|
|||
|
||||
n.delta = n.out * (1.0 - n.out) * sum;
|
||||
n.ndelta += n.delta;
|
||||
|
||||
|
||||
|
||||
|
||||
if (backward_layer == rend()) // first hidden layer
|
||||
n.dxo += n.delta * input;
|
||||
else // rest of hidden layers
|
||||
|
|
@ -122,19 +122,19 @@ namespace mse
|
|||
n.dxo[k] += n.delta * (*backward_layer)[k].out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return error_;
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
} // namespace mse
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // mse_h
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
|
|
|
|||
|
|
@ -41,55 +41,55 @@ namespace qp
|
|||
const real backtrack_step = 0.5;
|
||||
const real me_floor = 0.0001;
|
||||
const real mw_floor = 0.0001;
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// neuron
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
struct neuron
|
||||
{
|
||||
mlp::neuron* n;
|
||||
real out, delta, ndelta, dbias1, dbias2;
|
||||
vector dweight1, dweight2, dxo;
|
||||
|
||||
neuron(mlp::neuron& _n):
|
||||
n(&_n), out(0), delta(0), ndelta(0), dbias1(0), dbias2(0),
|
||||
dweight1(n->weight.size(), 0),
|
||||
dweight2(n->weight.size(), 0),
|
||||
|
||||
neuron(mlp::neuron& _n):
|
||||
n(&_n), out(0), delta(0), ndelta(0), dbias1(0), dbias2(0),
|
||||
dweight1(n->weight.size(), 0),
|
||||
dweight2(n->weight.size(), 0),
|
||||
dxo(n->weight.size(), 0) {}
|
||||
|
||||
|
||||
void reset()
|
||||
{
|
||||
// underlaying neuron
|
||||
n->reset();
|
||||
|
||||
|
||||
// addons
|
||||
out = delta = ndelta = dbias1 = dbias2 = 0;
|
||||
fill(dweight1.begin(), dweight1.end(), 0);
|
||||
fill(dweight2.begin(), dweight2.end(), 0);
|
||||
fill(dxo.begin(), dxo.end(), 0);
|
||||
}
|
||||
|
||||
|
||||
real operator()(const vector& input)
|
||||
{
|
||||
return out = mlp::sigmoid(n->bias + dbias1 +
|
||||
return out = mlp::sigmoid(n->bias + dbias1 +
|
||||
(n->weight + dweight1) * input);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const neuron& n)
|
||||
{
|
||||
return os << *n.n << " " << n.out << " " << n.delta << " "
|
||||
<< n.ndelta << " " << n.dbias1 << " " << n.dbias2 << " "
|
||||
return os << *n.n << " " << n.out << " " << n.delta << " "
|
||||
<< n.ndelta << " " << n.dbias1 << " " << n.dbias2 << " "
|
||||
<< n.dweight1 << " " << n.dweight2 << " " << n.dxo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// layer
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class layer: public std::vector<neuron>
|
||||
{
|
||||
public:
|
||||
|
|
@ -102,16 +102,16 @@ namespace qp
|
|||
void reset()
|
||||
{
|
||||
for(iterator n = begin(); n != end(); ++n)
|
||||
n->reset();
|
||||
n->reset();
|
||||
}
|
||||
|
||||
vector operator()(const vector& input)
|
||||
{
|
||||
vector output(size());
|
||||
|
||||
|
||||
for(unsigned i = 0; i < output.size(); ++i)
|
||||
output[i] = (*this)[i](input);
|
||||
|
||||
output[i] = (*this)[i](input);
|
||||
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
|
@ -120,10 +120,10 @@ namespace qp
|
|||
//---------------------------------------------------------------------------
|
||||
// net
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class net: public std::vector<layer>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
net(mlp::net& n) //: std::vector<layer>(n.begin(), n.end()) { reset(); }
|
||||
{
|
||||
for (mlp::net::iterator l = n.begin(); l != n.end(); ++l)
|
||||
|
|
@ -135,27 +135,27 @@ namespace qp
|
|||
void reset()
|
||||
{
|
||||
for(iterator l = begin(); l != end(); ++l)
|
||||
l->reset();
|
||||
l->reset();
|
||||
}
|
||||
|
||||
real train(const set& ts,
|
||||
unsigned epochs,
|
||||
real target_error,
|
||||
|
||||
real train(const set& ts,
|
||||
unsigned epochs,
|
||||
real target_error,
|
||||
real tolerance,
|
||||
real eta = eta_default,
|
||||
real momentum = alpha_default,
|
||||
real eta = eta_default,
|
||||
real momentum = alpha_default,
|
||||
real lambda = lambda_default)
|
||||
{
|
||||
real error_ = max_real;
|
||||
|
||||
|
||||
while (epochs-- && error_ > target_error)
|
||||
{
|
||||
real last_error = error_;
|
||||
|
||||
|
||||
init_delta();
|
||||
|
||||
error_ = error(ts);
|
||||
|
||||
|
||||
if (error_ < last_error + tolerance)
|
||||
{
|
||||
coeff_adapt(eta, momentum, lambda);
|
||||
|
|
@ -170,10 +170,10 @@ namespace qp
|
|||
error_ = last_error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return error_;
|
||||
}
|
||||
|
||||
|
||||
virtual real error(const set& ts) = 0;
|
||||
|
||||
// protected:
|
||||
|
|
@ -185,7 +185,7 @@ namespace qp
|
|||
input.swap(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// private:
|
||||
void init_delta()
|
||||
{
|
||||
|
|
@ -193,11 +193,11 @@ namespace qp
|
|||
for (layer::iterator n = l->begin(); n != l->end(); ++n)
|
||||
fill(n->dxo.begin(), n->dxo.end(), n->ndelta = 0.0);
|
||||
}
|
||||
|
||||
|
||||
void coeff_adapt(real& eta, real& momentum, real& lambda)
|
||||
{
|
||||
real me = 0, mw = 0, ew = 0;
|
||||
|
||||
|
||||
for (iterator l = begin(); l != end(); ++l)
|
||||
for (layer::iterator n = l->begin(); n != l->end(); ++n)
|
||||
{
|
||||
|
|
@ -205,7 +205,7 @@ namespace qp
|
|||
mw += n->dweight1 * n->dweight1;
|
||||
ew += n->dxo * n->dweight1;
|
||||
}
|
||||
|
||||
|
||||
me = std::max(static_cast<real>(sqrt(me)), me_floor);
|
||||
mw = std::max(static_cast<real>(sqrt(mw)), mw_floor);
|
||||
eta *= (1.0 + 0.5 * ew / ( me * mw));
|
||||
|
|
@ -213,11 +213,11 @@ namespace qp
|
|||
lambda = lambda0 * me / mw;
|
||||
momentum = eta * lambda;
|
||||
#ifdef DEBUG
|
||||
std::cout << me << " \t" << mw << " \t" << ew << " \t"
|
||||
std::cout << me << " \t" << mw << " \t" << ew << " \t"
|
||||
<< eta << " \t" << momentum << " \t" << lambda << std::endl;
|
||||
#endif // DEBUG
|
||||
}
|
||||
|
||||
|
||||
void weight_update(unsigned size, bool fire, real eta, real momentum)
|
||||
{
|
||||
for (iterator l = begin(); l != end(); ++l)
|
||||
|
|
@ -239,13 +239,13 @@ namespace qp
|
|||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
} // namespace qp
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // qp_h
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
|
|
|
|||
|
|
@ -160,14 +160,14 @@ template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T
|
|||
{
|
||||
std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(os, " "));
|
||||
os << v.back();
|
||||
}
|
||||
}
|
||||
return os << '>';
|
||||
}
|
||||
|
||||
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& v)
|
||||
{
|
||||
v.clear();
|
||||
|
||||
|
||||
char c;
|
||||
is >> c;
|
||||
if (!is || c != '<')
|
||||
|
|
@ -186,7 +186,7 @@ template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& v)
|
|||
}
|
||||
} while (is && c != '>');
|
||||
}
|
||||
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
|
@ -194,11 +194,11 @@ template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& v)
|
|||
// euclidean_distance
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
template<class T> T euclidean_distance(const std::vector<T>& v1,
|
||||
template<class T> T euclidean_distance(const std::vector<T>& v1,
|
||||
const std::vector<T>& v2)
|
||||
{
|
||||
T sum = 0, tmp;
|
||||
|
||||
|
||||
for (unsigned i = 0; i < v1.size(); ++i)
|
||||
{
|
||||
tmp = v1[i] - v2[i];
|
||||
|
|
@ -211,4 +211,3 @@ template<class T> T euclidean_distance(const std::vector<T>& v1,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
|
|||
SET (GPSYMREG_SOURCES main.cpp)
|
||||
|
||||
# no matter what is the OS, hopefully
|
||||
ADD_EXECUTABLE(gpsymreg ${GPSYMREG_SOURCES})
|
||||
|
||||
ADD_EXECUTABLE(gpsymreg ${GPSYMREG_SOURCES})
|
||||
|
||||
ADD_DEPENDENCIES(gpsymreg eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(gpsymreg PROPERTIES VERSION "${GPSYMREG_VERSION}")
|
|||
TARGET_LINK_LIBRARIES(gpsymreg eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||
jeggermo@liacs.nl
|
||||
jeggermo@liacs.nl
|
||||
*/
|
||||
|
||||
#ifndef _FITNESS_FUNCTION_H
|
||||
|
|
@ -225,4 +225,3 @@ class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> >
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||
|
||||
jeggermo@liacs.nl
|
||||
jeggermo@liacs.nl
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -146,25 +146,25 @@ int main(int argc, char *argv[])
|
|||
|
||||
// the parameters are passed on as well
|
||||
|
||||
RegFitness eval(generationCounter, initSequence, parameter);
|
||||
RegFitness eval(generationCounter, initSequence, parameter);
|
||||
|
||||
|
||||
|
||||
// Depth Initializor, set for Ramped Half and Half Initialization
|
||||
|
||||
eoParseTreeDepthInit<FitnessType, Node> initializer(parameter.InitMaxDepth, initSequence, true, true);
|
||||
eoParseTreeDepthInit<FitnessType, Node> initializer(parameter.InitMaxDepth, initSequence, true, true);
|
||||
|
||||
|
||||
|
||||
// create the initial population
|
||||
|
||||
Pop pop(parameter.population_size, initializer);
|
||||
Pop pop(parameter.population_size, initializer);
|
||||
|
||||
|
||||
|
||||
// and evaluate the individuals
|
||||
|
||||
apply<EoType>(eval, pop);
|
||||
apply<EoType>(eval, pop);
|
||||
|
||||
|
||||
|
||||
|
|
@ -335,10 +335,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@
|
|||
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 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 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
|
||||
jeggermo@liacs.nl
|
||||
jeggermo@liacs.nl
|
||||
*/
|
||||
|
||||
#ifndef _NODE_H
|
||||
|
|
@ -33,13 +33,13 @@ using namespace std;
|
|||
/* A new Operation and Node class for even more flexibility.
|
||||
|
||||
Improvements over the t-eoSymreg code are:
|
||||
|
||||
|
||||
* No hardcoded functions or operators. The Operation and Node class below
|
||||
allow you to specify your own unary and binary functions as well as
|
||||
binary operators (like +,-,*,/). Moreover you can detemine if you want
|
||||
to allow primitve subroutines with either one or two arguments.
|
||||
|
||||
If a Node has a subroutine Operation it will take evaluate the first
|
||||
|
||||
If a Node has a subroutine Operation it will take evaluate the first
|
||||
(and possible second) child branch and use them as input variables for
|
||||
the remaining second (or third) child branch.
|
||||
*/
|
||||
|
|
@ -47,20 +47,20 @@ using namespace std;
|
|||
|
||||
typedef enum {Variable, UFunction, BFunction, BOperator, Const} Type;
|
||||
|
||||
typedef double (*BinaryFunction)(const double,const double);
|
||||
typedef double (*BinaryFunction)(const double,const double);
|
||||
typedef double (*UnaryFunction)(const double);
|
||||
|
||||
struct Operation
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
typedef unsigned int VariableID;
|
||||
typedef string Label;
|
||||
|
||||
|
||||
|
||||
// if your compiler allows you to have nameless unions you can make this a
|
||||
// union by removing the //'s below
|
||||
|
||||
|
||||
//union
|
||||
//{
|
||||
UnaryFunction uFunction;
|
||||
|
|
@ -68,34 +68,34 @@ struct Operation
|
|||
VariableID id;
|
||||
double constant;
|
||||
//};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Label label;
|
||||
Type type;
|
||||
|
||||
|
||||
// the default constructor results in a constant with value 0
|
||||
Operation() : constant(0), label("0"), type(Const){};
|
||||
// two possible constructors for Unary Functions
|
||||
Operation(UnaryFunction _uf, Label _label): uFunction(_uf), label(_label), type(UFunction) {};
|
||||
Operation(Label _label, UnaryFunction _uf): uFunction(_uf), label(_label), type(UFunction) {};
|
||||
|
||||
|
||||
// Watch out there are two constructors using pointers two binary functions:
|
||||
// Binary Function (printed as label(subtree0,subtree1) (e.g. pow(x,y))
|
||||
// Binary Operator (printed as (subtree0 label subtree1) (e.g. x^y)
|
||||
// The difference is purely cosmetic.
|
||||
|
||||
|
||||
// If you specify the label before the function pointer -> Binary Function
|
||||
Operation(Label _label, BinaryFunction _bf): bFunction(_bf), label(_label), type(BFunction) {};
|
||||
// If you specify the function pointer before the label -> Binary Operator
|
||||
Operation(BinaryFunction _bf, Label _label): bFunction(_bf), label(_label), type(BOperator) {};
|
||||
|
||||
|
||||
// A constructor for variables
|
||||
Operation(VariableID _id, Label _label): id(_id), label(_label), type(Variable) {};
|
||||
// A constructor for constants
|
||||
Operation(double _constant, Label _label): constant(_constant), label(_label), type(Const) {};
|
||||
|
||||
|
||||
|
||||
|
||||
Operation(const Operation &_op)
|
||||
{
|
||||
switch(_op.type)
|
||||
|
|
@ -110,7 +110,7 @@ struct Operation
|
|||
label = _op.label;
|
||||
};
|
||||
virtual ~Operation(){};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -118,14 +118,14 @@ class Node
|
|||
{
|
||||
private:
|
||||
Operation op;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Node(void): op(Operation()){};
|
||||
Node(Operation &_op) : op(_op){};
|
||||
virtual ~Node(void) {}
|
||||
|
||||
int arity(void) const
|
||||
|
||||
int arity(void) const
|
||||
{
|
||||
switch(op.type)
|
||||
{
|
||||
|
|
@ -134,53 +134,53 @@ class Node
|
|||
case BFunction: return 2;
|
||||
case BOperator: return 2;
|
||||
case Const: return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void randomize(void) {}
|
||||
|
||||
|
||||
template<class Children>
|
||||
void operator()(double& result, Children args, vector<double> &var) const
|
||||
{
|
||||
double result0;
|
||||
double result1;
|
||||
|
||||
|
||||
|
||||
|
||||
switch(op.type)
|
||||
{
|
||||
case Variable: result = var[op.id%var.size()]; //%var.size() used in the case of Subroutines and as a security measure
|
||||
break;
|
||||
case UFunction: args[0].apply(result0, var);
|
||||
result = op.uFunction(result0);
|
||||
result = op.uFunction(result0);
|
||||
break;
|
||||
case BFunction:
|
||||
case BFunction:
|
||||
case BOperator: args[0].apply(result0, var);
|
||||
args[1].apply(result1, var);
|
||||
args[1].apply(result1, var);
|
||||
result = op.bFunction(result0,result1);
|
||||
break;
|
||||
case Const: result = op.constant;
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class Children>
|
||||
void operator()(string& result, Children args) const
|
||||
{
|
||||
|
||||
|
||||
string subtree0;
|
||||
string subtree1;
|
||||
string subtree2;
|
||||
|
||||
|
||||
switch(op.type)
|
||||
{
|
||||
|
||||
case Variable:
|
||||
|
||||
case Variable:
|
||||
case Const: result += op.label;
|
||||
break;
|
||||
|
||||
|
||||
case UFunction: result += op.label;
|
||||
result += "(";
|
||||
args[0].apply(subtree0);
|
||||
|
|
@ -195,7 +195,7 @@ class Node
|
|||
args[1].apply(subtree1);
|
||||
result += subtree1;
|
||||
result += ")";
|
||||
break;
|
||||
break;
|
||||
case BOperator: result += "(";
|
||||
args[0].apply(subtree0);
|
||||
result += subtree0;
|
||||
|
|
@ -204,16 +204,16 @@ class Node
|
|||
result += subtree1;
|
||||
result += ")";
|
||||
break;
|
||||
default: result += "ERROR in Node::operator(string,...) \n"; break;
|
||||
default: result += "ERROR in Node::operator(string,...) \n"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Operation getOp(void) const {return op;}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ class Node
|
|||
std::ostream& operator<<(std::ostream& os, const Node& eot)
|
||||
{
|
||||
Operation op(eot.getOp());
|
||||
|
||||
|
||||
os << (eot.getOp()).label;
|
||||
return os;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@
|
|||
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 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 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
|
||||
jeggermo@liacs.nl
|
||||
jeggermo@liacs.nl
|
||||
*/
|
||||
|
||||
#ifndef _PARAMETERS_FUNCTION_H
|
||||
|
|
@ -28,7 +28,7 @@ using namespace std;
|
|||
|
||||
struct Parameters{
|
||||
unsigned int nGenerations; // -G
|
||||
unsigned population_size; // -P
|
||||
unsigned population_size; // -P
|
||||
unsigned offspring_size; // -O
|
||||
unsigned int MaxSize; // -S
|
||||
unsigned int InitMaxDepth; // -D
|
||||
|
|
@ -41,72 +41,72 @@ struct Parameters{
|
|||
Parameters(int argc, char **argv)
|
||||
{
|
||||
eoParser parser(argc,argv);
|
||||
|
||||
|
||||
// generations
|
||||
eoValueParam<unsigned int> paramGenerations(1, "generations", "Generations", 'G', false);
|
||||
parser.processParam( paramGenerations );
|
||||
nGenerations = paramGenerations.value();
|
||||
cerr << "nGenerations= " << nGenerations << endl;
|
||||
|
||||
|
||||
// populationsize
|
||||
eoValueParam<unsigned int> paramPopulationSize(10, "populationsize", "PopulationSize", 'P', false);
|
||||
parser.processParam( paramPopulationSize );
|
||||
population_size = paramPopulationSize.value();
|
||||
cerr << "population_size= " << population_size << endl;
|
||||
|
||||
|
||||
// offspringsize
|
||||
eoValueParam<unsigned int> paramOffspringSize(population_size, "offspringsize", "OffspringSize", 'O', false);
|
||||
parser.processParam( paramOffspringSize );
|
||||
offspring_size = paramOffspringSize.value();
|
||||
cerr << "offspring_size= " << offspring_size << endl;
|
||||
|
||||
|
||||
// maxsize
|
||||
eoValueParam<unsigned int> paramMaxSize(15, "maxsize", "MaxSize", 'S', false);
|
||||
parser.processParam( paramMaxSize );
|
||||
MaxSize = paramMaxSize.value();
|
||||
cerr << "MaxSize= " << MaxSize << endl;
|
||||
|
||||
|
||||
// initialmaxdepth
|
||||
eoValueParam<unsigned int> paramInitialMaxDepth(4, "initialmaxdepth", "InitialMaxDepth", 'D', false);
|
||||
parser.processParam( paramInitialMaxDepth );
|
||||
InitMaxDepth = paramInitialMaxDepth.value();
|
||||
cerr << "InitMaxDepth= " << InitMaxDepth << endl;
|
||||
|
||||
|
||||
// randomseed
|
||||
eoValueParam<unsigned int> paramRandomSeed(1, "randomseed", "Random Seed", 'R', false);
|
||||
parser.processParam( paramRandomSeed );
|
||||
randomseed = paramRandomSeed.value();
|
||||
cerr << "randomseed= " << randomseed << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
// crossover-rate
|
||||
eoValueParam<double> paramXover(0.75, "crossoverrate", "crossover rate", 'x', false);
|
||||
parser.processParam(paramXover );
|
||||
xover_rate = paramXover.value();
|
||||
cerr << "xover_rate= " << xover_rate << endl;
|
||||
|
||||
|
||||
//mutation-rate
|
||||
eoValueParam<double> paramMutation(0.25, "mutationrate", "mutation rate", 'm', false);
|
||||
parser.processParam(paramMutation );
|
||||
mutation_rate = paramMutation.value();
|
||||
cerr << "mutation_rate= " << mutation_rate << endl;
|
||||
|
||||
|
||||
//tournament size
|
||||
eoValueParam<unsigned int > paramTournamentSize(5, "tournamentsize", "tournament size", 't', false);
|
||||
parser.processParam(paramTournamentSize );
|
||||
tournamentsize = paramTournamentSize.value();
|
||||
cerr << "Tournament Size= " << tournamentsize << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
if (parser.userNeedsHelp())
|
||||
{
|
||||
parser.printHelp(cout);
|
||||
exit(1);
|
||||
parser.printHelp(cout);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
~Parameters(){};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
|
|||
SET (MASTERMIND_SOURCES mastermind.cpp)
|
||||
|
||||
# no matter what is the OS, hopefully
|
||||
ADD_EXECUTABLE(mastermind ${MASTERMIND_SOURCES})
|
||||
|
||||
ADD_EXECUTABLE(mastermind ${MASTERMIND_SOURCES})
|
||||
|
||||
ADD_DEPENDENCIES(mastermind eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(mastermind PROPERTIES VERSION "${MASTERMIND_VERSION}")
|
|||
TARGET_LINK_LIBRARIES(mastermind eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue