cleanup, prepare vecSigmaInit change

This commit is contained in:
kuepper 2005-10-10 21:42:31 +00:00
commit 4510b6d712
4 changed files with 126 additions and 118 deletions

View file

@ -4,7 +4,7 @@
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.
- Provide full automake/autoconf/configure support.

View file

@ -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
//-----------------------------------------------------------------------------
// eoParser.h
// (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 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 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.
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
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
Contact: http://eodev.sourceforge.net
todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
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 <sstream>
@ -37,10 +31,11 @@ CVS Info: $Date: 2005-09-28 21:49:26 $ $Version$ $Author: kuepper $
#include "eoObject.h"
#include "eoPersistent.h"
/**
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
this class.
/** 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
this class.
*/
class eoParameterLoader
{
@ -49,11 +44,10 @@ public :
/** Need a virtual destructor */
virtual ~eoParameterLoader();
/**
* processParam is used to register a parameter and set its value if it is known
*
* @param param the parameter to process
* @param section the section where this parameter belongs
/** Register a parameter and set its value if it is known
@param param the parameter to process
@param section the section where this parameter belongs
*/
virtual void processParam(eoParam& param, std::string section = "") = 0;
@ -147,8 +141,9 @@ public:
std::string ProgramName() { return programName; }
/**
* checks if _param has been actually entered by the user
/** Has param been entered by user?
Checks if _param has been actually entered by the user
*/
virtual bool isItThere(eoParam& _param) const
{ 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:

View file

@ -54,6 +54,9 @@ EXTRA_DIST = run_tests
# extra flags for specific targets
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,
# otherwise automake/make looks for C sources
@ -63,11 +66,8 @@ t_eofitness_SOURCES = t-eofitness.cpp
t_eoFitnessAssembledEA_SOURCES = t-eoFitnessAssembledEA.cpp
t_eobin_SOURCES = t-eobin.cpp
t_eoVirus_SOURCES = t-eoVirus.cpp
t_MGE1bit_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
t_MGE1bit_SOURCES = t-MGE1bit.cpp
t_MGE_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
t_MGE_SOURCES = t-MGE.cpp
t_MGE_control_CXXFLAGS = -I$(top_srcdir)/contrib/MGE
t_MGE_control_SOURCES = t-MGE-control.cpp
t_eoStateAndParser_SOURCES = t-eoStateAndParser.cpp
t_eoCheckpointing_SOURCES = t-eoCheckpointing.cpp

View file

@ -35,14 +35,16 @@ int main_function(int argc, char *argv[])
{
// Create the command-line parser
eoParser parser(argc, argv); // for user-parameter reading
eoState state; // keeps all things allocated
eoValueParam<bool>& simpleParam = parser.createParam(true, "Isotropic", "Isotropic self-adaptive mutation", 'i', "ES mutation");
eoValueParam<bool>& stdevsParam = parser.createParam(false, "Stdev", "One self-adaptive stDev per variable", 's', "ES mutation");
eoValueParam<bool>& corrParam = parser.createParam(false, "Correl", "Use correlated mutations", 'c', "ES mutation");
eoValueParam<bool>& simpleParam = parser.getORcreateParam(true, "Isotropic",
"Isotropic self-adaptive mutation",
'i', "ES mutation");
eoValueParam<bool>& stdevsParam = parser.getORcreateParam(false, "Stdev",
"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
if (simpleParam.value() == false)
{
@ -64,12 +66,12 @@ int main_function(int argc, char *argv[])
std::cout << "Using eoEsFull" << std::endl;
runAlgorithm(eoEsFull<FitT>(), parser, state);
}
return 0;
}
// A main that catches the exceptions
// A main that catches the exceptions
int main(int argc, char **argv)
{
#ifdef _MSC_VER
@ -77,9 +79,8 @@ int main(int argc, char **argv)
int flag = _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
flag |= _CRTDBG_LEAK_CHECK_DF;
_CrtSetDbgFlag(flag);
// _CrtSetBreakAlloc(100);
// _CrtSetBreakAlloc(100);
#endif
try
{
main_function(argc, argv);
@ -88,13 +89,15 @@ int main(int argc, char **argv)
{
std::cout << "Exception: " << e.what() << '\n';
}
}
/** 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>
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
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
mainEval( real_value );
eoEvalFuncPtr<EOT, double, const std::vector<double>&> mainEval( real_value );
eoEvalFuncCounter<EOT> eval(mainEval);
// the genotype - through a genotype initializer