New ES routines

This commit is contained in:
mac 2000-06-12 20:09:59 +00:00
commit 4c4ce70c04
17 changed files with 1100 additions and 98 deletions

59
eo/src/es/eoEsBase.h Normal file
View file

@ -0,0 +1,59 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoEsBase.h
// (c) GeNeura Team, 2000 - EEAAX 1999 - Maarten Keijzer 2000
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef _eoEsBase_h
#define _eoEsBase_h
/**
\ingroup EvolutionStrategies
Base class for evolution strategies, just derives from EO and vector and
redirects the operator< to EO (fitness based comparison)
*/
template <class FitT>
class eoEsBase : public EO<FitT>, public std::vector<double>
{
public :
typedef double Type;
/// to avoid conflicts between EO::operator< and vector<double>::operator<
bool operator<(const eoEsBase<FitT>& _eo) const
{
return EO<FitT>::operator<(_eo);
}
};
/// to avoid conflicts between EO::operator< and vector<double>::operator<
template <class FitT>
bool operator<(const eoEsBase<FitT>& _eo1, const eoEsBase<FitT>& _eo2)
{
return _eo1.operator<(_eo2);
}
#endif

134
eo/src/es/eoEsChromInit.h Normal file
View file

@ -0,0 +1,134 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoEsChromInit.h
// (c) Maarten Keijzer 2000, GeNeura Team, 1998 - EEAAX 1999
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef _eoEsChromInit_H
#define _eoEsChromInit_H
#include <es/eoEsObjectiveBounds.h>
#include <es/eoEsSimple.h>
#include <es/eoEsStdev.h>
#include <es/eoEsFull.h>
#include <utils/eoRNG.h>
#include <eoInit.h>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
/**
\ingroup EvolutionStrategies
Random Es-chromosome initializer (therefore derived from eoRnd)
This class can initialize three types of Es's:
eoEsSimple
eoEsStdev
eoEsFull
@see eoEsSimple eoEsStdev eoEsFull eoInit
*/
template <class EOT>
class eoEsChromInit : public eoInit<EOT>
{
public :
typedef typename EOT::Fitness FitT;
eoEsChromInit(eoEsObjectiveBounds& _bounds) : bounds(_bounds)
{}
EOT operator()()
{
return create(EOT());
}
private :
eoEsSimple<FitT>& create(eoEsSimple<FitT>& result)
{
result.resize(bounds.chromSize());
for (unsigned i = 0; i < result.size(); ++i)
{
result[i] = bounds.minimum(i) + rng.uniform(bounds.maximum(i) - bounds.minimum(i));
}
return result;
}
eoEsStdev<FitT> create(eoEsStdev<FitT>& result)
{
unsigned chromSize = bounds.chromSize();
result.resize(chromSize);
result.stdevs.resize(chromSize);
for (unsigned i = 0; i < chromSize; ++i)
{
double length = bounds.maximum(i) - bounds.minimum(i);
result[i] = bounds.minimum(i) + rng.uniform(length);
// Just a guess at the stdevs (anyone a better idea?)
result.stdevs[i] = rng.uniform(length);
}
return result;
}
eoEsFull<FitT> create(eoEsFull<FitT>& result)
{
unsigned chromSize = bounds.chromSize();
result.resize(chromSize);
result.stdevs.resize(chromSize);
unsigned i;
for (i = 0; i < chromSize; ++i)
{
double length = bounds.maximum(i) - bounds.minimum(i);
result[i] = bounds.minimum(i) + rng.uniform(length);
// Just a guess at the stdevs (anyone a better idea?)
result.stdevs[i] = rng.uniform(length);
}
// nb of rotation angles: N*(N-1)/2 (in general!)
result.correlations.resize(chromSize*(chromSize - 1) / 2);
for (i = 0; i < result.correlations.size(); ++i)
{
// And another random guess for random initialization
result.correlations[i] = rng.uniform(2 * M_PI) - M_PI;
}
return result;
}
eoEsObjectiveBounds& bounds;
};
#endif

92
eo/src/es/eoEsFull.h Normal file
View file

