From 5fe751080749f42d251ef64e777a709bad20d502 Mon Sep 17 00:00:00 2001 From: gustavo Date: Thu, 30 Mar 2000 17:11:20 +0000 Subject: [PATCH] fixing makefiles --- eo/configure.in | 2 +- eo/src/EO.h | 4 +- eo/src/eoObject.h | 2 +- eo/src/eoOp.h | 323 ++++--------------------- eo/src/eoPersistent.h | 2 +- eo/src/es/Makefile.am | 8 + eo/src/ga/Makefile.am | 8 + eo/src/gp/Makefile.am | 8 + eo/src/obsolete/Makefile.am | 13 + eo/src/obsolete/eoParserUtils.h | 4 +- eo/src/other/Makefile.am | 13 + eo/src/other/eoExternalEO.h | 46 ++-- eo/src/other/eoExternalOpFunctions.cpp | 10 +- eo/src/utils/Makefile.am | 13 + eo/src/utils/eoRNG.h | 4 +- 15 files changed, 153 insertions(+), 307 deletions(-) create mode 100644 eo/src/es/Makefile.am create mode 100644 eo/src/ga/Makefile.am create mode 100644 eo/src/gp/Makefile.am create mode 100644 eo/src/obsolete/Makefile.am create mode 100644 eo/src/other/Makefile.am create mode 100644 eo/src/utils/Makefile.am diff --git a/eo/configure.in b/eo/configure.in index 01614d93..49ca3bc1 100644 --- a/eo/configure.in +++ b/eo/configure.in @@ -5,7 +5,7 @@ AM_INIT_AUTOMAKE(eo) AC_PROG_CXX -CXXFLAGS = -Wall -g +#CXXFLAGS = -Wall -g AM_PROG_LIBTOOL diff --git a/eo/src/EO.h b/eo/src/EO.h index ec9d3dcc..91992f1e 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -28,8 +28,8 @@ //----------------------------------------------------------------------------- #include // runtime_error -#include // -#include // +#include "eoObject.h" // +#include "eoPersistent.h" // //----------------------------------------------------------------------------- /** EO is a base class for evolvable objects, that is, the subjects of diff --git a/eo/src/eoObject.h b/eo/src/eoObject.h index c46c8855..3ceb2590 100644 --- a/eo/src/eoObject.h +++ b/eo/src/eoObject.h @@ -27,7 +27,7 @@ //----------------------------------------------------------------------------- -#include // For limits definition +#include "utils/eoData.h" // For limits definition #include // istream, ostream #include // string diff --git a/eo/src/eoOp.h b/eo/src/eoOp.h index 9338b12a..e27051e1 100644 --- a/eo/src/eoOp.h +++ b/eo/src/eoOp.h @@ -1,397 +1,207 @@ // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - - - //----------------------------------------------------------------------------- - // eoOp.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 _eoOp_H - #define _eoOp_H - - #include - #include - - /** @name Genetic operators - - -What is a genetic algorithm without genetic operators? There is a genetic operator hierarchy, with - -eoOp as father and eoMonOp (monary or unary operator) and eoBinOp and eoQuadraticOp (binary operators) - -as siblings). Nobody should subclass eoOp, you should subclass eoGeneralOp, eoBinOp, eoQuadraticOp or eoMonOp, - -those are the ones actually used here.\\ - - - -#eoOp#s are only printable objects, so if you want to build them from a file, it has to - -be done in another class, namely factories. Each hierarchy of #eoOp#s should have its own - -factory, which know how to build them from a description in a file. +What is a genetic algorithm without genetic operators? There is a genetic operator hierarchy, with eoOp as father and eoMonOp (monary or unary operator) and eoBinOp and eoQuadraticOp (binary operators) as siblings). Nobody should subclass eoOp, you should subclass eoGeneralOp, eoBinOp, eoQuadraticOp or eoMonOp, those are the ones actually used here. \\#eoOp#s are only printable objects, so if you want to build them from a file, it has to be done in another class, namely factories. Each hierarchy of #eoOp#s should have its own factory, which know how to build them from a description in a file. @author GeNeura Team - @version 0.1 - @see eoOpFactory - */ - - - /** Abstract data types for EO operators. - - * Genetic operators act on chromosomes, changing them. The type to instantiate them should - - * be an eoObject, but in any case, they are type-specific; each kind of evolvable object - - * can have its own operators - + * Genetic operators act on chromosomes, changing them. The type to + * instantiate them should be an eoObject, but in any case, they are + * type-specific; each kind of evolvable object can have its own operators */ template class eoOp: public eoObject, public eoPrintable { - public: - - - -//@{ - + //@{ enum OpType { unary = 0, binary = 1, quadratic = 2, general = 3}; - -/// - - + /// /// Ctor - eoOp(OpType _type) - :opType( _type ) {}; - - /// Copy Ctor - eoOp( const eoOp& _eop ) - :opType( _eop.opType ) {}; - - /// Needed virtual destructor - virtual ~eoOp(){}; - - /// getType: number of operands it takes and individuals it produces - OpType getType() const {return opType;}; - - - /** @name Methods from eoObject */ - - //@{ - + /** @name Methods from eoObject */ - + //@{ + /** - * Write object. It's called printOn since it prints the object _on_ a stream. - * @param _os A ostream. - */ - virtual void printOn(ostream& _os) const { - _os << className(); - // _os << arity; - }; - - /** Inherited from eoObject - @see eoObject - */ virtual string className() const {return "eoOp";}; - //@} - - private: /// OpType is the type of the operator: how many operands it takes and how many it produces OpType opType; - - - }; -/** Binary genetic operator: subclasses eoOp, and defines - -basically the operator() with two operands - -*/ +/** Binary genetic operator: subclasses eoOp, and defines basically the + * operator() with two operands + */ template class eoBinOp: public eoOp { - public: - - - /// Ctor - eoBinOp() - :eoOp( binary ) {}; - - /// Copy Ctor - eoBinOp( const eoBinOp& _ebop ) - : eoOp( _ebop ){}; - - /// Dtor - ~eoBinOp () {}; - - /** applies operator, to the object. Modifies only the first operand. - */ - virtual void operator()( EOType& _eo1, const EOType& _eo2 ) const = 0; - - /** @name Methods from eoObject + readFrom and printOn are directly inherited from eoObject + */ + //@{ + /** Inherited from eoObject + @see eoObject + */ + virtual string className() const {return "eoBinOp";}; - readFrom and printOn are directly inherited from eoObject - - */ - - //@{ - - /** Inherited from eoObject - - @see eoObject - - */ - - virtual string className() const {return "eoBinOp";}; - - //@} - - - + //@} }; -/** Quadratic genetic operator: subclasses eoOp, and defines - -basically the operator() with two operands - +/** Quadratic genetic operator: subclasses eoOp, and defines basically the + operator() with two operands */ template class eoQuadraticOp: public eoOp { - public: - - - /// Ctor - eoQuadraticOp() - - :eoOp( eoOp::quadratic ) {}; - - + :eoOp( eoOp::quadratic ) {}; /// Copy Ctor - eoQuadraticOp( const eoQuadraticOp& _ebop ) - : eoOp( _ebop ){}; - - /// Dtor - ~eoQuadraticOp() {}; - - /** applies operator, to the object. Modifies both operands. - */ - virtual void operator()( EOType& _eo1, EOType& _eo2 ) const = 0; - - /** @name Methods from eoObject - - readFrom and printOn are directly inherited from eoObject - - */ - - //@{ - - /** Inherited from eoObject - - @see eoObject - - */ - - virtual string className() const {return "eoBinOp";}; - - //@} - - - + readFrom and printOn are directly inherited from eoObject + */ + + //@{ + /** Inherited from eoObject + @see eoObject + + */ + virtual string className() const {return "eoBinOp";}; + + //@} }; -/** eoMonOp is the monary operator: genetic operator that takes - - only one EO - -*/ +/** eoMonOp is the monary operator: genetic operator that takes only one EO */ template class eoMonOp: public eoOp { - public: - - - /// Ctor - eoMonOp( ) - - : eoOp( eoOp::unary ) {}; - - + : eoOp( eoOp::unary ) {}; /// Copy Ctor - eoMonOp( const eoMonOp& _emop ) - : eoOp( _emop ){}; - - /// Dtor - ~eoMonOp() {}; - - /** applies randomly operator, to the object. If arity is more than 1, - * keeps a copy of the operand in a cache. - */ - virtual void operator()( EOType& _eo1) const = 0; - - /** @name Methods from eoObject + readFrom and printOn are directly inherited from eoObject + */ - readFrom and printOn are directly inherited from eoObject - - */ - - //@{ - - /** Inherited from eoObject - - @see eoObject - - */ - - virtual string className() const {return "eoMonOp";}; - - //@} - + //@{ + /** Inherited from eoObject + @see eoObject + */ + virtual string className() const {return "eoMonOp";}; + //@} }; @@ -403,68 +213,39 @@ template class eoIndiSelector; - template class eoInserter; - /** - * eGeneralOp: General genetic operator; for objects used to transform sets - - of EOs. Nary ("orgy") operators should be derived from this class - -*/ + * of EOs. Nary ("orgy") operators should be derived from this class + */ template class eoGeneralOp: public eoOp - { - public: - - - /// Ctor that honors its superclass - - eoGeneralOp(): eoOp( eoOp::general ) {}; - - + eoGeneralOp(): eoOp( eoOp::general ) {} /// Virtual dtor - - virtual ~eoGeneralOp () {}; - - + virtual ~eoGeneralOp () {} /** Method that really does the stuff. Applies the genetic operator - to a individuals dispensed by an eoIndividualSelector, - - and puts the results in the eoIndividualInserter. - - Any number of inputs can be requested and any number of outputs - - can be produced. - + and puts the results in the eoIndividualInserter. + Any number of inputs can be requested and any number of outputs + can be produced. */ virtual void operator()( eoIndiSelector& _in, - eoInserter& _out) const = 0; - - - virtual string className() const {return "eoGeneralOp";}; - + virtual string className() const {return "eoGeneralOp";} }; - - - - #endif diff --git a/eo/src/eoPersistent.h b/eo/src/eoPersistent.h index f02b4f5d..e10edb93 100644 --- a/eo/src/eoPersistent.h +++ b/eo/src/eoPersistent.h @@ -40,7 +40,7 @@ const unsigned MAXLINELENGTH=1024; #include // para string //----------------------------------------------------------------------------- -#include +#include "eoPrintable.h" using namespace std; diff --git a/eo/src/es/Makefile.am b/eo/src/es/Makefile.am new file mode 100644 index 00000000..baa2c3b3 --- /dev/null +++ b/eo/src/es/Makefile.am @@ -0,0 +1,8 @@ +############################################################################### +## +## Makefile.am for eo/src/es +## +############################################################################### + +libeoincdir = $(includedir)/eo/es +libeoinc_HEADERS = eoESFullChrom.h eoESChrom.h eoESFullMut.h diff --git a/eo/src/ga/Makefile.am b/eo/src/ga/Makefile.am new file mode 100644 index 00000000..558e0644 --- /dev/null +++ b/eo/src/ga/Makefile.am @@ -0,0 +1,8 @@ +############################################################################### +## +## Makefile.am for eo/src/ga +## +############################################################################### + +libeoincdir = $(includedir)/eo/ga +libeoinc_HEADERS = eoBin.h eoBitOp.h eoBitOpFactory.h diff --git a/eo/src/gp/Makefile.am b/eo/src/gp/Makefile.am new file mode 100644 index 00000000..bdbf6a66 --- /dev/null +++ b/eo/src/gp/Makefile.am @@ -0,0 +1,8 @@ +############################################################################### +## +## Makefile.am for eo/src/gp +## +############################################################################### + +libeoincdir = $(includedir)/eo/gp +libeoinc_HEADERS = eoParseTree.h node_pool.h parse_tree.h diff --git a/eo/src/obsolete/Makefile.am b/eo/src/obsolete/Makefile.am new file mode 100644 index 00000000..56fae4df --- /dev/null +++ b/eo/src/obsolete/Makefile.am @@ -0,0 +1,13 @@ +############################################################################### +## +## Makefile.am for eo/src/obsolete +## +############################################################################### + +INCLUDES = -I$(top_builddir)/src + +lib_LIBRARIES = libeoobsolete.a +libeoobsolete_a_SOURCES = eoParserUtils.cpp + +libeoobsoleteincdir = $(includedir)/eo/obsolete +libeoobsoleteinc_HEADERS = eoProblem.h eoParser.h eoParserUtils.h diff --git a/eo/src/obsolete/eoParserUtils.h b/eo/src/obsolete/eoParserUtils.h index 6ee91d50..742c4b58 100644 --- a/eo/src/obsolete/eoParserUtils.h +++ b/eo/src/obsolete/eoParserUtils.h @@ -14,8 +14,8 @@ Modifications.: #ifndef EO_PARSER_UTILS #define EO_PARSER_UTILS -#include -#include +#include "../utils/eoRNG.h" +#include "eoParser.h" /// Reproducible random seed //---------------------------------- diff --git a/eo/src/other/Makefile.am b/eo/src/other/Makefile.am new file mode 100644 index 00000000..e65ba2e2 --- /dev/null +++ b/eo/src/other/Makefile.am @@ -0,0 +1,13 @@ +############################################################################### +## +## Makefile.am for eo/src/other +## +############################################################################### + +INCLUDES = -I$(top_builddir)/src + +lib_LIBRARIES = libeoother.a +libeoother_a_SOURCES = eoExternalOpFunctions.cpp + +libeootherincdir = $(includedir)/eo/other +libeootherinc_HEADERS = eoExternalEO.h eoString.h eoStringMutation.h diff --git a/eo/src/other/eoExternalEO.h b/eo/src/other/eoExternalEO.h index 294b26bd..7efe7786 100644 --- a/eo/src/other/eoExternalEO.h +++ b/eo/src/other/eoExternalEO.h @@ -35,33 +35,33 @@ template class eoExternalEO : public EO, virtual public External { - public : +public : - typedef External Type; + typedef External Type; - eoExternalEO(void) : EO(), Base() {} - eoExternalEO(istream& is) : EO(), Base() { readFrom(is); } + eoExternalEO(void) : EO(), Base() {} + eoExternalEO(istream& is) : EO(), Base() { readFrom(is); } - /** - * Read object.\\ - * @param _is a istream. - * @throw runtime_exception If a valid object can't be read. - */ - virtual void readFrom(istream& _is) - { - EO::readFrom(is); - throw runtime_excpetion("Reading not defined yet"); - } + /** + * Read object.\\ + * @param _is a istream. + * @throw runtime_exception If a valid object can't be read. + */ + virtual void readFrom(istream& _is) + { + EO::readFrom(is); + throw runtime_exception("Reading not defined yet"); + } - /** - * Write object. Called printOn since it prints the object _on_ a stream. - * @param _os A ostream. - */ - virtual void printOn(ostream& _os) const - { - EO::printOn(is); - throw runtime_excpetion("Writing not defined yet"); - } + /** + * Write object. Called printOn since it prints the object _on_ a stream. + * @param _os A ostream. + */ + virtual void printOn(ostream& _os) const + { + EO::printOn(is); + throw runtime_excpetion("Writing not defined yet"); + } }; diff --git a/eo/src/other/eoExternalOpFunctions.cpp b/eo/src/other/eoExternalOpFunctions.cpp index 88f24654..80d59c61 100644 --- a/eo/src/other/eoExternalOpFunctions.cpp +++ b/eo/src/other/eoExternalOpFunctions.cpp @@ -28,9 +28,9 @@ #ifndef eoExternalOpFunc_h #define eoExternalOpFunc_h -#include "eoExternalEO.h" -#include "eoOps.h" -#include "eoRnd.h" +#include +#include +#include template class eoExternalInitFunc @@ -38,4 +38,6 @@ class eoExternalInitFunc public : -}; \ No newline at end of file +}; + +#endif diff --git a/eo/src/utils/Makefile.am b/eo/src/utils/Makefile.am new file mode 100644 index 00000000..294ad82c --- /dev/null +++ b/eo/src/utils/Makefile.am @@ -0,0 +1,13 @@ +############################################################################### +## +## Makefile.am for eo/src/utils +## +############################################################################### + +INCLUDES = -I$(top_builddir)/src + +lib_LIBRARIES = libeoutils.a +libeoutils_a_SOURCES = eoParser.cpp eoRNG.cpp eoState.cpp + +libeoincdir = $(includedir)/eo/utils +libeoinc_HEADERS = compatibility.h eoParam.h eoRNG.h rnd_generators.h eoData.h eoParser.h eoState.h selectors.h diff --git a/eo/src/utils/eoRNG.h b/eo/src/utils/eoRNG.h index 5f2abb78..063e4dbc 100644 --- a/eo/src/utils/eoRNG.h +++ b/eo/src/utils/eoRNG.h @@ -82,8 +82,8 @@ #define EO_RANDOM_NUMBER_GENERATOR -#include -#include +#include "../eoPersistent.h" +#include "../eoObject.h" // TODO: check for various compilers if this is exactly 32 bits // Unfortunately MSVC's preprocessor does not comprehends sizeof()