Simplify configuration.

Remove support for (outdated) <strstream>, require <sstream>.
Require uint32_t for now, defined in stdint.h according to C99.
Some general cleanup and more documentation.
This commit is contained in:
kuepper 2005-09-28 21:49:26 +00:00
commit cf2a57dd88
46 changed files with 482 additions and 886 deletions

View file

@ -1,4 +1,4 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; fill-column: 80 -*-
//-----------------------------------------------------------------------------
// eoEsMutationInit.h
@ -24,37 +24,48 @@
*/
//-----------------------------------------------------------------------------
#ifndef _eoEsInit_h
#define _eoEsInit_h
#ifndef _eoEsMutationInit_h
#define _eoEsMutationInit_h
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <utils/eoParser.h>
/**
\ingroup EvolutionStrategies
/** Initialize Mutation operator
eoESMutationInit. Proxy class that is used for initializing the mutation
operator. It provides an interface between eoEsMutate and the abstract
parameterLoader. It also provides the names for the parameters in this
class as virtual protected member functions.
@ingroup EvolutionStrategies
If you have more than a single ES in a project that need different
names in the configuration files, you might consider overriding this class
to change the names.
Proxy class that is used for initializing the mutation operator. It provides an
interface between eoEsMutate and the abstract parameterLoader. It also provides
the names for the parameters in this class as virtual protected member
functions.
@see eoEsMutate
If you have more than a single ES in a project that need different names in the
configuration files, you might consider overriding this class to change the
names.
@see eoEsMutate
*/
class eoEsMutationInit
{
public :
public :
/** Constructor
@param _parser Parser to read parameters from.
@param _section Parser section for \tau-parameters.
*/
eoEsMutationInit(eoParser& _parser,
std::string _section="ES mutation parameters" ) :
parser(_parser), repSection(_section),
TauLclParam(0), TauGlbParam(0), TauBetaParam(0) {}
parser(_parser), repSection(_section),
TauLclParam(0), TauGlbParam(0), TauBetaParam(0) {}
// because we have virtual function - size
virtual ~eoEsMutationInit(){}
/** Virtual destructor */
virtual ~eoEsMutationInit() {}
/** local \tau */
double TauLcl(void)
{
if (TauLclParam == 0)
@ -63,10 +74,10 @@ class eoEsMutationInit
"Local Tau (before normalization)",
TauLclShort(), section());
}
return TauLclParam->value();
}
/** global tau */
double TauGlb(void)
{
if (TauGlbParam == 0)
@ -75,10 +86,10 @@ class eoEsMutationInit
"Global Tau (before normalization)",
TauGlbShort(), section());
}
return TauGlbParam->value();
}
/** correlation's tau */
double TauBeta(void)
{
if (TauBetaParam == 0)
@ -86,14 +97,12 @@ class eoEsMutationInit
TauBetaParam = &parser.getORcreateParam(0.0873, TauBetaName(),
"Beta", TauBetaShort(), section());
}
return TauBetaParam->value();
}
protected :
virtual std::string section(void)
{ return repSection; }
virtual std::string section(void) { return repSection; }
virtual std::string TauLclName(void) const { return "TauLoc"; }
virtual char TauLclShort(void) const { return 'l'; }
@ -104,13 +113,13 @@ class eoEsMutationInit
virtual std::string TauBetaName(void) const { return "Beta"; }
virtual char TauBetaShort(void) const { return 'b'; }
private :
private:
eoParser& parser;
std::string repSection;
eoValueParam<double>* TauLclParam;
eoValueParam<double>* TauGlbParam;
eoValueParam<double>* TauBetaParam;
eoParser& parser;
std::string repSection;
eoValueParam<double>* TauLclParam;
eoValueParam<double>* TauGlbParam;
eoValueParam<double>* TauBetaParam;
};
#endif

View file

@ -27,23 +27,13 @@
#ifndef _make_genotype_h
#define _make_genotype_h
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_SSTREAM
#include <sstream>
#else
#include <strstream>
#endif
#include <iostream>
#include <sstream>
#include "es/eoReal.h"
#include "es/eoEsChromInit.h"
#include "utils/eoRealVectorBounds.h"
// also need the parser and param includes
#include "utils/eoParser.h"
#include "utils/eoRealVectorBounds.h"
#include "utils/eoState.h"
@ -102,11 +92,7 @@ eoEsChromInit<EOT> & do_make_genotype(eoParser& _parser, eoState& _state, EOT)
to_scale = true;
sigmaString.resize(pos);
}
#ifdef HAVE_SSTREAM
std::istringstream is(sigmaString);
#else
std::istrstream is(sigmaString.c_str());
#endif
double sigma;
is >> sigma;
// minimum check