@ -0,0 +1,92 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoEsFull.h
// (c) GeNeura Team, 2000 - EEAAX 1999 - Maarten Keijzer 2000
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef _eoEsFull_h
#define _eoEsFull_h
#include <es/eoEsBase.h>
/**
\ingroup EvolutionStrategies
The most complex evolutionary strategy representation. Co-evolving mutation
rates and correlated mutations.
*/
template <class Fit>
class eoEsFull : public eoEsBase<Fit>
{
public :
eoEsFull(void) : eoEsBase<Fit>() {}
std::string className(void) const { return "eoEsFull"; }
void printOn(std::ostream& os) const
{
os << size() << ' ';
std::copy(begin(), end(), std::ostream_iterator<double>(os));
os << ' ';
std::copy(stdevs.begin(), stdevs.end(), std::ostream_iterator<double>(os));
os << ' ';
std::copy(correlations.begin(), correlations.end(), std::ostream_iterator<double>(os));
os << ' ';
}
void readFrom(istream& is)
{
unsigned sz;
is >> sz;
resize(sz);
unsigned i;
for (i = 0; i < sz; ++i)
is >> operator[](i);
stdevs.resize(sz);
for (i = 0; i < sz; ++i)
is >> stdevs[i];
correlations.resize(sz*(sz - 1) / 2);
for (i = 0; i < correlations.size(); ++i)
is >> correlations[i];
}
vector<double> stdevs;
vector<double> correlations;
};
#endif

282
eo/src/es/eoEsMutate.h Normal file
View file

@ -0,0 +1,282 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoESMute.h : ES mutation
// (c) Maarten Keijzer 2000 & GeNeura Team, 1998 for the EO part
// Th. Baeck 1994 and EEAAX 1999 for the ES part
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
marc.schoenauer@polytechnique.fr
http://eeaax.cmap.polytchnique.fr/
*/
//-----------------------------------------------------------------------------
#ifndef _EOESMUTATE_H
#define _EOESMUTATE_H
#include <utils/eoRNG.h>
#include <eoRnd.h>
#include <cmath> // for exp
#include <es/eoEsMutationInit.h>
#include <es/eoEsSimple.h>
#include <es/eoEsStdev.h>
#include <es/eoEsFull.h>
#include <es/eoEsObjectiveBounds.h>
#include <eoOp.h>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
/**
\ingroup EvolutionStrategies
ES-style mutation in the large: Obviously, valid only for eoES*
It is currently valid for three types of ES chromosomes:
eoEsSimple: only 1 std deviation
eoEsStdev: as many standard deviations as object variables
eoEsFull: The whole guacemole: correlations, stdevs and object variables
Each of these three variant has it's own operator() in eoEsMutate and intialization
is also split into three cases (that share some commonalities)
*/
template <class EOT>
class eoEsMutate: public eoMonOp< EOT > {
public:
typedef EOT::Fitness FitT;
/** Initialization
parameters:
@param _init proxy class for initializating the three parameters eoEsMutate needs
@param _bounds the bounds for the objective variables
*/
eoEsMutate(eoEsMutationInit& _init, eoEsObjectiveBounds& _bounds) : bounds(_bounds)
{
init(EOT(), _init); // initialize on actual type used
}
/// needed virtual dtor
virtual ~eoEsMutate() {};
/** Inherited from eoObject
@see eoObject
*/
virtual string className() const {return "eoESMutate";};
/**
Mutate eoEsSimple
*/
virtual void operator()( eoEsSimple<FitT>& _eo) const
{
_eo.stdev *= exp(TauLcl * rng.normal());
if (_eo.stdev < stdev_eps)
_eo.stdev = stdev_eps;
// now apply to all
for (unsigned i = 0; i < _eo.size(); ++i)
{
_eo[i] += _eo.stdev * rng.normal();
}
keepInBounds(_eo);
}
/// mutations - standard and correlated
// =========
/*
* Standard mutation of object variables and standard
* deviations in ESs.
* If there are fewer different standard deviations available
* than the dimension of the objective function requires, the
* last standard deviation is responsible for ALL remaining
* object variables.
* Schwefel 1977: Numerische Optimierung von Computer-Modellen
* mittels der Evolutionsstrategie, pp. 165 ff.
*/
virtual void operator()( eoEsStdev<FitT>& _eo ) const
{
double global = exp(TauGlb * rng.normal());
for (unsigned i = 0; i < _eo.size(); i++)
{
double stdev = _eo.stdevs[i];
stdev *= global * exp(TauLcl * rng.normal());
if (stdev < stdev_eps)
stdev = stdev_eps;
_eo.stdevs[i] = stdev;
_eo[i] += stdev * rng.normal();
}
keepInBounds(_eo);
}
/*
* Correlated mutations in ESs, according to the following
* sources:
* H.-P. Schwefel: Internal Report of KFA Juelich, KFA-STE-IB-3/80
* p. 43, 1980
* G. Rudolph: Globale Optimierung mit parallelen Evolutions-
* strategien, Diploma Thesis, University of Dortmund, 1990
*/
// Code from Thomas Baeck
virtual void operator()( eoEsFull<FitT> & _eo ) const
{
/*
* First: mutate standard deviations (as above).
*/
double global = exp(TauGlb * rng.normal());
for (unsigned i = 0; i < _eo.size(); i++)
{
double stdev = _eo.stdevs[i];
stdev *= global * exp(TauLcl * rng.normal());
if (stdev < stdev_eps)
stdev = stdev_eps;
_eo.stdevs[i] = stdev;
}
/*
* Mutate rotation angles.
*/
for (i = 0; i < _eo.correlations.size(); i++)
{
_eo.correlations[i] += TauBeta * rng.normal();
if ( fabs(_eo.correlations[i]) > M_PI )
{
_eo.correlations[i] -= M_PI * (int) (_eo.correlations[i]/M_PI) ;
}
}
/*
* Perform correlated mutations.
*/
unsigned k, n1, n2;
double d1,d2, S, C;
vector<double> VarStp(_eo.size());
for (i = 0; i < _eo.size(); i++)
VarStp[i] = _eo.stdevs[i] * rng.normal();
unsigned nq = _eo.correlations.size() - 1;
for (k = 0; k < _eo.size()-1; k++)
{
n1 = _eo.size() - k - 1;
n2 = _eo.size() - 1;
for (i = 0; i < k; i++)
{
d1 = VarStp[n1];
d2 = VarStp[n2];
S = sin( _eo.correlations[nq] );
C = cos( _eo.correlations[nq] );
VarStp[n2] = d1 * S + d2 * C;
VarStp[n1] = d1 * C - d2 * S;
n2--;
nq--;
}
}
for (i = 0; i < _eo.size(); i++)
_eo[i] += VarStp[i];
keepInBounds(_eo);
}
void keepInBounds(eoEsBase<FitT>& _eo) const
{
for (unsigned i = 0; i < _eo.size(); ++i)
{
if (_eo[i] < bounds.minimum(i))
_eo[i] = bounds.minimum(i);
else if (_eo[i] > bounds.maximum(i))
_eo[i] = bounds.maximum(i);
}
}
private :
void init(eoEsSimple<FitT>&, eoEsMutationInit& _init)
{
unsigned size = bounds.chromSize();
TauLcl = _init.TauLcl();
TauLcl /= sqrt((double) size);
}
void init(eoEsStdev<FitT>&, eoEsMutationInit& _init)
{
unsigned size = bounds.chromSize();
TauLcl = _init.TauLcl();
TauGlb = _init.TauGlb();
// renormalization
TauLcl /= sqrt( 2.0 * sqrt( (double)size ) );
TauGlb /= sqrt( 2.0 * ( (double) size ) );
}
void init(eoEsFull<FitT>&, eoEsMutationInit& _init)
{
init(eoEsStdev<FitT>(), _init);
TauBeta = _init.TauBeta();
}
// the data
//=========
double TauLcl; /* Local factor for mutation of std deviations */
double TauGlb; /* Global factor for mutation of std deviations */
double TauBeta; /* Factor for mutation of correlation parameters */
eoEsObjectiveBounds& bounds;
static const double stdev_eps;
};
template <class EOT>
const double eoEsMutate<EOT>::stdev_eps = 1.0e-40;
/*
* Correlated mutations in ESs, according to the following
* sources:
* H.-P. Schwefel: Internal Report of KFA Juelich, KFA-STE-IB-3/80
* p. 43, 1980
* G. Rudolph: Globale Optimierung mit parallelen Evolutions-
* strategien, Diploma Thesis, University of Dortmund, 1990
*/
#endif

