cleanup, prepare vecSigmaInit change
This commit is contained in:
parent
e9324fdb07
commit
4510b6d712
4 changed files with 126 additions and 118 deletions
2
eo/NEWS
2
eo/NEWS
|
|
@ -4,7 +4,7 @@
|
||||||
clean up the code considerably. Assume availability of sstream and limits.
|
clean up the code considerably. Assume availability of sstream and limits.
|
||||||
|
|
||||||
|
|
||||||
* releases 0.9.3... (latest release is 0.9.3zz, 1. Oct. 2005)
|
* release 0.9.3z.1 (1. Oct. 2005)
|
||||||
- Support gcc-3.4 and gcc.4.x.
|
- Support gcc-3.4 and gcc.4.x.
|
||||||
- Provide full automake/autoconf/configure support.
|
- Provide full automake/autoconf/configure support.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,27 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
/* (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2000
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
This library is free software; you can redistribute it and/or modify it under
|
||||||
// eoParser.h
|
the terms of the GNU Lesser General Public License as published by the Free
|
||||||
// (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2000
|
Software Foundation; either version 2 of the License, or (at your option) any
|
||||||
/*
|
later version.
|
||||||
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,
|
This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License along
|
||||||
License along with this library; if not, write to the Free Software
|
with this library; if not, write to the Free Software Foundation, Inc., 59
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: http://eodev.sourceforge.net
|
||||||
|
todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
Marc.Schoenauer@polytechnique.fr
|
Marc.Schoenauer@polytechnique.fr
|
||||||
mkeijzer@dhi.dk
|
mkeijzer@dhi.dk
|
||||||
*/
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
CVS Info: $Date: 2005-09-28 21:49:26 $ $Version$ $Author: kuepper $
|
|
||||||
*/
|
*/
|
||||||
#ifndef eoParser_h
|
|
||||||
#define eoParser_h
|
|
||||||
|
#ifndef EO_PARSER_H
|
||||||
|
#define EO_PARSER_H
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
@ -37,10 +31,11 @@ CVS Info: $Date: 2005-09-28 21:49:26 $ $Version$ $Author: kuepper $
|
||||||
#include "eoObject.h"
|
#include "eoObject.h"
|
||||||
#include "eoPersistent.h"
|
#include "eoPersistent.h"
|
||||||
|
|
||||||
/**
|
/** Parameter saving and loading
|
||||||
eoParameterLoader is an abstract class that can be used as a base for your own
|
|
||||||
parameter loading and saving. The command line parser eoParser is derived from
|
eoParameterLoader is an abstract class that can be used as a base for your own
|
||||||
this class.
|
parameter loading and saving. The command line parser eoParser is derived from
|
||||||
|
this class.
|
||||||
*/
|
*/
|
||||||
class eoParameterLoader
|
class eoParameterLoader
|
||||||
{
|
{
|
||||||
|
|
@ -49,11 +44,10 @@ public :
|
||||||
/** Need a virtual destructor */
|
/** Need a virtual destructor */
|
||||||
virtual ~eoParameterLoader();
|
virtual ~eoParameterLoader();
|
||||||
|
|
||||||
/**
|
/** Register a parameter and set its value if it is known
|
||||||
* processParam is used to register a parameter and set its value if it is known
|
|
||||||
*
|
@param param the parameter to process
|
||||||
* @param param the parameter to process
|
@param section the section where this parameter belongs
|
||||||
* @param section the section where this parameter belongs
|
|
||||||
*/
|
*/
|
||||||
virtual void processParam(eoParam& param, std::string section = "") = 0;
|
virtual void processParam(eoParam& param, std::string section = "") = 0;
|
||||||
|
|
||||||
|
|
@ -147,8 +141,9 @@ public:
|
||||||
|
|
||||||
std::string ProgramName() { return programName; }
|
std::string ProgramName() { return programName; }
|
||||||
|
|
||||||
/**
|
/** Has param been entered by user?
|
||||||
* checks if _param has been actually entered by the user
|
|
||||||
|
Checks if _param has been actually entered by the user
|
||||||
*/
|
*/
|
||||||
virtual bool isItThere(eoParam& _param) const
|
virtual bool isItThere(eoParam& _param) const
|
||||||
{ return getValue(_param).first; }
|
{ return getValue(_param).first; }
|
||||||
|
|
@ -278,4 +273,15 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
#endif // EO_PARSER_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// coding: iso-8859-1
|
||||||
|
// mode:C++
|
||||||
|
// c-file-style: "Stroustrup"
|
||||||
|
// comment-column: 35
|
||||||
|
// fill-column: 80
|
||||||
|
// End:
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@ EXTRA_DIST = run_tests
|
||||||
|
|
||||||
# extra flags for specific targets
|
# extra flags for specific targets
|
||||||
t_eoVirus_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/contrib
|
t_eoVirus_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/contrib
|
||||||
|
t_MGE_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
|
||||||
|
t_MGE1bit_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
|
||||||
|
t_MGE_control_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
|
||||||
|
|
||||||
# Specify source-files,
|
# Specify source-files,
|
||||||
# otherwise automake/make looks for C sources
|
# otherwise automake/make looks for C sources
|
||||||
|
|
@ -63,11 +66,8 @@ t_eofitness_SOURCES = t-eofitness.cpp
|
||||||
t_eoFitnessAssembledEA_SOURCES = t-eoFitnessAssembledEA.cpp
|
t_eoFitnessAssembledEA_SOURCES = t-eoFitnessAssembledEA.cpp
|
||||||
t_eobin_SOURCES = t-eobin.cpp
|
t_eobin_SOURCES = t-eobin.cpp
|
||||||
t_eoVirus_SOURCES = t-eoVirus.cpp
|
t_eoVirus_SOURCES = t-eoVirus.cpp
|
||||||
t_MGE1bit_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
|
|
||||||
t_MGE1bit_SOURCES = t-MGE1bit.cpp
|
t_MGE1bit_SOURCES = t-MGE1bit.cpp
|
||||||
t_MGE_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
|
|
||||||
t_MGE_SOURCES = t-MGE.cpp
|
t_MGE_SOURCES = t-MGE.cpp
|
||||||
t_MGE_control_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
|
|
||||||
t_MGE_control_SOURCES = t-MGE-control.cpp
|
t_MGE_control_SOURCES = t-MGE-control.cpp
|
||||||
t_eoStateAndParser_SOURCES = t-eoStateAndParser.cpp
|
t_eoStateAndParser_SOURCES = t-eoStateAndParser.cpp
|
||||||
t_eoCheckpointing_SOURCES = t-eoCheckpointing.cpp
|
t_eoCheckpointing_SOURCES = t-eoCheckpointing.cpp
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,16 @@ int main_function(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Create the command-line parser
|
// Create the command-line parser
|
||||||
eoParser parser(argc, argv); // for user-parameter reading
|
eoParser parser(argc, argv); // for user-parameter reading
|
||||||
|
|
||||||
eoState state; // keeps all things allocated
|
eoState state; // keeps all things allocated
|
||||||
|
eoValueParam<bool>& simpleParam = parser.getORcreateParam(true, "Isotropic",
|
||||||
|
"Isotropic self-adaptive mutation",
|
||||||
eoValueParam<bool>& simpleParam = parser.createParam(true, "Isotropic", "Isotropic self-adaptive mutation", 'i', "ES mutation");
|
'i', "ES mutation");
|
||||||
eoValueParam<bool>& stdevsParam = parser.createParam(false, "Stdev", "One self-adaptive stDev per variable", 's', "ES mutation");
|
eoValueParam<bool>& stdevsParam = parser.getORcreateParam(false, "Stdev",
|
||||||
eoValueParam<bool>& corrParam = parser.createParam(false, "Correl", "Use correlated mutations", 'c', "ES mutation");
|
"One self-adaptive stDev per variable",
|
||||||
|
's', "ES mutation");
|
||||||
|
eoValueParam<bool>& corrParam = parser.getORcreateParam(false, "Correl",
|
||||||
|
"Use correlated mutations",
|
||||||
|
'c', "ES mutation");
|
||||||
// Run the appropriate algorithm
|
// Run the appropriate algorithm
|
||||||
if (simpleParam.value() == false)
|
if (simpleParam.value() == false)
|
||||||
{
|
{
|
||||||
|
|
@ -64,12 +66,12 @@ int main_function(int argc, char *argv[])
|
||||||
std::cout << "Using eoEsFull" << std::endl;
|
std::cout << "Using eoEsFull" << std::endl;
|
||||||
runAlgorithm(eoEsFull<FitT>(), parser, state);
|
runAlgorithm(eoEsFull<FitT>(), parser, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A main that catches the exceptions
|
|
||||||
|
|
||||||
|
|
||||||
|
// A main that catches the exceptions
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
@ -77,9 +79,8 @@ int main(int argc, char **argv)
|
||||||
int flag = _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
|
int flag = _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
|
||||||
flag |= _CRTDBG_LEAK_CHECK_DF;
|
flag |= _CRTDBG_LEAK_CHECK_DF;
|
||||||
_CrtSetDbgFlag(flag);
|
_CrtSetDbgFlag(flag);
|
||||||
// _CrtSetBreakAlloc(100);
|
// _CrtSetBreakAlloc(100);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
|
|
@ -88,13 +89,15 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << '\n';
|
std::cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** The templatized main (sort of)
|
/** The templatized main (sort of)
|
||||||
* quite similar to the main of other genotypes
|
|
||||||
* (e.g. t-eoReal and t-eoGA in test dir)
|
quite similar to the main of other genotypes (e.g. t-eoReal and t-eoGA
|
||||||
*/
|
in test dir)
|
||||||
|
*/
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
void runAlgorithm(EOT, eoParser& _parser, eoState& _state)
|
void runAlgorithm(EOT, eoParser& _parser, eoState& _state)
|
||||||
{
|
{
|
||||||
|
|
@ -104,8 +107,7 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state)
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
|
|
||||||
// The evaluation fn - encapsulated into an eval counter for output
|
// The evaluation fn - encapsulated into an eval counter for output
|
||||||
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
|
eoEvalFuncPtr<EOT, double, const std::vector<double>&> mainEval( real_value );
|
||||||
mainEval( real_value );
|
|
||||||
eoEvalFuncCounter<EOT> eval(mainEval);
|
eoEvalFuncCounter<EOT> eval(mainEval);
|
||||||
|
|
||||||
// the genotype - through a genotype initializer
|
// the genotype - through a genotype initializer
|
||||||
|
|
|
||||||
Reference in a new issue