Added Marc's ES files and .dsp files for others
This commit is contained in:
parent
0d8648c0e6
commit
449ed17ff8
71 changed files with 6359 additions and 4825 deletions
|
|
@ -5,3 +5,8 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
SUBDIRS = src test
|
SUBDIRS = src test
|
||||||
|
DOCDIR = ~/public_html/eodocs
|
||||||
|
|
||||||
|
docs:
|
||||||
|
doc++ -d $(DOCDIR) -B foot.html -f src/*.h src/*.cpp
|
||||||
|
/home/jmerelo/bin/index -e html -i /home/jmerelo/index/neweo.idx /home/jmerelo/public_html/eodocs/ -v 3
|
||||||
|
|
@ -8,5 +8,16 @@ lib_LIBRARIES = libeo.a
|
||||||
libeo_a_SOURCES = eoPrintable.cpp eoPersistent.cpp
|
libeo_a_SOURCES = eoPrintable.cpp eoPersistent.cpp
|
||||||
|
|
||||||
libeoincdir = $(includedir)/eo
|
libeoincdir = $(includedir)/eo
|
||||||
libeoinc_HEADERS = eo EO.h eoDup.h eoMultiMonOp.h eoPop.h eoUniform.h eoESChrom.h eoNegExp.h eoProblem.h eoVector.h eoFitness.h eoNormal.h eoRnd.h eoXOver2.h eo1d.h eoID.h eoObject.h eoString.h eoAged.h eoKill.h eoOp.h eoTranspose.h eoBin.h eoPrintable.h eoPersistent.h eoLottery.h eoMutation.h eoPopOps.h eoUniform.h eoInsertion.h eoInclusion.h eoBitOp.h eoBitOpFactory.h eo2d.h eo2dVector.h eoData.h eoProportionalOpSel.h eoOpSelector.h eoBreeder.h eoEvalFunc.h eoEvalFuncPtr.h eoEvaluator.h eoTerm.h eoGenTerm.h eoFitTerm.h eoGeneration.h eoAlgo.h eoEasyEA.h eoNonUniform.h eoRNG.h eoParser.h
|
libeoinc_HEADERS = EO.h eo eo1d.h eo2d.h eo2dVector.h eoAged.h eoAlgo.h\
|
||||||
|
eoAtomBitFlip.h eoAtomCreep.h eoAtomMutation.h eoAtomMutator.h \
|
||||||
|
eoAtomRandom.h eoBin.h eoBitOp.h eoBitOpFactory.h eoBreeder.h\
|
||||||
|
eoData.h eoDup.h eoESChrom.h eoESFullChrom.h eoESFullMut.h eoEasyEA.h\
|
||||||
|
eoEvalFunc.h eoEvalFuncPtr.h eoEvaluator.h eoFitTerm.h eoFitness.h\
|
||||||
|
eoGenTerm.h eoGeneration.h eoID.h eoInclusion.h eoInsertion.h\
|
||||||
|
eoKill.h eoLottery.h eoMultiMonOp.h eoMutation.h eoNegExp.h\
|
||||||
|
eoNonUniform.h eoNormal.h eoObject.h eoOp.h eoOpSelector.h\
|
||||||
|
eoParser.h eoPersistent.h eoPop.h eoPopOps.h eoPrintable.h\
|
||||||
|
eoProblem.h eoProportionalOpSel.h eoRNG.h eoRnd.h eoString.h\
|
||||||
|
eoTerm.h eoTranspose.h eoUniform.h eoVector.h eoXOver2.h
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
57
eo/src/eoAtomBitFlip.h
Normal file
57
eo/src/eoAtomBitFlip.h
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// eoAtomCreep.h
|
||||||
|
// Increments or decrements by one a single element
|
||||||
|
// (c) GeNeura Team, 1998
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#ifndef _EOATOMCREEP_H
|
||||||
|
#define _EOATOMCREEP_H
|
||||||
|
|
||||||
|
/** Flips a single bit
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
class eoAtomBitFlip: public eoAtomMutator<bool> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
///
|
||||||
|
eoAtomBitFlip() {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual ~eoAtomBitFlip() {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual void operator()( T& _val ) const {
|
||||||
|
_val = !val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @name Methods from eoObject
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
/** Inherited from eoObject
|
||||||
|
@see eoObject
|
||||||
|
*/
|
||||||
|
string className() const {return "eoAtomBitFlip";};
|
||||||
|
//@}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
65
eo/src/eoAtomCreep.h
Normal file
65
eo/src/eoAtomCreep.h
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// eoAtomCreep.h
|
||||||
|
// Increments or decrements by one a single element
|
||||||
|
// (c) GeNeura Team, 1998
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#ifndef _EOATOMCREEP_H
|
||||||
|
#define _EOATOMCREEP_H
|
||||||
|
|
||||||
|
#include <eoRNG.h>
|
||||||
|
#include <eoAtomMutator.h>
|
||||||
|
|
||||||
|
/** With uniform probability, decrements or increments by one the value.
|
||||||
|
The value type must admit post increment and decrement.
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
class eoAtomCreep: public eoAtomMutator<T> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
///
|
||||||
|
eoAtomCreep() {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual ~eoAtomCreep() {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual void operator()( T& _val ) const {
|
||||||
|
if ( rng.flip( 0.5 ) ) {
|
||||||
|
_val++;
|
||||||
|
} else {
|
||||||
|
_val--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @name Methods from eoObject
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
/** Inherited from eoObject
|
||||||
|
@see eoObject
|
||||||
|
*/
|
||||||
|
virtual string className() const {return "eoAtomCreep";};
|
||||||
|
//@}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
95
eo/src/eoAtomMutation.h
Normal file
95
eo/src/eoAtomMutation.h
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// eoAtomMutation.h
|
||||||
|
// (c) GeNeura Team, 1998
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#ifndef _EOATOMMUTATION_H
|
||||||
|
#define _EOATOMMUTATION_H
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
|
// EO includes
|
||||||
|
#include <eoOp.h>
|
||||||
|
#include <eoUniform.h>
|
||||||
|
#include <eoRNG.h>
|
||||||
|
#include <eoAtomMutator.h>
|
||||||
|
|
||||||
|
/** Atomic mutation of an EO. Acts on containers, and applies a mutation
|
||||||
|
operator to each element of the container with some probability. EOT must
|
||||||
|
be a container of any tipe
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class eoAtomMutation: public eoMonOp<EOT> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
typedef EOT::Type Type;
|
||||||
|
#else
|
||||||
|
typedef typename EOT::Type Type;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///
|
||||||
|
eoAtomMutation(const eoAtomMutator<Type>& _atomMut, const double _rate=0.0)
|
||||||
|
: eoMonOp< EOT >(), rate(_rate), atomMutator( _atomMut ) {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual ~eoAtomMutation() {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual void operator()( EOT& _eo ) const {
|
||||||
|
typename EOT::iterator i;
|
||||||
|
for ( i = _eo.begin(); i != _eo.end(); i ++ )
|
||||||
|
if ( rng.flip( rate ) ) {
|
||||||
|
atomMutator( *i );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** To print me on a stream.
|
||||||
|
@param os The ostream.
|
||||||
|
*/
|
||||||
|
void printOn(ostream& os) const {
|
||||||
|
os << rate ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** To read me from a stream.
|
||||||
|
@param is The istream */
|
||||||
|
void readFrom(istream& is) {
|
||||||
|
is >> rate ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @name Methods from eoObject
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
/** Inherited from eoObject
|
||||||
|
@see eoObject
|
||||||
|
*/
|
||||||
|
string className() const {return "eoMutation";};
|
||||||
|
//@}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
double rate;
|
||||||
|
const eoAtomMutator<Type>& atomMutator;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
61
eo/src/eoAtomMutator.h
Normal file
61
eo/src/eoAtomMutator.h
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// eoAtomMutator.h
|
||||||
|
// (c) GeNeura Team, 1998
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#ifndef _EOATOMMUTATOR_H
|
||||||
|
#define _EOATOMMUTATOR_H
|
||||||
|
|
||||||
|
/** Abstract base class for functors that modify a single element in an EO
|
||||||
|
that is composed of several atomic components. An atom would, for instance, flip
|
||||||
|
a bit, or change a real number, or things like that.
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
class eoAtomMutator: public eoPrintable {
|
||||||
|
public:
|
||||||
|
|
||||||
|
///
|
||||||
|
eoAtomMutator() {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual ~eoAtomMutator() {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual void operator()( T& _val ) const = 0;
|
||||||
|
|
||||||
|
/** @name Methods from eoObject
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
/** Inherited from eoObject
|
||||||
|
@see eoObject
|
||||||
|
*/
|
||||||
|
///
|
||||||
|
virtual string className() const {return "eoAtomMutator";};
|
||||||
|
|
||||||
|
///
|
||||||
|
void printOn(ostream& _os) const { _os << className() << endl; };
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
63
eo/src/eoAtomRandom.h
Normal file
63
eo/src/eoAtomRandom.h
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// eoAtomRandom.h
|
||||||
|
// Increments or decrements by one a single element
|
||||||
|
// (c) GeNeura Team, 1998
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#ifndef _EOATOMCREEP_H
|
||||||
|
#define _EOATOMCREEP_H
|
||||||
|
|
||||||
|
#include <eoRandom.h>
|
||||||
|
|
||||||
|
/** Modifies using a random number generator, that is entered in the ctor.
|
||||||
|
The RNG must return positive or negative numbers, whatever.
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
class eoAtomRandom: public eoAtomMutator<T> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
///
|
||||||
|
eoAtomRandom( eoRandom& _rng): rng( _rng ) {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual ~eoAtomRandom() {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual void operator()( T& _val ) const {
|
||||||
|
_val += rng();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @name Methods from eoObject
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
/** Inherited from eoObject
|
||||||
|
@see eoObject
|
||||||
|
*/
|
||||||
|
string className() const {return "eoAtomRandom";};
|
||||||
|
//@}
|
||||||
|
|
||||||
|
private:
|
||||||
|
eoRandom rng;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -56,12 +56,13 @@ template<class Chrom> class eoBreeder: public eoTransform<Chrom>
|
||||||
{
|
{
|
||||||
eoNaryOp<Chrom>* Nop = static_cast<eoNaryOp<Chrom>* >(op);
|
eoNaryOp<Chrom>* Nop = static_cast<eoNaryOp<Chrom>* >(op);
|
||||||
eoUniform<unsigned> u(0, pop.size() );
|
eoUniform<unsigned> u(0, pop.size() );
|
||||||
eoPop<Chrom> tmpVec;
|
eoPop<Chrom> inVec, outVec;
|
||||||
tmpVec.push_back( pop[i] );
|
inVec.push_back( pop[i] );
|
||||||
for ( unsigned i = 0; i < u(); i ++ ) {
|
unsigned numberOfOperands = u();
|
||||||
tmpVec.push_back( pop[ u() ] );
|
for ( unsigned i = 0; i < numberOfOperands; i ++ ) {
|
||||||
|
inVec.push_back( pop[ u() ] );
|
||||||
}
|
}
|
||||||
(*Nop)( tmpVec );
|
(*Nop)( inVec, outVec );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
270
eo/src/eoESFullChrom.h
Normal file
270
eo/src/eoESFullChrom.h
Normal file
|
|
@ -0,0 +1,270 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// eoESInd.h
|
||||||
|
// (c) 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
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _EOESFULLCHROM_H
|
||||||
|
#define _EOESFULLCHROM_H
|
||||||
|
|
||||||
|
// STL libraries
|
||||||
|
#include <vector> // For vector<>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <strstream>
|
||||||
|
#include <iostream> // for ostream
|
||||||
|
|
||||||
|
// EO includes
|
||||||
|
#include <eoVector.h>
|
||||||
|
#include <eoRNG.h>
|
||||||
|
/**@name Chromosomes for evolution strategies
|
||||||
|
Each chromosome in an evolution strategies is composed of a vector of floating point
|
||||||
|
values plus a vector of sigmas, that are added to them during mutation and a vector of correlations
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
|
||||||
|
/**@name individuals for evolution strategies -MS- 22/10/99
|
||||||
|
Each individual in an evolution strategy is composed of
|
||||||
|
a vector of floating point values
|
||||||
|
a vector of std deviations
|
||||||
|
a vector of rotation angles (for correlated mutations)
|
||||||
|
|
||||||
|
THese individuals CANNOT BE IMPLEMENTED as vectors of anything
|
||||||
|
at least in the case of correlated mutations
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
template <typename fitT = float >
|
||||||
|
class eoESFullChrom : public eoVector<double, fitT> {
|
||||||
|
public:
|
||||||
|
/// constructor
|
||||||
|
eoESFullChrom( unsigned _num_genes = 1,
|
||||||
|
unsigned _num_sigma = 1, unsigned _num_correl = 0,
|
||||||
|
bool _verbose = false,
|
||||||
|
double _ObjMin = 0, double _ObjMax = 1,
|
||||||
|
double _StdDevInit = 0.3 ):
|
||||||
|
eoVector<double, fitT>(_num_genes),
|
||||||
|
// ObjVar( _num_genes ), now an eoVector<double>
|
||||||
|
StdDev( _num_sigma ),
|
||||||
|
CorCff( _num_correl ),
|
||||||
|
verbose( _verbose ),
|
||||||
|
ObjMin( _ObjMin ),
|
||||||
|
ObjMax(_ObjMax ),
|
||||||
|
StdDevInit( _StdDevInit ) {}
|
||||||
|
|
||||||
|
/// copy constructor
|
||||||
|
eoESFullChrom( const eoESFullChrom& _eo ):
|
||||||
|
eoVector<double, fitT> ( _eo ), // ObjVar ( _eo.ObjVar ),
|
||||||
|
StdDev ( _eo.StdDev ), CorCff( _eo.CorCff ), verbose( _eo.verbose ),
|
||||||
|
ObjMin( _eo.ObjMin ), ObjMax(_eo.ObjMax ), StdDevInit( _eo.StdDevInit ) {}
|
||||||
|
|
||||||
|
|
||||||
|
/* another constructor, for compatibility reasons */
|
||||||
|
eoESFullChrom(istream& _s) {cout << "Not Yet implemented\n";exit(1);};
|
||||||
|
|
||||||
|
/* And now the useful constructor: from a parser (should be in the
|
||||||
|
factory, if such a thing exists one day for eoESFullChrom
|
||||||
|
*/
|
||||||
|
eoESFullChrom(Parser & parser) : StdDev(0), CorCff(0) {
|
||||||
|
parser.AddTitle("Description of ES individuals");
|
||||||
|
int num_genes, num_sigma;
|
||||||
|
bool correlated_mutations;
|
||||||
|
try {
|
||||||
|
num_genes = parser.getInt("-Io", "--NbObjVar", "2",
|
||||||
|
"Number of Object Variables" );
|
||||||
|
num_sigma = parser.getInt("-Is", "--NbSigma", "1",
|
||||||
|
"Number of Standard Deviations" );
|
||||||
|
correlated_mutations = parser.getBool("-Ic", "--Correlated",
|
||||||
|
"Correlated mutation?" );
|
||||||
|
ObjMin = parser.getFloat("-Im", "--min", "0",
|
||||||
|
"Minimum value for object variables" );
|
||||||
|
ObjMax = parser.getFloat("-IM", "--max", "1",
|
||||||
|
"Maximum value for object variables" );
|
||||||
|
StdDevInit = parser.getFloat("-II", "--SigmaInit", "0.3",
|
||||||
|
"Initial value for std. dev. (scaled by range)" );
|
||||||
|
verbose = parser.getBool("-Iv", "--verbose",
|
||||||
|
"Verbose listing of ES individuals (mutation parameters");
|
||||||
|
}
|
||||||
|
catch (exception & e)
|
||||||
|
{
|
||||||
|
cout << e.what() << endl;
|
||||||
|
parser.printHelp();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// consistency tests
|
||||||
|
if (! num_sigma) { // no std dev??? EXCEPTION
|
||||||
|
throw invalid_argument( "No standard deviation: choose another representation please" );
|
||||||
|
}
|
||||||
|
if (num_sigma > num_genes) {
|
||||||
|
cout << "WARNING, Number of Standard Deviations > Number of Object Variables\nAdjusted!\n";
|
||||||
|
num_sigma = num_genes;
|
||||||
|
// modify the Param value - so .status is OK
|
||||||
|
char sloc[20];
|
||||||
|
sprintf(sloc, "%d", num_genes);
|
||||||
|
parser.setParamValue("--NbSigma", sloc);
|
||||||
|
}
|
||||||
|
// adjust the sizes!!!
|
||||||
|
resize(num_genes);
|
||||||
|
if (num_sigma)
|
||||||
|
StdDev.resize(num_sigma);
|
||||||
|
if (correlated_mutations) {
|
||||||
|
if (num_sigma < num_genes) {
|
||||||
|
cout << "WARNING less Std Dev. than number of variables + Correlated mutations\n";
|
||||||
|
cout << "Though possible, this is a strange setting" << endl;
|
||||||
|
}
|
||||||
|
// nb of rotation angles: N*(N-1)/2 (in general!)
|
||||||
|
CorCff.resize ( (2*num_genes - num_sigma)*(num_sigma - 1) / 2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// Operator =
|
||||||
|
const eoESFullChrom& operator = ( const eoESFullChrom& _eo ) {
|
||||||
|
if ( this != &_eo ) {
|
||||||
|
// Change EO part
|
||||||
|
eoVector<double, fitT>::operator = (_eo);
|
||||||
|
|
||||||
|
// Change this part
|
||||||
|
// ObjVar = _eo.ObjVar;
|
||||||
|
StdDev = _eo.StdDev;
|
||||||
|
CorCff = _eo.CorCff;
|
||||||
|
verbose = _eo.verbose;
|
||||||
|
ObjMin = _eo.ObjMin;
|
||||||
|
ObjMax = _eo.ObjMax;
|
||||||
|
StdDevInit = _eo.StdDevInit;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// destructor
|
||||||
|
virtual ~eoESFullChrom() {}
|
||||||
|
|
||||||
|
///
|
||||||
|
double getStdDev( unsigned _i ) const {
|
||||||
|
if ( _i >= length() )
|
||||||
|
throw out_of_range( "out_of_range when reading StdDev");
|
||||||
|
return StdDev[ _i ];
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
void setStdDev( unsigned _i, double _val ) {
|
||||||
|
if ( _i < length() ) {
|
||||||
|
StdDev[_i] = _val;
|
||||||
|
} else
|
||||||
|
throw out_of_range( "out_of_range when writing StdDev");
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
double getCorCff( unsigned _i ) const {
|
||||||
|
if ( _i >= length() )
|
||||||
|
throw out_of_range( "out_of_range when reading CorCff");
|
||||||
|
return CorCff[ _i ];
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
void setCorCff( unsigned _i, double _val ) {
|
||||||
|
if ( _i < length() ) {
|
||||||
|
CorCff[_i] = _val;
|
||||||
|
} else
|
||||||
|
throw out_of_range( "out_of_range when writing CorCff");
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
void insertGene( unsigned _i, double _val ) {
|
||||||
|
throw FixedLengthChromosome();
|
||||||
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
void deleteGene( unsigned _i ) {
|
||||||
|
throw FixedLengthChromosome();
|
||||||
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
unsigned length() const { return size();}/* formerly ObjVar.size() */
|
||||||
|
unsigned StdDevLength() const { return StdDev.size();}
|
||||||
|
unsigned CorCffLength() const { return CorCff.size();}
|
||||||
|
|
||||||
|
|
||||||
|
/** Print itself: inherited from eoObject implementation.
|
||||||
|
Instance from base classes are processed in
|
||||||
|
base classes, so you don´t have to worry about, for instance, fitness.
|
||||||
|
@param _s the ostream in which things are written*/
|
||||||
|
virtual void printOn( ostream& _s ) const{
|
||||||
|
copy( begin(), end(), ostream_iterator<double>( _s, " ") );
|
||||||
|
// The formatting instructinos shoudl be left to the caller
|
||||||
|
// _s << "\n";
|
||||||
|
if (verbose) {
|
||||||
|
_s << "\n\tStd Dev. " ;
|
||||||
|
copy( StdDev.begin(), StdDev.end(), ostream_iterator<double>( _s, " ") );
|
||||||
|
if (CorCff.size()) {
|
||||||
|
_s << "\n\t";
|
||||||
|
copy( CorCff.begin(), CorCff.end(), ostream_iterator<double>( _s, " ") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** This exception should be thrown when trying to insert or delete a gene
|
||||||
|
in a fixed length chromosome
|
||||||
|
*/
|
||||||
|
class FixedLengthChromosome : public exception {
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
FixedLengthChromosome()
|
||||||
|
: exception() { };
|
||||||
|
|
||||||
|
~FixedLengthChromosome() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
// accessors
|
||||||
|
double getObjMin() const {return ObjMin;}
|
||||||
|
double getObjMax() const {return ObjMax;}
|
||||||
|
double getStdDevInit () const {return StdDevInit;}
|
||||||
|
|
||||||
|
/** Inherited from eoObject
|
||||||
|
@see eoObject
|
||||||
|
*/
|
||||||
|
virtual string className() const {return "eoESFullChrom";};
|
||||||
|
|
||||||
|
private:
|
||||||
|
// vector<double> ObjVar; /* object variable vector */
|
||||||
|
// or shoudl the class be subclass of EOVector<double> ???
|
||||||
|
|
||||||
|
vector<double> StdDev; /* standard deviation vector */
|
||||||
|
vector<double> CorCff; /* correlation coefficient vector */
|
||||||
|
|
||||||
|
bool verbose; /* Print std deviations or not */
|
||||||
|
|
||||||
|
/** the range is used for mutation AND random initialization,
|
||||||
|
* while the StdDevInit is used only for random initialization
|
||||||
|
* this in a little inconsistent!
|
||||||
|
*/
|
||||||
|
double ObjMin, ObjMax; /* Range for Object variables */
|
||||||
|
double StdDevInit; /* Initial value of Standard Deviations */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
243
eo/src/eoESFullMut.h
Normal file
243
eo/src/eoESFullMut.h
Normal file
|
|
@ -0,0 +1,243 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// eoESMute.h : ES mutation
|
||||||
|
// (c) 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 _EOESMUT_H
|
||||||
|
#define _EOESMUT_H
|
||||||
|
|
||||||
|
#include <eoParser.h>
|
||||||
|
#include <eoRNG.h>
|
||||||
|
#include <cmath> // for exp
|
||||||
|
|
||||||
|
#include <eoESFullChrom.h>
|
||||||
|
#include <eoOp.h>
|
||||||
|
|
||||||
|
const double ES_SIGEPS = 1.0e-40; /* ES lower bound for sigma values */
|
||||||
|
// should not be a parameter ...
|
||||||
|
|
||||||
|
/** ES-style mutation in the large: Obviously, valid only for eoESInd
|
||||||
|
*/
|
||||||
|
template <class fitT>
|
||||||
|
class eoESMutate: public eoMonOp< eoESFullChrom<fitT> > {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
eoESMutate( double _TauLcl, double _TauGlb, double _TauBeta )
|
||||||
|
: eoMonOp< eoESFullChrom<fitT> >( ), TauLcl(_TauLcl), TauGlb(_TauGlb),
|
||||||
|
TauBeta(_TauBeta) {};
|
||||||
|
|
||||||
|
/* The parser constructor
|
||||||
|
*/
|
||||||
|
eoESMutate(Parser & parser, unsigned _stdDevLength, unsigned _size, bool _correlated ):
|
||||||
|
eoMonOp< eoESFullChrom<fitT> >( ) {
|
||||||
|
parser.AddTitle("Parameters of ES mutation (before renormalization)");
|
||||||
|
try { // we know that there is at least 1 std dev.
|
||||||
|
if (_stdDevLength == 1) {
|
||||||
|
TauLcl = parser.getInt("-Ml", "--TauLcl", "1",
|
||||||
|
"TauLcl, Mutation rate for the only Std Dev." );
|
||||||
|
// different normalization in that case -- Thomas Baeck
|
||||||
|
TauLcl /= sqrt((double) _size);
|
||||||
|
}
|
||||||
|
else { /* more than 1 std dev */
|
||||||
|
TauLcl = parser.getFloat("-Ml", "--TauLcl", "1",
|
||||||
|
"Local mutation rate for Std Dev." );
|
||||||
|
TauGlb = parser.getFloat("-Mg", "--TauGlb", "1",
|
||||||
|
"Global mutation rate for Std Dev." );
|
||||||
|
// renormalization
|
||||||
|
TauLcl /= sqrt( 2.0 * sqrt( (double)_size ) );
|
||||||
|
TauGlb /= sqrt( 2.0 * ( (double) _size ) );
|
||||||
|
|
||||||
|
if ( _correlated ) { // Correlated Mutations
|
||||||
|
TauBeta = parser.getFloat("-Mb", "--TauBeta", "0.0873",
|
||||||
|
"Mutation rate for corr. coeff." );
|
||||||
|
// rotation angles: no normalization
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception & e)
|
||||||
|
{
|
||||||
|
cout << e.what() << endl;
|
||||||
|
parser.printHelp();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// needed virtual dtor
|
||||||
|
virtual ~eoESMutate() {};
|
||||||
|
|
||||||
|
// virtual separation depending wether correlated mutations are present
|
||||||
|
virtual void operator() ( eoESFullChrom<fitT> & _eo ) const {
|
||||||
|
if (_eo.CorCffLength())
|
||||||
|
CorrelatedMutation(_eo);
|
||||||
|
else
|
||||||
|
StandardMutation(_eo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @name Methods from eoObject
|
||||||
|
readFrom and printOn are directly inherited from eoObject
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
/** Inherited from eoObject
|
||||||
|
@see eoObject
|
||||||
|
*/
|
||||||
|
virtual string className() const {return "eoESMutate";};
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// mutations - standard et 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 StandardMutation( eoESFullChrom<fitT> & _eo ) const {
|
||||||
|
unsigned i,k;
|
||||||
|
double Glb, StdLoc;
|
||||||
|
|
||||||
|
if (_eo.StdDevLength() == 1) { /* single StdDev -> No global factor */
|
||||||
|
StdLoc = _eo.getStdDev(0);
|
||||||
|
StdLoc *= exp(TauLcl*rng.normal());
|
||||||
|
if (StdLoc < ES_SIGEPS)
|
||||||
|
StdLoc = ES_SIGEPS;
|
||||||
|
_eo.setStdDev(0, StdLoc);
|
||||||
|
_eo.setGene( 0, _eo.getGene(0) + StdLoc*rng.normal());
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
else { /* more than one std dev. */
|
||||||
|
Glb = exp(TauGlb*rng.normal());
|
||||||
|
for (i = 0; i < _eo.length() && i < _eo.StdDevLength(); i++) {
|
||||||
|
StdLoc = _eo.getStdDev(i);
|
||||||
|
StdLoc *= Glb * exp(TauLcl*rng.normal());
|
||||||
|
if (StdLoc < ES_SIGEPS)
|
||||||
|
StdLoc = ES_SIGEPS;
|
||||||
|
_eo.setStdDev(i, StdLoc);
|
||||||
|
_eo.setGene( i, _eo.getGene(i) + StdLoc*rng.normal());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// last object variables: same STdDev than the preceding one
|
||||||
|
for (k = i; k < _eo.length(); k++) {
|
||||||
|
_eo.setGene( k, _eo.getGene(k) + StdLoc*rng.normal() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 CorrelatedMutation( eoESFullChrom<fitT> & _eo ) const {
|
||||||
|
|
||||||
|
|
||||||
|
int i, k, n1, n2, nq;
|
||||||
|
|
||||||
|
double d1, d2, S, C, Glb;
|
||||||
|
double tmp;
|
||||||
|
/*
|
||||||
|
* First: mutate standard deviations (as above).
|
||||||
|
*/
|
||||||
|
|
||||||
|
Glb = exp(TauGlb*rng.normal());
|
||||||
|
for (i = 0; i < _eo.StdDevLength(); i++) {
|
||||||
|
tmp = _eo.getStdDev(i);
|
||||||
|
_eo.setStdDev( i, tmp*Glb*exp(TauLcl*rng.normal()) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mutate rotation angles.
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (i = 0; i < _eo.CorCffLength(); i++) {
|
||||||
|
tmp = _eo.getCorCff(i);
|
||||||
|
tmp += TauBeta*rng.normal();
|
||||||
|
// danger of VERY long loops --MS--
|
||||||
|
// while (CorCff[i] > M_PI)
|
||||||
|
// CorCff[i] -= 2.0 * M_PI;
|
||||||
|
// while (CorCff[i] < - M_PI)
|
||||||
|
// CorCff[i] += 2.0 * M_PI;
|
||||||
|
if ( fabs(tmp) > M_PI ) {
|
||||||
|
tmp -= M_PI * (int) (tmp/M_PI) ;
|
||||||
|
}
|
||||||
|
_eo.setCorCff(i, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Perform correlated mutations.
|
||||||
|
*/
|
||||||
|
vector<double> VarStp(_eo.size());
|
||||||
|
for (i = 0; i < _eo.size() && i < _eo.StdDevLength(); i++)
|
||||||
|
VarStp[i] = _eo.getStdDev(i)*rng.normal();
|
||||||
|
for (k = i; k < _eo.size(); k++)
|
||||||
|
VarStp[k] = _eo.getStdDev(i-1)*rng.normal();
|
||||||
|
nq = _eo.CorCffLength() - 1;
|
||||||
|
for (k = _eo.size()-_eo.StdDevLength(); 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.getCorCff(nq) );
|
||||||
|
C = cos( _eo.getCorCff(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];
|
||||||
|
|
||||||
|
}
|
||||||
|
// 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 */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
// Not yet implemented!
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ template< class EOT >
|
||||||
struct eoEvalFuncPtr: public eoEvalFunc<EOT> {
|
struct eoEvalFuncPtr: public eoEvalFunc<EOT> {
|
||||||
|
|
||||||
eoEvalFuncPtr( void (* _eval)( EOT& ) )
|
eoEvalFuncPtr( void (* _eval)( EOT& ) )
|
||||||
: eoEvalFunc(), evalFunc( _eval ) {};
|
: eoEvalFunc<EOT>(), evalFunc( _eval ) {};
|
||||||
|
|
||||||
/// Effectively applies the evaluation function to an EO
|
/// Effectively applies the evaluation function to an EO
|
||||||
virtual void operator() ( EOT & _eo ) const {
|
virtual void operator() ( EOT & _eo ) const {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@
|
||||||
#include <eoUniform.h>
|
#include <eoUniform.h>
|
||||||
|
|
||||||
/** Generic Mutation of an EO.
|
/** Generic Mutation of an EO.
|
||||||
This is a virtual class, just to establish the interface
|
This is a virtual class, just to establish the interface for the ctor.
|
||||||
|
Mutation is usually type-specific
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
|
|
@ -45,8 +46,9 @@ public:
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual void operator()( EOT& _eo ) const {
|
virtual void operator()( EOT& _eo ) const {
|
||||||
for ( unsigned i = 0; i < _eo.length(); i ++ )
|
typename EOT::iterator i;
|
||||||
applyAt( _eo, i );
|
for ( i = _eo.begin(); i != _eo.end(); i ++ )
|
||||||
|
applyAt( _eo, *i );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// To print me on a stream.
|
/// To print me on a stream.
|
||||||
|
|
@ -85,49 +87,4 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Mutation of an eoString.
|
|
||||||
The eoString's genes are changed by adding or substracting 1 to
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <class EOT>
|
|
||||||
class eoStringMutation: public eoMutation<EOT> {
|
|
||||||
public:
|
|
||||||
|
|
||||||
///
|
|
||||||
eoStringMutation(const double _rate=0.0) : eoMutation< EOT >(_rate) {};
|
|
||||||
|
|
||||||
///
|
|
||||||
virtual ~eoStringMutation() {};
|
|
||||||
|
|
||||||
/** @name Methods from eoObject
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
/** Inherited from eoObject
|
|
||||||
@see eoObject
|
|
||||||
*/
|
|
||||||
string className() const {return "eoStringMutation";};
|
|
||||||
//@}
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
typedef EOT::Type Type;
|
|
||||||
#else
|
|
||||||
typedef typename EOT::Type Type;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// applies operator to one gene in the EO. It increments or decrements the value of that gene by one.
|
|
||||||
virtual void applyAt( EOT& _eo, unsigned _i ) const {
|
|
||||||
eoUniform<double> uniform( 0, 1 );
|
|
||||||
if( rate < uniform() ) {
|
|
||||||
_eo.gene(_i) += ( uniform()>=0.5 )? (1) : (-1) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,7 @@ public:
|
||||||
/// Dtor
|
/// Dtor
|
||||||
~eoBinOp () {};
|
~eoBinOp () {};
|
||||||
|
|
||||||
/** applies operator, to the object. If arity is more than 1,
|
/** applies operator, to the object. Modifies both operands.
|
||||||
* keeps a copy of the operand in a cache.
|
|
||||||
*/
|
*/
|
||||||
virtual void operator()( EOType& _eo1, EOType& _eo2 ) const = 0;
|
virtual void operator()( EOType& _eo1, EOType& _eo2 ) const = 0;
|
||||||
|
|
||||||
|
|
@ -167,7 +166,8 @@ public:
|
||||||
|
|
||||||
#include <eoPop.h>
|
#include <eoPop.h>
|
||||||
/** eoNaryOp is the N-ary operator: genetic operator that takes
|
/** eoNaryOp is the N-ary operator: genetic operator that takes
|
||||||
several EOs. It could be called an {\em orgy} operator
|
several EOs. It could be called an {\em orgy} operator. It's a general operator
|
||||||
|
that takes any number of inputs and spits out any number of outputs
|
||||||
*/
|
*/
|
||||||
template <class EOType>
|
template <class EOType>
|
||||||
class eoNaryOp: public eoOp<EOType> {
|
class eoNaryOp: public eoOp<EOType> {
|
||||||
|
|
@ -186,17 +186,17 @@ public:
|
||||||
|
|
||||||
/** applies randomly operator, to the object.
|
/** applies randomly operator, to the object.
|
||||||
*/
|
*/
|
||||||
virtual void operator()( eoPop<EOType> & _eop) const = 0;
|
virtual void operator()( const eoPop<EOType> & _in, eoPop<EOType> _out ) const = 0;
|
||||||
|
|
||||||
/** @name Methods from eoObject
|
/** @name Methods from eoObject
|
||||||
readFrom and printOn are directly inherited from eoObject.
|
readFrom and printOn are directly inherited from eoObject.
|
||||||
*/
|
*/
|
||||||
//@{
|
//@{
|
||||||
/** Inherited from eoObject
|
/** Inherited from eoObject
|
||||||
@see eoObject
|
@see eoObject
|
||||||
*/
|
*/
|
||||||
string className() const {return "eoNaryOp";};
|
string className() const {return "eoNaryOp";};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
};
|
};
|
||||||
//@}
|
//@}
|
||||||
|
|
|
||||||
|
|
@ -23,30 +23,44 @@
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/* eoParser.h
|
|
||||||
some classes to parser either the command line or a parameter file
|
|
||||||
|
|
||||||
(c) geneura team, 1999
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef _PARSER_H
|
#ifndef _PARSER_H
|
||||||
#define _PARSER_H
|
#define _PARSER_H
|
||||||
|
|
||||||
// Standard C libraries
|
#include <string.h> // for strcasecmp ... maybe there's a c++ way of doing it?
|
||||||
#include <stdlib.h>
|
#ifdef _MSC_VER
|
||||||
#include <stdio.h>
|
#define strcasecmp(a,b) _strnicmp(a,b,strlen(a))
|
||||||
#include <string.h>
|
#endif
|
||||||
#include <fstream.h>
|
|
||||||
// STL includes
|
// STL includes
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <strstream>
|
#include <strstream>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
#include "UException.h"
|
//-----------------------------------------------------------------------------
|
||||||
|
// Class UExceptions - probably useless ???
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* This class manages exceptions. It´s barely an extension of the standard except
|
||||||
|
ion,
|
||||||
|
* but it can be initialized with an STL string. Called UException (utils-except
|
||||||
|
ion)+
|
||||||
|
* to avoid conflicts with other classes.
|
||||||
|
*/
|
||||||
|
class UException: public exception {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
UException( const string& _msg ): msg( _msg ) { };
|
||||||
|
|
||||||
using namespace std;
|
///
|
||||||
|
virtual const char* what() const { return msg.c_str(); };
|
||||||
|
|
||||||
|
private:
|
||||||
|
string msg;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -446,121 +460,123 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// SECOND: search the file parameter, if present
|
// SECOND: search the file parameter, if present
|
||||||
ifstream is(InputFileName.c_str());
|
if ( InputFileName != "" ) {
|
||||||
while (is) {
|
ifstream is(InputFileName.c_str());
|
||||||
is >> tmpStr;
|
while (is) {
|
||||||
if ( ( !strcmp(tmpStr.c_str(), param.shortName().c_str()) ) ||
|
is >> tmpStr;
|
||||||
( !strcasecmp(tmpStr.c_str(), param.longName().c_str()) )
|
if ( ( !strcmp(tmpStr.c_str(), param.shortName().c_str()) ) ||
|
||||||
) { // found the keyword
|
( !strcasecmp(tmpStr.c_str(), param.longName().c_str()) )
|
||||||
|
) { // found the keyword
|
||||||
|
|
||||||
Param::valueType tmp = param.valType();
|
Param::valueType tmp = param.valType();
|
||||||
switch ( tmp ) {
|
switch ( tmp ) {
|
||||||
case Param::TITLE:
|
case Param::TITLE:
|
||||||
cerr << "Error, we should not be there" << endl;
|
cerr << "Error, we should not be there" << endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
case Param::BOOL :
|
case Param::BOOL :
|
||||||
param.value("true" );
|
param.value("true" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Param::INT:
|
case Param::INT:
|
||||||
case Param::UL:
|
case Param::UL:
|
||||||
case Param::FLOAT:
|
case Param::FLOAT:
|
||||||
is >> tmpStr;
|
is >> tmpStr;
|
||||||
param.value(tmpStr);
|
param.value(tmpStr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Param::STRING:
|
case Param::STRING:
|
||||||
tmpStr = parse_string(is);
|
tmpStr = parse_string(is);
|
||||||
param.value(tmpStr);
|
param.value(tmpStr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Param::ARRAY:
|
case Param::ARRAY:
|
||||||
ReadStr = parse_string(is);
|
ReadStr = parse_string(is);
|
||||||
if ( ReadStr != "<" ) { // no "<" ">" --> a single string in the array
|
if ( ReadStr != "<" ) { // no "<" ">" --> a single string in the array
|
||||||
param.value(ReadStr);
|
param.value(ReadStr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// read next word - and keep it in case of <> mismatch
|
// read next word - and keep it in case of <> mismatch
|
||||||
FirstWord = parse_string(is);
|
FirstWord = parse_string(is);
|
||||||
// test for empty array
|
// test for empty array
|
||||||
if (FirstWord == ">") {
|
if (FirstWord == ">") {
|
||||||
param.value("");
|
param.value("");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// else, read all words until ">"
|
// else, read all words until ">"
|
||||||
tmpStr = FirstWord;
|
tmpStr = FirstWord;
|
||||||
ReadStr = parse_string(is);
|
ReadStr = parse_string(is);
|
||||||
while ( is && (ReadStr != ">") ) {
|
while ( is && (ReadStr != ">") ) {
|
||||||
tmpStr = tmpStr + " " + ReadStr;
|
tmpStr = tmpStr + " " + ReadStr;
|
||||||
ReadStr = parse_string(is);
|
ReadStr = parse_string(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is) { // there was a "<" without the corresponding ">"
|
if (!is) { // there was a "<" without the corresponding ">"
|
||||||
throw Parser::BadArrayParam( param.longName(), FirstWord );
|
throw Parser::BadArrayParam( param.longName(), FirstWord );
|
||||||
param.value(FirstWord); // assume unique string
|
param.value(FirstWord); // assume unique string
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
param.value(tmpStr);
|
param.value(tmpStr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// LAST (highest priority) parse the command line arguments
|
|
||||||
for (i=1 ; i<parse_argc ; i++)
|
|
||||||
if( ( ! strcasecmp(param.longName().c_str(), parse_argv[i]) ) ||
|
|
||||||
( ! strcmp(param.shortName().c_str(), parse_argv[i]) )
|
|
||||||
) { // found the parameter name
|
|
||||||
if (param.valType() == Param::BOOL) {
|
|
||||||
//cout <<"BOOL: "<<parse_argv[i]<<" <-- true"<<endl;
|
|
||||||
param.value("true");
|
|
||||||
}else{
|
|
||||||
if (param.valType() != Param::ARRAY) { //only if it is not an array
|
|
||||||
//cout <<"TYPE: "<<parse_argv[i]<<" <-- "<<parse_argv[i+1]<<endl;
|
|
||||||
param.value(parse_argv[i+1]);
|
|
||||||
}else{ //if it is an ARRAY
|
|
||||||
i++;
|
|
||||||
ReadStr = parse_argv[i++];
|
|
||||||
//cout <<"ARRAY: <-- ";
|
|
||||||
|
|
||||||
if ( ReadStr != "<" ) { // no "<" ">" --> a single string in the array
|
|
||||||
param.value(ReadStr);
|
|
||||||
}else{
|
|
||||||
// read next word - and keep it in case of <> mismatch
|
|
||||||
FirstWord = parse_argv[i++];
|
|
||||||
|
|
||||||
// test for empty array
|
|
||||||
if (FirstWord == ">") {
|
|
||||||
param.value("");
|
|
||||||
}else{
|
|
||||||
// else, read all words until ">"
|
|
||||||
tmpStr = FirstWord;
|
|
||||||
ReadStr = parse_argv[i++];
|
|
||||||
while ( (i<parse_argc) && (ReadStr != ">") ) {
|
|
||||||
tmpStr = tmpStr + " " + ReadStr;
|
|
||||||
ReadStr = parse_argv[i++];
|
|
||||||
}
|
|
||||||
//cout <<"tmpStr ;"<<tmpStr<<"; ("<<i<<","<<parse_argc<<") "<<endl;
|
|
||||||
|
|
||||||
if ( (i>=parse_argc) && (ReadStr != ">") ) { // there was a "<" without the corresponding ">"
|
|
||||||
throw Parser::BadArrayParam( param.longName(), FirstWord );
|
|
||||||
param.value(FirstWord); // assume unique string
|
|
||||||
}else{
|
|
||||||
param.value(tmpStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//MS after trying all possibilities, and if the value has not changed
|
|
||||||
// though the parameter was required, protest!
|
// LAST (highest priority) parse the command line arguments
|
||||||
if (param.required() && !param.changed())
|
for (i=1 ; i<parse_argc ; i++)
|
||||||
throw Parser::MissingReqParam(param.shortName());
|
if( ( ! strcasecmp(param.longName().c_str(), parse_argv[i]) ) ||
|
||||||
|
( ! strcmp(param.shortName().c_str(), parse_argv[i]) )
|
||||||
|
) { // found the parameter name
|
||||||
|
if (param.valType() == Param::BOOL) {
|
||||||
|
//cout <<"BOOL: "<<parse_argv[i]<<" <-- true"<<endl;
|
||||||
|
param.value("true");
|
||||||
|
}else{
|
||||||
|
if (param.valType() != Param::ARRAY) { //only if it is not an array
|
||||||
|
//cout <<"TYPE: "<<parse_argv[i]<<" <-- "<<parse_argv[i+1]<<endl;
|
||||||
|
param.value(parse_argv[i+1]);
|
||||||
|
}else{ //if it is an ARRAY
|
||||||
|
i++;
|
||||||
|
ReadStr = parse_argv[i++];
|
||||||
|
//cout <<"ARRAY: <-- ";
|
||||||
|
|
||||||
|
if ( ReadStr != "<" ) { // no "<" ">" --> a single string in the array
|
||||||
|
param.value(ReadStr);
|
||||||
|
}else{
|
||||||
|
// read next word - and keep it in case of <> mismatch
|
||||||
|
FirstWord = parse_argv[i++];
|
||||||
|
|
||||||
|
// test for empty array
|
||||||
|
if (FirstWord == ">") {
|
||||||
|
param.value("");
|
||||||
|
}else{
|
||||||
|
// else, read all words until ">"
|
||||||
|
tmpStr = FirstWord;
|
||||||
|
ReadStr = parse_argv[i++];
|
||||||
|
while ( (i<parse_argc) && (ReadStr != ">") ) {
|
||||||
|
tmpStr = tmpStr + " " + ReadStr;
|
||||||
|
ReadStr = parse_argv[i++];
|
||||||
|
}
|
||||||
|
//cout <<"tmpStr ;"<<tmpStr<<"; ("<<i<<","<<parse_argc<<") "<<endl;
|
||||||
|
|
||||||
|
if ( (i>=parse_argc) && (ReadStr != ">") ) { // there was a "<" without the corresponding ">"
|
||||||
|
throw Parser::BadArrayParam( param.longName(), FirstWord );
|
||||||
|
param.value(FirstWord); // assume unique string
|
||||||
|
}else{
|
||||||
|
param.value(tmpStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//MS after trying all possibilities, and if the value has not changed
|
||||||
|
// though the parameter was required, protest!
|
||||||
|
if (param.required() && !param.changed())
|
||||||
|
throw Parser::MissingReqParam(param.shortName());
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -610,6 +626,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// the output method - generate the .status file (unless other name is given)
|
||||||
friend ostream & operator<< ( ostream & os, Parser & _parser )
|
friend ostream & operator<< ( ostream & os, Parser & _parser )
|
||||||
{
|
{
|
||||||
vector<Param>::iterator p;
|
vector<Param>::iterator p;
|
||||||
|
|
@ -630,16 +647,19 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Param::ARRAY :
|
case Param::ARRAY :
|
||||||
os << p->longName() << " < " << p->value() << " >" ;
|
os << p->longName() << " < " << p->value().c_str() << " >" ;
|
||||||
break;
|
break;
|
||||||
case Param::STRING:
|
case Param::STRING:
|
||||||
os << p->longName()<<" \""<<p->value()<<"\" ";
|
os << p->longName()<<" \""<<p->value().c_str()<<"\" ";
|
||||||
break;
|
break;
|
||||||
case Param::TITLE:
|
case Param::TITLE:
|
||||||
os << endl; // Title is in the description below
|
os << endl; // Title is in the description below
|
||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
os << "\t # " << p->description() << " [" << p->defValue() << "]" << endl;
|
os << "\t #" << p->shortName() << " : " << p->description();
|
||||||
|
if (p->valType() != Param::TITLE)
|
||||||
|
os << " [" << p->defValue() << "]" ;
|
||||||
|
os << endl;
|
||||||
}
|
}
|
||||||
return os;
|
return os;
|
||||||
};
|
};
|
||||||
|
|
@ -666,26 +686,29 @@ public:
|
||||||
*/
|
*/
|
||||||
void printHelp() {
|
void printHelp() {
|
||||||
vector<Param>::iterator p;
|
vector<Param>::iterator p;
|
||||||
unsigned i;
|
// unsigned i;
|
||||||
|
|
||||||
// print program name and description
|
// print program name and description
|
||||||
cout << this->programName <<":"<<endl<<"\t"<<programDescription<<endl;
|
cout << this->programName <<": "<<programDescription<<endl<<endl;
|
||||||
|
|
||||||
// print the usage when calling the program from the command line
|
// print the usage when calling the program from the command line
|
||||||
cout << "Usage: "<<endl<< programName<<" ";
|
cout << "Usage: "<< programName<<" [Options]\n";
|
||||||
for ( i=0,p=params.begin(); p!=params.end(); i++,p++ )
|
// only short usage!
|
||||||
if( p->valType() != Param::TITLE ) {
|
cout << "Options of the form \"-ShortName value\" or \"--LongName value\"" << endl;
|
||||||
if( p->valType() != Param::BOOL ){
|
|
||||||
cout << ( (!p->required())?"[":"");
|
|
||||||
cout <<p->shortName()<<" value"<<i;
|
|
||||||
cout << ( (!p->required())?"]":"")<<" ";
|
|
||||||
}else{
|
|
||||||
cout << "["<<p->shortName()<<"] ";
|
|
||||||
}
|
|
||||||
} // for p
|
|
||||||
cout << endl<<endl<<"Where:"<<endl;
|
|
||||||
|
|
||||||
for ( p=params.begin(); p!=params.end(); p++ )
|
// for ( i=0,p=params.begin(); p!=params.end(); i++,p++ )
|
||||||
|
// if( p->valType() != Param::TITLE ) {
|
||||||
|
// if( p->valType() != Param::BOOL ){
|
||||||
|
// cout << ( (!p->required())?"[":"");
|
||||||
|
// cout <<p->shortName()<<" value"<<i;
|
||||||
|
// cout << ( (!p->required())?"]":"")<<" ";
|
||||||
|
// }else{
|
||||||
|
// cout << "["<<p->shortName()<<"] ";
|
||||||
|
// }
|
||||||
|
// } // for p
|
||||||
|
cout << "Where:"<<endl;
|
||||||
|
|
||||||
|
for ( p=params.begin(); p!=params.end(); p++ ) {
|
||||||
if( p->valType() != Param::TITLE ) {
|
if( p->valType() != Param::TITLE ) {
|
||||||
cout << p->shortName()<<","<<p->longName()<<":\t"<<p->description()<<endl;
|
cout << p->shortName()<<","<<p->longName()<<":\t"<<p->description()<<endl;
|
||||||
|
|
||||||
|
|
@ -703,7 +726,11 @@ public:
|
||||||
cout << ") True if present" << endl;
|
cout << ") True if present" << endl;
|
||||||
else
|
else
|
||||||
cout<<") "<<( (p->required())?"Required":"Optional" )<<". By default: "<<p->defValue()<<endl;
|
cout<<") "<<( (p->required())?"Required":"Optional" )<<". By default: "<<p->defValue()<<endl;
|
||||||
} // for p
|
}
|
||||||
|
else {
|
||||||
|
cout << "\n\t # " << p->description() << endl;
|
||||||
|
}
|
||||||
|
} // for p
|
||||||
cout << endl;
|
cout << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -787,4 +814,34 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Reproducible random seed
|
||||||
|
// Maybe there is a better place for this subroutine (a separate .cpp?)
|
||||||
|
#include <eoRNG.h>
|
||||||
|
|
||||||
|
//----------------------------------
|
||||||
|
void InitRandom( Parser & parser) {
|
||||||
|
//----------------------------------
|
||||||
|
unsigned long _seed;
|
||||||
|
try {
|
||||||
|
_seed = parser.getUnsignedLong("-S", "--seed", "0", "Seed for Random number generator" );
|
||||||
|
}
|
||||||
|
catch (UException & e)
|
||||||
|
{
|
||||||
|
cout << e.what() << endl;
|
||||||
|
parser.printHelp();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_seed == 0) { // use clock to get a "random" seed
|
||||||
|
_seed = unsigned long( time( 0 ) );
|
||||||
|
ostrstream s;
|
||||||
|
s << _seed;
|
||||||
|
parser.setParamValue("--seed", s.str()); // so it will be printed out in the status file, and canbe later re-used to re-run EXACTLY the same run
|
||||||
|
}
|
||||||
|
rng.reseed(_seed);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ class eoPop: public vector<EOT>, public eoObject, public eoPersistent {
|
||||||
/** Inherited from eoObject. Returns the class name.
|
/** Inherited from eoObject. Returns the class name.
|
||||||
@see eoObject
|
@see eoObject
|
||||||
*/
|
*/
|
||||||
string className() const {return "eoPop";};
|
virtual string className() const {return "eoPop";};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class eoTransform: public eoObject{
|
||||||
/** Inherited from eoObject. Returns the class name.
|
/** Inherited from eoObject. Returns the class name.
|
||||||
@see eoObject
|
@see eoObject
|
||||||
*/
|
*/
|
||||||
string className() const {return "eoTransform";};
|
virtual string className() const {return "eoTransform";};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -92,7 +92,7 @@ class eoSelect: public eoObject{
|
||||||
/** Inherited from eoObject. Returns the class name.
|
/** Inherited from eoObject. Returns the class name.
|
||||||
@see eoObject
|
@see eoObject
|
||||||
*/
|
*/
|
||||||
string className() const {return "eoSelect";};
|
virtual string className() const {return "eoSelect";};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -124,7 +124,7 @@ class eoMerge: public eoObject{
|
||||||
/** Inherited from eoObject. Returns the class name.
|
/** Inherited from eoObject. Returns the class name.
|
||||||
@see eoObject
|
@see eoObject
|
||||||
*/
|
*/
|
||||||
string className() const {return "eoMerge";};
|
virtual string className() const {return "eoMerge";};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Return the rate to be selected from the original population
|
/// Return the rate to be selected from the original population
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ public:
|
||||||
for ( i=begin(), j=1; i!=end(); i++,j++ ) {
|
for ( i=begin(), j=1; i!=end(); i++,j++ ) {
|
||||||
if( j == _id )
|
if( j == _id )
|
||||||
erase( i );
|
erase( i );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if ( i == end() )
|
if ( i == end() )
|
||||||
throw runtime_error( "No such id in eoProportionalOpSel::op\n" );
|
throw runtime_error( "No such id in eoProportionalOpSel::op\n" );
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@
|
||||||
#ifndef EO_RANDOM_NUMBER_GENERATOR
|
#ifndef EO_RANDOM_NUMBER_GENERATOR
|
||||||
#define EO_RANDOM_NUMBER_GENERATOR
|
#define EO_RANDOM_NUMBER_GENERATOR
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
#include <eoPersistent.h>
|
#include <eoPersistent.h>
|
||||||
#include <eoObject.h>
|
#include <eoObject.h>
|
||||||
|
|
||||||
|
|
@ -107,9 +109,10 @@ class eoRng : public eoObject, public eoPersistent
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
/**
|
/**
|
||||||
ctor takes a seed not unintentionally defaulted at 42.
|
ctor takes a random seed; if you want another seed, use reseed
|
||||||
|
@see reseed
|
||||||
*/
|
*/
|
||||||
eoRng(uint32 s = 42U) : state(0), next(0), left(-1), cached(false)
|
eoRng(uint32 s = (uint32) time(0) ) : state(0), next(0), left(-1), cached(false)
|
||||||
{
|
{
|
||||||
state = new uint32[N+1];
|
state = new uint32[N+1];
|
||||||
initialize(s);
|
initialize(s);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public:
|
||||||
/** methods that implement the eo1d <em>protocol</em>
|
/** methods that implement the eo1d <em>protocol</em>
|
||||||
@exception out_of_range if _i is larger than EO´s size
|
@exception out_of_range if _i is larger than EO´s size
|
||||||
*/
|
*/
|
||||||
virtual char gene( unsigned _i ) const {
|
virtual char getGene( unsigned _i ) const {
|
||||||
if ( _i >= length() )
|
if ( _i >= length() )
|
||||||
throw out_of_range( "out_of_range when reading gene");
|
throw out_of_range( "out_of_range when reading gene");
|
||||||
return (*this)[_i];
|
return (*this)[_i];
|
||||||
|
|
@ -92,10 +92,10 @@ public:
|
||||||
/** methods that implement the eo1d <em>protocol</em>
|
/** methods that implement the eo1d <em>protocol</em>
|
||||||
@exception out_of_range if _i is larger than EO´s size
|
@exception out_of_range if _i is larger than EO´s size
|
||||||
*/
|
*/
|
||||||
virtual char& gene( unsigned _i ) {
|
virtual void setGene( unsigned _i, const char& _value ) {
|
||||||
if ( _i >= size() )
|
if ( _i >= size() )
|
||||||
throw out_of_range( "out_of_range when writing a gene");
|
throw out_of_range( "out_of_range when writing a gene");
|
||||||
return (*this)[_i];
|
(*this)[_i] = _value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Inserts a value after _i, displacing anything to the right
|
/** Inserts a value after _i, displacing anything to the right
|
||||||
|
|
@ -130,7 +130,7 @@ public:
|
||||||
/** Inherited from eoObject
|
/** Inherited from eoObject
|
||||||
@see eoObject
|
@see eoObject
|
||||||
*/
|
*/
|
||||||
string className() const {return "eoString";};
|
virtual string className() const {return "eoString";};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
78
eo/src/eoStringMutation.h
Normal file
78
eo/src/eoStringMutation.h
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// eoStringMutation.h
|
||||||
|
// (c) GeNeura Team, 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
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _EOSTRINGMUTATION_H
|
||||||
|
#define _EOSRTINGMUTATION_H
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
// EO includes
|
||||||
|
#include <eoOp.h>
|
||||||
|
#include <eoUniform.h>
|
||||||
|
#include <eoMutation.h>
|
||||||
|
|
||||||
|
/** Mutation of an eoString.
|
||||||
|
The eoString's genes are changed by adding or substracting 1 to
|
||||||
|
*/
|
||||||
|
|
||||||
|
template <class EOT>
|
||||||
|
class eoStringMutation: public eoMutation<EOT> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
///
|
||||||
|
eoStringMutation(const double _rate=0.0) : eoMutation< EOT >(_rate) {};
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual ~eoStringMutation() {};
|
||||||
|
|
||||||
|
/** @name Methods from eoObject
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
/** Inherited from eoObject
|
||||||
|
@see eoObject
|
||||||
|
*/
|
||||||
|
string className() const {return "eoStringMutation";};
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
typedef EOT::Type Type;
|
||||||
|
#else
|
||||||
|
typedef typename EOT::Type Type;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// applies operator to one gene in the EO. It increments or decrements the value of that gene by one.
|
||||||
|
virtual void applyAt( EOT& _eo, unsigned _i ) const {
|
||||||
|
eoUniform<double> uniform( 0, 1 );
|
||||||
|
if( rate < uniform() ) {
|
||||||
|
_eo.gene(_i) += ( uniform()>=0.5 )? (1) : (-1) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -13,7 +13,28 @@ LDADDS = $(top_builddir)/src/libeo.a
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
noinst_PROGRAMS = t-eobreeder t-eoinclusion t-eoinsertion t-eo t-eofitness t-eoproblem t-eobin t-eolottery t-eo2dVector t-eogeneration t-eoEasyEA t-eoNonUniform t-eoUniform t-eoRandom t-parser
|
noinst_PROGRAMS = t-eobreeder t-eoinclusion t-eoinsertion t-eo t-eofitness t-eoproblem t-eobin t-eolottery t-eo2dVector t-eogeneration t-eoEasyEA t-eoNonUniform t-eoUniform t-eoRandom t-parser t-eoESFull t-eoESOps t-eoAtomOps
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
t_eoAtomOps_SOURCES = t-eoAtomOps.cpp
|
||||||
|
t_eoAtomOps_DEPENDENCIES = $(DEPS)
|
||||||
|
t_eoAtomOps_LDFLAGS = -lm
|
||||||
|
t_eoAtomOps_LDADD = $(LDADDS)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
t_eoESOps_SOURCES = t-eoESOps.cpp
|
||||||
|
t_eoESOps_DEPENDENCIES = $(DEPS)
|
||||||
|
t_eoESOps_LDFLAGS = -lm
|
||||||
|
t_eoESOps_LDADD = $(LDADDS)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
t_eoESFull_SOURCES = t-eoESFull.cpp real_value.h
|
||||||
|
t_eoESFull_DEPENDENCIES = $(DEPS)
|
||||||
|
t_eoESFull_LDFLAGS = -lm
|
||||||
|
t_eoESFull_LDADD = $(LDADDS)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
|
@ -49,9 +49,10 @@ AUTOMAKE = @AUTOMAKE@
|
||||||
AUTOHEADER = @AUTOHEADER@
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_STRIP_FLAG =
|
||||||
transform = @program_transform_name@
|
transform = @program_transform_name@
|
||||||
|
|
||||||
NORMAL_INSTALL = :
|
NORMAL_INSTALL = :
|
||||||
|
|
@ -86,7 +87,28 @@ LDADDS = $(top_builddir)/src/libeo.a
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
noinst_PROGRAMS = t-eobreeder t-eoinclusion t-eoinsertion t-eo t-eofitness t-eoproblem t-eobin t-eolottery t-eo2dVector t-eogeneration t-eoEasyEA t-eoNonUniform t-eoUniform t-eoRandom t-parser
|
noinst_PROGRAMS = t-eobreeder t-eoinclusion t-eoinsertion t-eo t-eofitness t-eoproblem t-eobin t-eolottery t-eo2dVector t-eogeneration t-eoEasyEA t-eoNonUniform t-eoUniform t-eoRandom t-parser t-eoESFull t-eoESOps t-eoAtomOps
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
t_eoAtomOps_SOURCES = t-eoAtomOps.cpp
|
||||||
|
t_eoAtomOps_DEPENDENCIES = $(DEPS)
|
||||||
|
t_eoAtomOps_LDFLAGS = -lm
|
||||||
|
t_eoAtomOps_LDADD = $(LDADDS)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
t_eoESOps_SOURCES = t-eoESOps.cpp
|
||||||
|
t_eoESOps_DEPENDENCIES = $(DEPS)
|
||||||
|
t_eoESOps_LDFLAGS = -lm
|
||||||
|
t_eoESOps_LDADD = $(LDADDS)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
t_eoESFull_SOURCES = t-eoESFull.cpp real_value.h
|
||||||
|
t_eoESFull_DEPENDENCIES = $(DEPS)
|
||||||
|
t_eoESFull_LDFLAGS = -lm
|
||||||
|
t_eoESFull_LDADD = $(LDADDS)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
@ -216,6 +238,9 @@ t_eoNonUniform_OBJECTS = t-eoNonUniform.o
|
||||||
t_eoUniform_OBJECTS = t-eoUniform.o
|
t_eoUniform_OBJECTS = t-eoUniform.o
|
||||||
t_eoRandom_OBJECTS = t-eoRandom.o
|
t_eoRandom_OBJECTS = t-eoRandom.o
|
||||||
t_parser_OBJECTS = t-parser.o
|
t_parser_OBJECTS = t-parser.o
|
||||||
|
t_eoESFull_OBJECTS = t-eoESFull.o
|
||||||
|
t_eoESOps_OBJECTS = t-eoESOps.o
|
||||||
|
t_eoAtomOps_OBJECTS = t-eoAtomOps.o
|
||||||
CXXFLAGS = @CXXFLAGS@
|
CXXFLAGS = @CXXFLAGS@
|
||||||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||||
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||||
|
|
@ -233,21 +258,16 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
TAR = gtar
|
TAR = gtar
|
||||||
GZIP_ENV = --best
|
GZIP_ENV = --best
|
||||||
DEP_FILES = .deps/t-eo.P .deps/t-eo2dVector.P .deps/t-eoEasyEA.P \
|
SOURCES = $(t_eobreeder_SOURCES) $(t_eoinclusion_SOURCES) $(t_eoinsertion_SOURCES) $(t_eo_SOURCES) $(t_eofitness_SOURCES) $(t_eoproblem_SOURCES) $(t_eobin_SOURCES) $(t_eolottery_SOURCES) $(t_eo2dVector_SOURCES) $(t_eogeneration_SOURCES) $(t_eoEasyEA_SOURCES) $(t_eoNonUniform_SOURCES) $(t_eoUniform_SOURCES) $(t_eoRandom_SOURCES) $(t_parser_SOURCES) $(t_eoESFull_SOURCES) $(t_eoESOps_SOURCES) $(t_eoAtomOps_SOURCES)
|
||||||
.deps/t-eoNonUniform.P .deps/t-eoRandom.P .deps/t-eoUniform.P \
|
OBJECTS = $(t_eobreeder_OBJECTS) $(t_eoinclusion_OBJECTS) $(t_eoinsertion_OBJECTS) $(t_eo_OBJECTS) $(t_eofitness_OBJECTS) $(t_eoproblem_OBJECTS) $(t_eobin_OBJECTS) $(t_eolottery_OBJECTS) $(t_eo2dVector_OBJECTS) $(t_eogeneration_OBJECTS) $(t_eoEasyEA_OBJECTS) $(t_eoNonUniform_OBJECTS) $(t_eoUniform_OBJECTS) $(t_eoRandom_OBJECTS) $(t_parser_OBJECTS) $(t_eoESFull_OBJECTS) $(t_eoESOps_OBJECTS) $(t_eoAtomOps_OBJECTS)
|
||||||
.deps/t-eobin.P .deps/t-eobreeder.P .deps/t-eofitness.P \
|
|
||||||
.deps/t-eogeneration.P .deps/t-eoinclusion.P .deps/t-eoinsertion.P \
|
|
||||||
.deps/t-eolottery.P .deps/t-eoproblem.P .deps/t-parser.P
|
|
||||||
SOURCES = $(t_eobreeder_SOURCES) $(t_eoinclusion_SOURCES) $(t_eoinsertion_SOURCES) $(t_eo_SOURCES) $(t_eofitness_SOURCES) $(t_eoproblem_SOURCES) $(t_eobin_SOURCES) $(t_eolottery_SOURCES) $(t_eo2dVector_SOURCES) $(t_eogeneration_SOURCES) $(t_eoEasyEA_SOURCES) $(t_eoNonUniform_SOURCES) $(t_eoUniform_SOURCES) $(t_eoRandom_SOURCES) $(t_parser_SOURCES)
|
|
||||||
OBJECTS = $(t_eobreeder_OBJECTS) $(t_eoinclusion_OBJECTS) $(t_eoinsertion_OBJECTS) $(t_eo_OBJECTS) $(t_eofitness_OBJECTS) $(t_eoproblem_OBJECTS) $(t_eobin_OBJECTS) $(t_eolottery_OBJECTS) $(t_eo2dVector_OBJECTS) $(t_eogeneration_OBJECTS) $(t_eoEasyEA_OBJECTS) $(t_eoNonUniform_OBJECTS) $(t_eoUniform_OBJECTS) $(t_eoRandom_OBJECTS) $(t_parser_OBJECTS)
|
|
||||||
|
|
||||||
all: all-redirect
|
all: all-redirect
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .S .c .cc .cpp .lo .o .s
|
.SUFFIXES: .S .c .cc .cpp .lo .o .s
|
||||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps test/Makefile
|
||||||
|
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
cd $(top_builddir) \
|
cd $(top_builddir) \
|
||||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
|
@ -261,6 +281,9 @@ distclean-noinstPROGRAMS:
|
||||||
|
|
||||||
maintainer-clean-noinstPROGRAMS:
|
maintainer-clean-noinstPROGRAMS:
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
.s.o:
|
.s.o:
|
||||||
$(COMPILE) -c $<
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
|
@ -277,6 +300,9 @@ distclean-compile:
|
||||||
|
|
||||||
maintainer-clean-compile:
|
maintainer-clean-compile:
|
||||||
|
|
||||||
|
.c.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
.s.lo:
|
.s.lo:
|
||||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
|
@ -352,6 +378,18 @@ t-eoRandom: $(t_eoRandom_OBJECTS) $(t_eoRandom_DEPENDENCIES)
|
||||||
t-parser: $(t_parser_OBJECTS) $(t_parser_DEPENDENCIES)
|
t-parser: $(t_parser_OBJECTS) $(t_parser_DEPENDENCIES)
|
||||||
@rm -f t-parser
|
@rm -f t-parser
|
||||||
$(CXXLINK) $(t_parser_LDFLAGS) $(t_parser_OBJECTS) $(t_parser_LDADD) $(LIBS)
|
$(CXXLINK) $(t_parser_LDFLAGS) $(t_parser_OBJECTS) $(t_parser_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
t-eoESFull: $(t_eoESFull_OBJECTS) $(t_eoESFull_DEPENDENCIES)
|
||||||
|
@rm -f t-eoESFull
|
||||||
|
$(CXXLINK) $(t_eoESFull_LDFLAGS) $(t_eoESFull_OBJECTS) $(t_eoESFull_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
t-eoESOps: $(t_eoESOps_OBJECTS) $(t_eoESOps_DEPENDENCIES)
|
||||||
|
@rm -f t-eoESOps
|
||||||
|
$(CXXLINK) $(t_eoESOps_LDFLAGS) $(t_eoESOps_OBJECTS) $(t_eoESOps_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
t-eoAtomOps: $(t_eoAtomOps_OBJECTS) $(t_eoAtomOps_DEPENDENCIES)
|
||||||
|
@rm -f t-eoAtomOps
|
||||||
|
$(CXXLINK) $(t_eoAtomOps_LDFLAGS) $(t_eoAtomOps_OBJECTS) $(t_eoAtomOps_LDADD) $(LIBS)
|
||||||
.cc.o:
|
.cc.o:
|
||||||
$(CXXCOMPILE) -c $<
|
$(CXXCOMPILE) -c $<
|
||||||
.cc.lo:
|
.cc.lo:
|
||||||
|
|
@ -395,91 +433,16 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||||
subdir = test
|
subdir = test
|
||||||
|
|
||||||
distdir: $(DISTFILES)
|
distdir: $(DISTFILES)
|
||||||
here=`cd $(top_builddir) && pwd`; \
|
|
||||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
|
||||||
distdir=`cd $(distdir) && pwd`; \
|
|
||||||
cd $(top_srcdir) \
|
|
||||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu test/Makefile
|
|
||||||
@for file in $(DISTFILES); do \
|
@for file in $(DISTFILES); do \
|
||||||
d=$(srcdir); \
|
d=$(srcdir); \
|
||||||
if test -d $$d/$$file; then \
|
if test -d $$d/$$file; then \
|
||||||
cp -pr $$/$$file $(distdir)/$$file; \
|
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||||
else \
|
else \
|
||||||
test -f $(distdir)/$$file \
|
test -f $(distdir)/$$file \
|
||||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
|
||||||
|
|
||||||
-include $(DEP_FILES)
|
|
||||||
|
|
||||||
mostlyclean-depend:
|
|
||||||
|
|
||||||
clean-depend:
|
|
||||||
|
|
||||||
distclean-depend:
|
|
||||||
-rm -rf .deps
|
|
||||||
|
|
||||||
maintainer-clean-depend:
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
@echo '$(COMPILE) -c $<'; \
|
|
||||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
|
||||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
|
||||||
tr ' ' '\012' < .deps/$(*F).pp \
|
|
||||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
|
||||||
>> .deps/$(*F).P; \
|
|
||||||
rm .deps/$(*F).pp
|
|
||||||
|
|
||||||
%.lo: %.c
|
|
||||||
@echo '$(LTCOMPILE) -c $<'; \
|
|
||||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
|
||||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
|
||||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
|
||||||
tr ' ' '\012' < .deps/$(*F).pp \
|
|
||||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
|
||||||
>> .deps/$(*F).P; \
|
|
||||||
rm -f .deps/$(*F).pp
|
|
||||||
|
|
||||||
%.o: %.cc
|
|
||||||
@echo '$(CXXCOMPILE) -c $<'; \
|
|
||||||
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
|
||||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
|
||||||
tr ' ' '\012' < .deps/$(*F).pp \
|
|
||||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
|
||||||
>> .deps/$(*F).P; \
|
|
||||||
rm .deps/$(*F).pp
|
|
||||||
|
|
||||||
%.lo: %.cc
|
|
||||||
@echo '$(LTCXXCOMPILE) -c $<'; \
|
|
||||||
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
|
||||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
|
||||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
|
||||||
tr ' ' '\012' < .deps/$(*F).pp \
|
|
||||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
|
||||||
>> .deps/$(*F).P; \
|
|
||||||
rm -f .deps/$(*F).pp
|
|
||||||
|
|
||||||
%.o: %.cpp
|
|
||||||
@echo '$(CXXCOMPILE) -c $<'; \
|
|
||||||
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
|
||||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
|
||||||
tr ' ' '\012' < .deps/$(*F).pp \
|
|
||||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
|
||||||
>> .deps/$(*F).P; \
|
|
||||||
rm .deps/$(*F).pp
|
|
||||||
|
|
||||||
%.lo: %.cpp
|
|
||||||
@echo '$(LTCXXCOMPILE) -c $<'; \
|
|
||||||
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
|
||||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
|
||||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
|
||||||
tr ' ' '\012' < .deps/$(*F).pp \
|
|
||||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
|
||||||
>> .deps/$(*F).P; \
|
|
||||||
rm -f .deps/$(*F).pp
|
|
||||||
info-am:
|
info-am:
|
||||||
info: info-am
|
info: info-am
|
||||||
dvi-am:
|
dvi-am:
|
||||||
|
|
@ -502,7 +465,7 @@ uninstall: uninstall-am
|
||||||
all-am: Makefile $(PROGRAMS)
|
all-am: Makefile $(PROGRAMS)
|
||||||
all-redirect: all-am
|
all-redirect: all-am
|
||||||
install-strip:
|
install-strip:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
|
||||||
installdirs:
|
installdirs:
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -516,27 +479,27 @@ distclean-generic:
|
||||||
|
|
||||||
maintainer-clean-generic:
|
maintainer-clean-generic:
|
||||||
mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \
|
mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \
|
||||||
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
mostlyclean-libtool mostlyclean-tags \
|
||||||
mostlyclean-generic
|
mostlyclean-generic
|
||||||
|
|
||||||
mostlyclean: mostlyclean-am
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
|
clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
|
||||||
clean-depend clean-generic mostlyclean-am
|
clean-generic mostlyclean-am
|
||||||
|
|
||||||
clean: clean-am
|
clean: clean-am
|
||||||
|
|
||||||
distclean-am: distclean-noinstPROGRAMS distclean-compile \
|
distclean-am: distclean-noinstPROGRAMS distclean-compile \
|
||||||
distclean-libtool distclean-tags distclean-depend \
|
distclean-libtool distclean-tags distclean-generic \
|
||||||
distclean-generic clean-am
|
clean-am
|
||||||
-rm -f libtool
|
-rm -f libtool
|
||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
|
|
||||||
maintainer-clean-am: maintainer-clean-noinstPROGRAMS \
|
maintainer-clean-am: maintainer-clean-noinstPROGRAMS \
|
||||||
maintainer-clean-compile maintainer-clean-libtool \
|
maintainer-clean-compile maintainer-clean-libtool \
|
||||||
maintainer-clean-tags maintainer-clean-depend \
|
maintainer-clean-tags maintainer-clean-generic \
|
||||||
maintainer-clean-generic distclean-am
|
distclean-am
|
||||||
@echo "This command is intended for maintainers to use;"
|
@echo "This command is intended for maintainers to use;"
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
|
||||||
|
|
@ -547,14 +510,12 @@ clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
|
||||||
mostlyclean-compile distclean-compile clean-compile \
|
mostlyclean-compile distclean-compile clean-compile \
|
||||||
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
||||||
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
|
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
|
||||||
distclean-tags clean-tags maintainer-clean-tags distdir \
|
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||||
mostlyclean-depend distclean-depend clean-depend \
|
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||||
maintainer-clean-depend info-am info dvi-am dvi check check-am \
|
install-exec install-data-am install-data install-am install \
|
||||||
installcheck-am installcheck install-exec-am install-exec \
|
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||||
install-data-am install-data install-am install uninstall-am uninstall \
|
mostlyclean-generic distclean-generic clean-generic \
|
||||||
all-redirect all-am all installdirs mostlyclean-generic \
|
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
|
||||||
mostlyclean distclean maintainer-clean
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
||||||
23
eo/test/real_value.h
Normal file
23
eo/test/real_value.h
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include <eoESFullChrom.h>
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
typedef vector<double> Vec;
|
||||||
|
|
||||||
|
/** Just a simple function that takes an eoVector<float> and sets the fitnes
|
||||||
|
to -sphere (we'll see later how to minimize rather than maximize!)
|
||||||
|
@param _ind A floatingpoint vector
|
||||||
|
*/
|
||||||
|
float the_real_value(Vec& _ind)
|
||||||
|
{
|
||||||
|
double sum = 0; /* compute in double format, even if return a float */
|
||||||
|
for (unsigned i = 0; i < _ind.size(); i++)
|
||||||
|
sum += _ind[i] * _ind[i];
|
||||||
|
return -sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef eoESFullChrom<float> Ind;
|
||||||
|
|
||||||
|
void real_value(Ind & _ind) {
|
||||||
|
_ind.fitness( the_real_value(_ind) );
|
||||||
|
}
|
||||||
33
eo/test/t-eoAtomOps.cpp
Normal file
33
eo/test/t-eoAtomOps.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
// Program to test several EO-ES features
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4786)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
// Operators we are going to test
|
||||||
|
#include <eoAtomCreep.h>
|
||||||
|
#include <eoAtomBitFlip.h>
|
||||||
|
#include <eoAtomRandom.h>
|
||||||
|
#include <eoAtomMutation.h>
|
||||||
|
|
||||||
|
// Several EOs
|
||||||
|
#include <eoString.h>
|
||||||
|
|
||||||
|
main(int argc, char *argv[]) {
|
||||||
|
eoString<float> aString("123456");
|
||||||
|
eoAtomCreep<char> creeper;
|
||||||
|
eoAtomMutation< eoString<float> > mutator( creeper, 0.5 );
|
||||||
|
|
||||||
|
cout << "Before aString " << aString;
|
||||||
|
mutator( aString);
|
||||||
|
cout << " after mutator " << aString;
|
||||||
|
|
||||||
|
return 0; // to avoid VC++ complaints
|
||||||
|
}
|
||||||
|
|
||||||
107
eo/test/t-eoESFull.cpp
Normal file
107
eo/test/t-eoESFull.cpp
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
// Program to test several EO-ES features
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4786)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
// general
|
||||||
|
#include <eoParser.h> // though contained in all others!
|
||||||
|
// evolution specific
|
||||||
|
#include <eoEvalFuncPtr.h>
|
||||||
|
//#include <eoSequentialOpHolder.h>
|
||||||
|
//#include <eoFullEA.h>
|
||||||
|
// representation specific
|
||||||
|
|
||||||
|
#include <eoESFullChrom.h> // though contained in following
|
||||||
|
//#include <eoESReco.h>
|
||||||
|
//#include <eoESMut.h>
|
||||||
|
//#include <eoESRandomize.h>
|
||||||
|
// this fitness
|
||||||
|
#include "real_value.h" // the sphere fitness
|
||||||
|
|
||||||
|
// Now the main
|
||||||
|
///////////////
|
||||||
|
typedef eoESFullChrom<float> Ind;
|
||||||
|
|
||||||
|
main(int argc, char *argv[]) {
|
||||||
|
// unsigned mu, lambda;
|
||||||
|
// bool comma;
|
||||||
|
|
||||||
|
// Create the command-line parser
|
||||||
|
Parser parser( argc, argv, "Basic EA for vector<float> with adaptive mutations");
|
||||||
|
|
||||||
|
//reproducible random seed - thanks, Maarten
|
||||||
|
InitRandom(parser);
|
||||||
|
|
||||||
|
// a first Ind, reading its parameters from the parser
|
||||||
|
// will be used later to inialize the whole population
|
||||||
|
Ind FirstEO(parser);
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
// here we should call some parser-based constructor,
|
||||||
|
// as many evaluation function need parameters
|
||||||
|
// and also have some preliminary stuffs to do
|
||||||
|
eoEvalFuncPtr<Ind> eval( real_value );
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Evolution and population parameters
|
||||||
|
eoScheme<Ind> the_scheme(parser);
|
||||||
|
|
||||||
|
// recombination and mutation operators, reading their parameters from the parser
|
||||||
|
eoESReco<float> MyReco(parser, FirstEO);
|
||||||
|
eoESMutate<float> MyMut(parser, FirstEO);
|
||||||
|
|
||||||
|
// termination conditions read by the parser
|
||||||
|
eoTermVector<Ind> the_terms(parser);
|
||||||
|
|
||||||
|
// Initialization of the population
|
||||||
|
// shoudl be called using the parser, in case you want to read from file(s)
|
||||||
|
eoESRandomize<float> randomize; // an eoESInd randomnizer
|
||||||
|
eoPop<Ind> pop(the_scheme.PopSize(), FirstEO, randomize);
|
||||||
|
// eval(pop); // shoudl we call it from inside the constructor???
|
||||||
|
|
||||||
|
// ALL parmeters have been read: write them out
|
||||||
|
// Writing the parameters on arv[0].status
|
||||||
|
// but of course this can be modified - see the example parser.cpp
|
||||||
|
parser.outputParam();
|
||||||
|
// except the help parameter???
|
||||||
|
if( parser.getBool("-h" , "--help" , "Shows this help")) {
|
||||||
|
parser.printHelp();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned i, iind;
|
||||||
|
|
||||||
|
|
||||||
|
cout << "Initial population: \n" << endl;
|
||||||
|
for (i = 0; i < pop.size(); ++i) {
|
||||||
|
eval(pop[i]);
|
||||||
|
cout << pop[i].fitness() << "\t" << pop[i] << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the Operators
|
||||||
|
eoSequentialOpHolder <Ind> seqholder;
|
||||||
|
// seqholder.addOp(MyReco, 1.0);
|
||||||
|
seqholder.addOp(MyMut, 1.0);
|
||||||
|
|
||||||
|
// One generation
|
||||||
|
eoEvolStep<Ind> evol_scheme(the_scheme, seqholder, eval);
|
||||||
|
|
||||||
|
// the algorithm:
|
||||||
|
eoFullEA<Ind> ea(evol_scheme, the_terms);
|
||||||
|
|
||||||
|
ea(pop);
|
||||||
|
|
||||||
|
cout << "Final population: \n" << endl;
|
||||||
|
for (i = 0; i < pop.size(); ++i)
|
||||||
|
cout << pop[i].fitness() << "\t" << pop[i] << endl;
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
116
eo/test/t-eoESOps.cpp
Normal file
116
eo/test/t-eoESOps.cpp
Normal file
|
|
@ -0,0 +1,116 @@
|
||||||
|
// Program to test several EO-ES features
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4786)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
// general
|
||||||
|
#include <eoParser.h> // though contained in all others!
|
||||||
|
// evolution specific
|
||||||
|
#include <eoEvalFuncPtr.h>
|
||||||
|
//#include <eoSequentialOpHolder.h>
|
||||||
|
//#include <eoFullEA.h>
|
||||||
|
// representation specific
|
||||||
|
|
||||||
|
#include <eoESFullChrom.h> // though contained in following
|
||||||
|
//#include <eoESReco.h>
|
||||||
|
#include <eoESFullMut.h>
|
||||||
|
//#include <eoESRandomize.h>
|
||||||
|
// this fitness
|
||||||
|
#include "real_value.h" // the sphere fitness
|
||||||
|
|
||||||
|
// Now the main
|
||||||
|
///////////////
|
||||||
|
typedef eoESFullChrom<float> Ind;
|
||||||
|
|
||||||
|
main(int argc, char *argv[]) {
|
||||||
|
unsigned mu, lambda;
|
||||||
|
bool comma;
|
||||||
|
|
||||||
|
// Create the command-line parser
|
||||||
|
Parser parser( argc, argv, "Basic EA for vector<float> with adaptive mutations");
|
||||||
|
|
||||||
|
//reproducible random seed - thanks, Maarten
|
||||||
|
InitRandom(parser);
|
||||||
|
|
||||||
|
// a first Ind, reading its parameters from the parser
|
||||||
|
// will be used later to inialize the whole population
|
||||||
|
Ind FirstEO(parser);
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
// here we should call some parser-based constructor,
|
||||||
|
// as many evaluation function need parameters
|
||||||
|
// and also have some preliminary stuffs to do
|
||||||
|
eoEvalFuncPtr<Ind> eval( real_value );
|
||||||
|
|
||||||
|
// recombination and mutation operators, reading their parameters from the parser
|
||||||
|
eoESMutate<float> MyMut(parser,
|
||||||
|
FirstEO.StdDevLength(), FirstEO.size(),
|
||||||
|
FirstEO.CorCffLength() );
|
||||||
|
|
||||||
|
cout << "First EO " << FirstEO << endl;
|
||||||
|
MyMut(FirstEO);
|
||||||
|
cout << "First EO mutated" << FirstEO << endl;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Evolution and population parameters
|
||||||
|
eoScheme<Ind> the_scheme(parser);
|
||||||
|
|
||||||
|
// recombination and mutation operators, reading their parameters from the parser
|
||||||
|
eoESReco<float> MyReco(parser, FirstEO);
|
||||||
|
eoESMutate<float> MyMut(parser, FirstEO);
|
||||||
|
|
||||||
|
// termination conditions read by the parser
|
||||||
|
eoTermVector<Ind> the_terms(parser);
|
||||||
|
|
||||||
|
// Initialization of the population
|
||||||
|
// shoudl be called using the parser, in case you want to read from file(s)
|
||||||
|
eoESRandomize<float> randomize; // an eoESInd randomnizer
|
||||||
|
eoPop<Ind> pop(the_scheme.PopSize(), FirstEO, randomize);
|
||||||
|
// eval(pop); // shoudl we call it from inside the constructor???
|
||||||
|
|
||||||
|
// ALL parmeters have been read: write them out
|
||||||
|
// Writing the parameters on arv[0].status
|
||||||
|
// but of course this can be modified - see the example parser.cpp
|
||||||
|
parser.outputParam();
|
||||||
|
// except the help parameter???
|
||||||
|
if( parser.getBool("-h" , "--help" , "Shows this help")) {
|
||||||
|
parser.printHelp();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned i, iind;
|
||||||
|
|
||||||
|
|
||||||
|
cout << "Initial population: \n" << endl;
|
||||||
|
for (i = 0; i < pop.size(); ++i) {
|
||||||
|
eval(pop[i]);
|
||||||
|
cout << pop[i].fitness() << "\t" << pop[i] << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the Operators
|
||||||
|
eoSequentialOpHolder <Ind> seqholder;
|
||||||
|
// seqholder.addOp(MyReco, 1.0);
|
||||||
|
seqholder.addOp(MyMut, 1.0);
|
||||||
|
|
||||||
|
// One generation
|
||||||
|
eoEvolStep<Ind> evol_scheme(the_scheme, seqholder, eval);
|
||||||
|
|
||||||
|
// the algorithm:
|
||||||
|
eoFullEA<Ind> ea(evol_scheme, the_terms);
|
||||||
|
|
||||||
|
ea(pop);
|
||||||
|
|
||||||
|
cout << "Final population: \n" << endl;
|
||||||
|
for (i = 0; i < pop.size(); ++i)
|
||||||
|
cout << pop[i].fitness() << "\t" << pop[i] << endl;
|
||||||
|
return 0;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -23,6 +23,7 @@ main() {
|
||||||
e1() << "\t" << e2() << "\t" << e3() << endl;
|
e1() << "\t" << e2() << "\t" << e3() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0; // to avoid VC++ complaints
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -76,38 +76,6 @@ void getParams( Parser & parser,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Uses the parser and returns param values
|
|
||||||
void InitRandom( Parser & parser) {
|
|
||||||
unsigned long _seed;
|
|
||||||
try {
|
|
||||||
_seed = parser.getUnsignedLong("-S", "--seed", "0", "Seed for Random number generator" );
|
|
||||||
}
|
|
||||||
catch (UException & e)
|
|
||||||
{
|
|
||||||
cout << e.what() << endl;
|
|
||||||
parser.printHelp();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
catch (exception & e)
|
|
||||||
{
|
|
||||||
cout << e.what() << endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (_seed == 0) { // use clock to get a "random" seed
|
|
||||||
struct timeval tval;
|
|
||||||
struct timezone tzp;
|
|
||||||
|
|
||||||
gettimeofday (&tval, &tzp); // time since midnight January 1, 1970.
|
|
||||||
_seed = tval.tv_usec ; // micro seconds
|
|
||||||
char s[32];
|
|
||||||
sprintf(s,"%ld", _seed);
|
|
||||||
parser.setParamValue("--seed", s); // so it will be printed out in the status file, and canbe later re-used to re-run EXACTLY the same run
|
|
||||||
}
|
|
||||||
rng.reseed(_seed);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main( int argc, char* argv[]) {
|
int main( int argc, char* argv[]) {
|
||||||
|
|
||||||
unsigned in;
|
unsigned in;
|
||||||
|
|
|
||||||
101
eo/win/atomops.dsp
Normal file
101
eo/win/atomops.dsp
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
# Microsoft Developer Studio Project File - Name="atomops" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=atomops - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "atomops.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "atomops.mak" CFG="atomops - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "atomops - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "atomops - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "atomops - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD BASE RSC /l 0xc0a /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0xc0a /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "atomops - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "atomops___Win32_Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "atomops___Win32_Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "atomops___Win32_Debug"
|
||||||
|
# PROP Intermediate_Dir "atomops___Win32_Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0xc0a /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0xc0a /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 eo.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "atomops - Win32 Release"
|
||||||
|
# Name "atomops - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE="..\test\t-eoAtomOps.cpp"
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
|
|
@ -63,8 +63,8 @@ LIB32=link.exe -lib
|
||||||
# PROP Output_Dir "eo___Win32_Debug"
|
# PROP Output_Dir "eo___Win32_Debug"
|
||||||
# PROP Intermediate_Dir "eo___Win32_Debug"
|
# PROP Intermediate_Dir "eo___Win32_Debug"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
# ADD BASE RSC /l 0xc0a /d "_DEBUG"
|
# ADD BASE RSC /l 0xc0a /d "_DEBUG"
|
||||||
# ADD RSC /l 0xc0a /d "_DEBUG"
|
# ADD RSC /l 0xc0a /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
@ -95,46 +95,6 @@ SOURCE=..\src\eoPrintable.cpp
|
||||||
# Begin Group "Header Files"
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\EO.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eo1d.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eoFitness.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eoNegExp.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eoNormal.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eoObject.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eoProblem.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eoRnd.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eoUniform.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\eoVector.h
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
# End Group
|
||||||
# End Target
|
# End Target
|
||||||
# End Project
|
# End Project
|
||||||
|
|
|
||||||
74
eo/win/eo.dsw
Normal file
74
eo/win/eo.dsw
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "atomops"=".\atomops.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "eo"=".\eo.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name random
|
||||||
|
End Project Dependency
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name atomops
|
||||||
|
End Project Dependency
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name esfull
|
||||||
|
End Project Dependency
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "esfull"=".\esfull.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "random"=".\random.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
101
eo/win/esfull.dsp
Normal file
101
eo/win/esfull.dsp
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
# Microsoft Developer Studio Project File - Name="esfull" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=esfull - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "esfull.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "esfull.mak" CFG="esfull - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "esfull - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "esfull - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "esfull - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD BASE RSC /l 0xc0a /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0xc0a /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "esfull - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "esfull___Win32_Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "esfull___Win32_Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "esfull___Win32_Debug"
|
||||||
|
# PROP Intermediate_Dir "esfull___Win32_Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0xc0a /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0xc0a /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 eo.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "esfull - Win32 Release"
|
||||||
|
# Name "esfull - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE="..\test\t-eoESFull.cpp"
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
101
eo/win/random.dsp
Normal file
101
eo/win/random.dsp
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
# Microsoft Developer Studio Project File - Name="random" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=random - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "random.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "random.mak" CFG="random - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "random - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "random - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "random - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD BASE RSC /l 0xc0a /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0xc0a /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "random - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "random___Win32_Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "random___Win32_Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "random___Win32_Debug"
|
||||||
|
# PROP Intermediate_Dir "random___Win32_Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0xc0a /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0xc0a /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 eo.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "random - Win32 Release"
|
||||||
|
# Name "random - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE="..\test\t-eoRandom.cpp"
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
Reference in a new issue