View file

@ -0,0 +1,105 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoEsMutationInit.h
// (c) GeNeura Team, 1998 - EEAAX 1999 - Maarten Keijzer 2000
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef _eoEsInit_h
#define _eoEsInit_h
#include <utils/eoParser.h>
/**
\ingroup EvolutionStrategies
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.
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 :
eoEsMutationInit(eoParameterLoader& _parser) : parser(_parser), TauLclParam(0), TauGlbParam(0), TauBetaParam(0) {}
double TauLcl(void)
{
if (TauLclParam == 0)
{
TauLclParam = &parser.createParam(1.0, TauLclName(), "Local Tau", TauLclShort(), section());
}
return TauLclParam->value();
}
double TauGlb(void)
{
if (TauGlbParam == 0)
{
TauGlbParam = &parser.createParam(1.0, TauGlbName(), "Global Tau", TauGlbShort(), section());
}
return TauGlbParam->value();
}
double TauBeta(void)
{
if (TauBetaParam == 0)
{
TauBetaParam = &parser.createParam(0.0873, TauBetaName(), "Beta", TauBetaShort(), section());
}
return TauBetaParam->value();
}
protected :
virtual std::string section(void)
{ return "Parameters of ES mutation (before renormalization)"; }
virtual std::string TauLclName(void) const { return "TauLcL"; }
virtual char TauLclShort(void) const { return 'l'; }
virtual std::string TauGlbName(void) const { return "TauGlb"; }
virtual char TauGlbShort(void) const { return 'g'; }
virtual std::string TauBetaName(void) const { return "Beta"; }
virtual char TauBetaShort(void) const { return 'b'; }
private :
eoParameterLoader& parser;
eoValueParam<double>* TauLclParam;
eoValueParam<double>* TauGlbParam;
eoValueParam<double>* TauBetaParam;
};
#endif

View file

@ -0,0 +1,81 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoEsObjectiveBounds.h
// (c) Maarten Keijzer 2000, GeNeura Team, 1998 - EEAAX 1999
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef _eoEsObjectiveBounds_h
#define _eoEsObjectiveBounds_h
/**
\defgroup EvolutionStrategies
Various classes for the initialization and mutation of real valued vectors.
Supports simple mutations and various more adaptable mutations, including
correlated mutations.
*/
/**
\class eoEsObjectiveBounds eoEsObjectiveBounds.h es/eoEsObjectiveBounds.h
\ingroup EvolutionStrategies
Defines the minima and maxima of the object variables. Needed by eoEsChromInit
and eoEsMutate
@see eoEsChromInit eoEsMutate
*/
class eoEsObjectiveBounds
{
public :
/**
Objective bounds for a global minimum and maximum
*/
eoEsObjectiveBounds(int _nGenes, double _min, double _max) : repMinimum(_nGenes), repMaximum(_nGenes)
{
std::fill(repMinimum.begin(), repMinimum.end(), _min);
std::fill(repMaximum.begin(), repMaximum.end(), _max);
}
/**
Objective bounds for a per gene minimum and maximum
*/
eoEsObjectiveBounds(const std::vector<double>& _min, const std::vector<double>& _max)
: repMinimum(_min), repMaximum(_max) {}
typedef double doubleype;
double minimum(size_t i) { return repMinimum[i]; }
double maximum(size_t i) { return repMaximum[i]; }
unsigned chromSize(void) const { return repMinimum.size(); }
private :
std::vector<double> repMinimum;
std::vector<double> repMaximum;
};
#endif

81
eo/src/es/eoEsSimple.h Normal file
View file

@ -0,0 +1,81 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoEsSimple.h
// (c) GeNeura Team, 2000 - EEAAX 1999, Maarten Keijzer 2000
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef _eoEsSimple_h
#define _eoEsSimple_h
#include <EO.h>
#include <vector>
#include <es/eoEsBase.h>
/**
\ingroup EvolutionStrategies
One of the more simple evolution strategies, sporting just a single
stdeviation for the entire chromosome. For more advanced versions
see also eoEsStdev eoEsFull
@see eoEsStdev eoEsFull
*/
template <class Fit>
class eoEsSimple : public eoEsBase<Fit>
{
public :
eoEsSimple(void) : eoEsBase<Fit>() {}
std::string className(void) const { return "eoEsSimple"; }
void printOn(ostream& os) const
{
os << size() << ' ';
std::copy(begin(), end(), ostream_iterator<double>(os));
os << ' ' << stdev << ' ';
}
void readFrom(istream& is)
{
unsigned sz;
is >> sz;
resize(sz);
unsigned i;
for (i = 0; i < sz; ++i)
is >> operator[](i);
is >> stdev;
}
double stdev;
};
#endif

81
eo/src/es/eoEsStdev.h Normal file
View file

@ -0,0 +1,81 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoEsStdev.h
// (c) GeNeura Team, 2000 - EEAAX 1999 - Maarten Keijzer 2000
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef _eoEsStdev_h
#define _eoEsStdev_h
#include <es/eoEsBase.h>
/**
\ingroup EvolutionStrategies
Evolutionary strategie style representation, supporting co-evolving standard
deviations.
*/
template <class Fit>
class eoEsStdev : public eoEsBase<Fit>
{
public :
eoEsStdev(void) : eoEsBase<Fit>() {}
std::string className(void) const { return "eoEsStdev"; }
void printOn(std::ostream& os) const
{
os << size() << ' ';
std::copy(begin(), end(), std::ostream_iterator<double>(os));
os << ' ';
std::copy(stdevs.begin(), stdevs.end(), std::ostream_iterator<double>(os));
os << ' ';
}
void readFrom(istream& is)
{
unsigned sz;
is >> sz;
resize(sz);
unsigned i;
for (i = 0; i < sz; ++i)
is >> operator[](i);
stdevs.resize(sz);
for (i = 0; i < sz; ++i)
is >> stdevs[i];
}
vector<double> stdevs;
};
#endif

View file

@ -0,0 +1,15 @@
#ifndef _eoEs_h
#define _eoEs_h
#include <es/eoEsObjectiveBounds.h>
#include <es/eoEsSimple.h>
#include <es/eoEsStdev.h>
#include <es/eoEsFull.h>
#include <es/eoEsChromInit.h>
#include <es/eoEsMutationInit.h>
#include <es/eoEsMutate.h>
#endif