Changes to eo1d interface and bug fixes

This commit is contained in:
jmerelo 1999-09-20 11:35:01 +00:00
commit 759dba7ea8
47 changed files with 759 additions and 204 deletions

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// EO.h // EO.h
// (c) GeNeura Team 1998 // (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 EO_H #ifndef EO_H

View file

@ -1,6 +1,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eo // eo
// (c) GeNeura Team 1998 // (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 _eo_ #ifndef _eo_
@ -12,6 +29,7 @@
#include <eoObject.h> #include <eoObject.h>
#include <eoPrintable.h> #include <eoPrintable.h>
#include <eoPersistent.h> #include <eoPersistent.h>
#include <eoFitness.h>
#include <EO.h> #include <EO.h>
#include <eoID.h> #include <eoID.h>

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eo1d.h // eo1d.h
// (c) GeNeura Team, 1998 // (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 _EO1D_H #ifndef _EO1D_H
@ -16,7 +33,7 @@
using namespace std; using namespace std;
/** @name EO1d class /** @name eo1d class
* Randomly accesible evolvable object with one dimension, with * Randomly accesible evolvable object with one dimension, with
variable length. variable length.
* Use this if you want to evolve "linear" things, like bitstrings, or * Use this if you want to evolve "linear" things, like bitstrings, or
@ -52,8 +69,9 @@ public:
*/ */
eo1d( unsigned _size, eoRnd<T>& _rndGen, const string& _ID = ""); eo1d( unsigned _size, eoRnd<T>& _rndGen, const string& _ID = "");
/** Ctor from a istream. It just passes the stream to EO. /** Ctor from a istream. It just passes the stream to EO, subclasses should
@param _is the input stream; eo1d just cares about the fitness have to implement this.
@param _is the input stream
*/ */
eo1d( istream& _is): EO<fitnessT>( _is ){}; eo1d( istream& _is): EO<fitnessT>( _is ){};
@ -77,7 +95,7 @@ public:
@return what's inside the gene, with the correct type @return what's inside the gene, with the correct type
@exception out_of_range if _i > size() @exception out_of_range if _i > size()
*/ */
virtual T gene( unsigned _i ) const = 0; virtual T getGene( unsigned _i ) const = 0;
/** Overwrites the gene placed in position _i with a /** Overwrites the gene placed in position _i with a
* new value. This means that the assignment operator * new value. This means that the assignment operator
@ -86,7 +104,7 @@ public:
@return what's inside the gene, with the correct type @return what's inside the gene, with the correct type
@exception out_of_range if _i > size() @exception out_of_range if _i > size()
*/ */
virtual T& gene( unsigned _i ) = 0; virtual void setGene( unsigned _i, const T& _value ) = 0;
/** Inserts a gene, moving the rest to the right. If /** Inserts a gene, moving the rest to the right. If
* _i = length(), it should insert it at the end. * _i = length(), it should insert it at the end.
@ -116,19 +134,21 @@ public:
virtual void readFrom(istream& _s) { virtual void readFrom(istream& _s) {
for ( unsigned i = 0; i < length(); i ++ ) { for ( unsigned i = 0; i < length(); i ++ ) {
_s >> gene( i ); T tmp;
_s >> tmp;
setGene( i, tmp );
} }
// there is no way of distinguishing fitness from the object, so // there is no way of distinguishing fitness from the object, so
// it's skipped // it's skipped
} }
/** Print itself: inherited from eoObject implementation. Declared virtual so that /** Print itself: inherited from eoObject implementation.
it can be reimplemented anywhere. Instance from base classes are processed in Instance from base classes are processed in
base classes, so you don´t have to worry about, for instance, fitness. base classes, so you don´t have to worry about, for instance, fitness.
@param _s the ostream in which things are written*/ @param _s the ostream in which things are written*/
virtual void printOn( ostream& _s ) const{ virtual void printOn( ostream& _s ) const{
for ( unsigned i = 0; i < length(); i ++ ) { for ( unsigned i = 0; i < length(); i ++ ) {
_s << gene( i ) << " "; _s << getGene( i ) << " ";
} }
} }

View file

@ -1,8 +1,26 @@
// eoAged.h
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoAge.h // eoAge.h
// (c) GeNeura Team, 1998 // (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 EOAGED_H #ifndef EOAGED_H

View file

@ -25,20 +25,20 @@ template <class F> class eoBin: public eoVector<bool, F>
* (Default) Constructor. * (Default) Constructor.
* @param size Size of the binary string. * @param size Size of the binary string.
*/ */
eoBin(const unsigned& size = 0, const bool& value = false): eoBin(unsigned size = 0, bool value = false):
eoVector<bool,F>(size, value) {} eoVector<bool,F>(size, value) {}
/** /**
* Constructor. * Constructor.
* @param size Size of the binary string. * @param size Size of the binary string.
*/ */
eoBin(const unsigned& size, const eoRnd<bool>& rnd): eoVector<bool,F>(size) eoBin(unsigned size, const eoRnd<bool>& rnd): eoVector<bool,F>(size)
{ {
generate(begin(), end(), rnd); generate(begin(), end(), rnd);
} }
/// Constructor from istream. /** Constructor from istream.
/// @param is The istream to read from. @param is The istream to read from.*/
eoBin(istream& _is):eoVector<bool,F>(_is){}; eoBin(istream& _is):eoVector<bool,F>(_is){};
/// My class name. /// My class name.

View file

@ -1,8 +1,26 @@
// eoBitOpFactory.h
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoOpFactory.h // eoOpFactory.h
// (c) GeNeura Team, 1998 // (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 _EOBITOPFACTORY_H #ifndef _EOBITOPFACTORY_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoDrawable.h // eoDrawable.h
// (c) GeNeura Team, 1999 // (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 EODRAWABLE_H #ifndef EODRAWABLE_H

View file

@ -1,8 +1,26 @@
// eoDup.h
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoKill.h // eoKill.h
// (c) GeNeura Team, 1998 // (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 _EODUP_h #ifndef _EODUP_h

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoESChrom.h // eoESChrom.h
// (c) GeNeura Team, 1998 // (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
*/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoEvalFunc.h // eoEvalFunc.h
// (c) GeNeura Team, 1998 // (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 eoEvalFunc_H #ifndef eoEvalFunc_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoEvaluator.h // eoEvaluator.h
// (c) GeNeura Team, 1998 // (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 _EOEVALUATOR_H #ifndef _EOEVALUATOR_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoFactory.h // eoFactory.h
// (c) GeNeura Team, 1998 // (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 _EOFACTORY_H #ifndef _EOFACTORY_H

View file

@ -1,6 +1,24 @@
// eoFitness.h
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoFitness.cpp // eoFitness.cpp
// (c) GeNeura Team 1998 // (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 EOFITNESS_H #ifndef EOFITNESS_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoID.h // eoID.h
// (c) GeNeura Team, 1998 // (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 EOID_H #ifndef EOID_H

View file

@ -19,7 +19,7 @@ template<class Chrom> class eoInsertion: public eoMerge<Chrom>
{ {
public: public:
/// (Default) Constructor. /// (Default) Constructor.
eoInsertion(const float& _rate = 1.0): eoMerge(_rate) {} eoInsertion(const float& _rate = 1.0): eoMerge<Chrom>(_rate) {}
/** /**
* Creates a new population based on breeders and original populations. * Creates a new population based on breeders and original populations.

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoKill.h // eoKill.h
// (c) GeNeura Team, 1998 // (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 _EOKILL_h #ifndef _EOKILL_h

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoMultiMonOp.h // eoMultiMonOp.h
// (c) GeNeura Team, 1998 // (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 _EOMULTIMONOP_h #ifndef _EOMULTIMONOP_h

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoMutation.h // eoMutation.h
// (c) GeNeura Team, 1998 // (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 _EOMUTATION_H #ifndef _EOMUTATION_H
#define _EOMUTATION_H #define _EOMUTATION_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoNegExp.h // eoNegExp.h
// (c) GeNeura Team, 1998 // (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 _EONEGEXP_H #ifndef _EONEGEXP_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoNormal.h // eoNormal.h
// (c) GeNeura Team, 1998 // (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 _EONORMAL_H #ifndef _EONORMAL_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoObject.h // eoObject.h
// (c) GeNeura Team, 1998 // (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 EOOBJECT_H #ifndef EOOBJECT_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoOp.h // eoOp.h
// (c) GeNeura Team, 1998 // (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 #ifndef _eoOp_H

View file

@ -1,8 +1,26 @@
// eoOpFactory.h
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoMonOpFactory.h // eoMonOpFactory.h
// (c) GeNeura Team, 1998 // (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 _EOOPFACTORY_H #ifndef _EOOPFACTORY_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoOpSelMason.h // eoOpSelMason.h
// (c) GeNeura Team, 1999 // (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 _EOOPSELMASON_H #ifndef _EOOPSELMASON_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoOpSelector.h // eoOpSelector.h
// (c) GeNeura Team 1998 // (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 EOOPSELECTOR_H #ifndef EOOPSELECTOR_H
@ -44,7 +61,7 @@ public:
@param _id a previously assigned ID @param _id a previously assigned ID
@throw runtime_exception if the ID does not exist @throw runtime_exception if the ID does not exist
*/ */
virtual deleteOp( ID _id ) = 0; virtual void deleteOp( ID _id ) = 0;
/// Returns a genetic operator according to the established criteria /// Returns a genetic operator according to the established criteria
virtual eoOp<EOT>* Op() = 0; virtual eoOp<EOT>* Op() = 0;

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoPersistent.h // eoPersistent.h
// (c) GeNeura Team, 1999 // (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 EOPERSISTENT_H #ifndef EOPERSISTENT_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoPop.h // eoPop.h
// (c) GeNeura Team, 1998 // (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 _EOPOP_H #ifndef _EOPOP_H

View file

@ -1,8 +1,26 @@
// eoPopOps.h
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eo1d.h // eo1d.h
// (c) GeNeura Team, 1998 // (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 _EOPOPOPS_H #ifndef _EOPOPOPS_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoPrintable.h // eoPrintable.h
// (c) GeNeura Team, 1998 // (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 EOPRINTABLE_H #ifndef EOPRINTABLE_H

View file

@ -1,6 +1,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoProblem.h // eoProblem.h
// (c) GeNeura Team 1998 // (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 EOPROBLEM_H #ifndef EOPROBLEM_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoProportionalOpSel.h // eoProportionalOpSel.h
// (c) GeNeura Team 1998 // (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 EOPROPORTIONALOPSEL_H #ifndef EOPROPORTIONALOPSEL_H
@ -67,7 +84,7 @@ public:
@param _id a previously assigned ID @param _id a previously assigned ID
@throw runtime_error if the ID does not exist @throw runtime_error if the ID does not exist
*/ */
virtual deleteOp( ID _id ) { virtual void deleteOp( ID _id ) {
unsigned j; unsigned j;
MMF::iterator i; MMF::iterator i;
for ( i=begin(), j=1; i!=end(); i++,j++ ) { for ( i=begin(), j=1; i!=end(); i++,j++ ) {

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoRandomBreed.h // eoRandomBreed.h
// (c) GeNeura Team, 1998 // (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 _EORANDOMBREED_H #ifndef _EORANDOMBREED_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoRandomSelect.h // eoRandomSelect.h
// (c) GeNeura Team, 1998 // (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 EORANDOMSELECT_H #ifndef EORANDOMSELECT_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoRank.h // eoRank.h
// (c) GeNeura Team 1999 // (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 _eoRank_H #ifndef _eoRank_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoRnd.h // eoRnd.h
// (c) GeNeura Team, 1998 // (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 _EORND_H #ifndef _EORND_H

View file

@ -1,8 +1,26 @@
// eoSelectFactory.h
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// EOFactory.h // EOFactory.h
// (c) GeNeura Team, 1998 // (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 _EOSELECTFACTORY_H #ifndef _EOSELECTFACTORY_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoSimpleEval.h // eoSimpleEval.h
// (c) GeNeura Team, 1998 // (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 _EOSimpleEval_H #ifndef _EOSimpleEval_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoString.h // eoString.h
// (c) GeNeura Team, 1998 // (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 _eoString_H #ifndef _eoString_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoTournament.h // eoTournament.h
// (c) GeNeura Team, 1998 // (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 _EOGSTOURN_H #ifndef _EOGSTOURN_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoTranspose.h // eoTranspose.h
// (c) GeNeura Team, 1998 // (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 _EOTRANSPOSE_h #ifndef _EOTRANSPOSE_h

View file

@ -1,8 +1,26 @@
// eoUniform.h
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// EOUniform.h // EOUniform.h
// (c) GeNeura Team, 1998 // (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 _EOUNIFORM_H #ifndef _EOUNIFORM_H

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoVector.h // eoVector.h
// (c) GeNeura Team, 1998 // (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
*/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -24,7 +41,7 @@
template <class T, class fitnessT> template <class T, class fitnessT>
class eoVector: public eo1d<T, fitnessT>, public vector<T> { class eoVector: public eo1d<T, fitnessT>, public vector<T> {
public: public:
typedef Type T; typedef T Type ;
/// Canonical part of the objects: several ctors, copy ctor, dtor and assignment operator /// Canonical part of the objects: several ctors, copy ctor, dtor and assignment operator
//@{ //@{
@ -70,7 +87,7 @@ which is supposed to be dynamic and dependent on environment.
/** 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 T gene( unsigned _i ) const { virtual T 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];
@ -79,10 +96,10 @@ which is supposed to be dynamic and dependent on environment.
/** 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 T& gene( unsigned _i ) { virtual void setGene( unsigned _i, const T& _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 operator[](_i); (*this)[_i] = _value;
}; };
/** methods that implement the eo1d <em>protocol</em> /** methods that implement the eo1d <em>protocol</em>

View file

@ -3,6 +3,23 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoXOver2.h // eoXOver2.h
// (c) GeNeura Team, 1998 // (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 _EOXOVER2_h #ifndef _EOXOVER2_h

View file

@ -87,7 +87,7 @@ 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_eornd t_eovector t_eoaged t_eoid t_eostring t_ops t_popops t_pop t_es t_opsel t_opfactory t_opMut t_eobitfact noinst_PROGRAMS = t-eobreeder t-eoinclusion t-eoinsertion t-eo t-eofitness t-eoproblem t-eobin t-eolottery
############################################################################### ###############################################################################
@ -139,82 +139,6 @@ t_eolottery_SOURCES = t-eolottery.cpp
t_eolottery_DEPENDENCIES = $(DEPS) t_eolottery_DEPENDENCIES = $(DEPS)
t_eovector_LDFLAGS = -lm t_eovector_LDFLAGS = -lm
t_eolottery_LDADD = $(LDADDS) t_eolottery_LDADD = $(LDADDS)
###############################################################################
t_eornd_SOURCES = t_eornd.cpp
t_eornd_LDFLAGS = -lm
###############################################################################
t_eovector_SOURCES = t_eovector.cpp
t_eovector_LDADD = $(LDADDS)
###############################################################################
t_eoaged_SOURCES = t_eoaged.cpp
t_eoaged_DEPENDENCIES = $(DEPS)
t_eoaged_LDADD = $(LDADDS)
###############################################################################
t_eoid_SOURCES = t_eoid.cpp
t_eoid_DEPENDENCIES = $(DEPS)
t_eoid_LDADD = $(LDADDS)
###############################################################################
t_eostring_SOURCES = t_eostring.cpp
t_eostring_DEPENDENCIES = $(DEPS)
t_eostring_LDADD = $(LDADDS)
###############################################################################
t_es_SOURCES = t_es.cpp
t_es_DEPENDENCIES = $(DEPS)
t_es_LDADD = $(LDADDS)
###############################################################################
t_ops_SOURCES = t_ops.cpp
t_ops_DEPENDENCIES = $(DEPS)
t_ops_LDADD = $(LDADDS)
###############################################################################
t_pop_SOURCES = t_pop.cpp
t_pop_DEPENDENCIES = $(DEPS)
t_pop_LDADD = $(LDADDS)
###############################################################################
t_popops_SOURCES = t_popops.cpp
t_popops_DEPENDENCIES = $(DEPS)
t_popops_LDADD = $(LDADDS)
###############################################################################
t_opsel_SOURCES = t_opsel.cpp
t_opsel_DEPENDENCIES = $(DEPS)
t_opsel_LDADD = $(LDADDS)
###############################################################################
t_opfactory_SOURCES = t_opfactory.cpp
t_opfactory_DEPENDENCIES = $(DEPS)
t_opfactory_LDADD = $(LDADDS)
###############################################################################
t_opMut_SOURCES = t_opMut.cpp
t_opMut_DEPENDENCIES = $(DEPS)
t_opMut_LDADD = $(LDADDS)
###############################################################################
t_eobitfact_SOURCES = t_eobitfact.cpp
t_eobitfact_DEPENDENCIES = $(DEPS)
t_eobitfact_LDADD = $(LDADDS)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
PROGRAMS = $(noinst_PROGRAMS) PROGRAMS = $(noinst_PROGRAMS)
@ -238,33 +162,6 @@ t_eobin_OBJECTS = t-eobin.o
t_eobin_LDFLAGS = t_eobin_LDFLAGS =
t_eolottery_OBJECTS = t-eolottery.o t_eolottery_OBJECTS = t-eolottery.o
t_eolottery_LDFLAGS = t_eolottery_LDFLAGS =
t_eornd_OBJECTS = t_eornd.o
t_eornd_LDADD = $(LDADD)
t_eornd_DEPENDENCIES =
t_eovector_OBJECTS = t_eovector.o
t_eovector_DEPENDENCIES = $(top_builddir)/src/libeo.a
t_eoaged_OBJECTS = t_eoaged.o
t_eoaged_LDFLAGS =
t_eoid_OBJECTS = t_eoid.o
t_eoid_LDFLAGS =
t_eostring_OBJECTS = t_eostring.o
t_eostring_LDFLAGS =
t_ops_OBJECTS = t_ops.o
t_ops_LDFLAGS =
t_popops_OBJECTS = t_popops.o
t_popops_LDFLAGS =
t_pop_OBJECTS = t_pop.o
t_pop_LDFLAGS =
t_es_OBJECTS = t_es.o
t_es_LDFLAGS =
t_opsel_OBJECTS = t_opsel.o
t_opsel_LDFLAGS =
t_opfactory_OBJECTS = t_opfactory.o
t_opfactory_LDFLAGS =
t_opMut_OBJECTS = t_opMut.o
t_opMut_LDFLAGS =
t_eobitfact_OBJECTS = t_eobitfact.o
t_eobitfact_LDFLAGS =
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)
@ -279,12 +176,9 @@ TAR = gtar
GZIP_ENV = --best GZIP_ENV = --best
DEP_FILES = .deps/t-eo.P .deps/t-eobin.P .deps/t-eobreeder.P \ DEP_FILES = .deps/t-eo.P .deps/t-eobin.P .deps/t-eobreeder.P \
.deps/t-eofitness.P .deps/t-eoinclusion.P .deps/t-eoinsertion.P \ .deps/t-eofitness.P .deps/t-eoinclusion.P .deps/t-eoinsertion.P \
.deps/t-eolottery.P .deps/t-eoproblem.P .deps/t_eoaged.P \ .deps/t-eolottery.P .deps/t-eoproblem.P
.deps/t_eobitfact.P .deps/t_eoid.P .deps/t_eornd.P .deps/t_eostring.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)
.deps/t_eovector.P .deps/t_es.P .deps/t_opMut.P .deps/t_opfactory.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)
.deps/t_ops.P .deps/t_opsel.P .deps/t_pop.P .deps/t_popops.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_eornd_SOURCES) $(t_eovector_SOURCES) $(t_eoaged_SOURCES) $(t_eoid_SOURCES) $(t_eostring_SOURCES) $(t_ops_SOURCES) $(t_popops_SOURCES) $(t_pop_SOURCES) $(t_es_SOURCES) $(t_opsel_SOURCES) $(t_opfactory_SOURCES) $(t_opMut_SOURCES) $(t_eobitfact_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_eornd_OBJECTS) $(t_eovector_OBJECTS) $(t_eoaged_OBJECTS) $(t_eoid_OBJECTS) $(t_eostring_OBJECTS) $(t_ops_OBJECTS) $(t_popops_OBJECTS) $(t_pop_OBJECTS) $(t_es_OBJECTS) $(t_opsel_OBJECTS) $(t_opfactory_OBJECTS) $(t_opMut_OBJECTS) $(t_eobitfact_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
@ -369,58 +263,6 @@ t-eobin: $(t_eobin_OBJECTS) $(t_eobin_DEPENDENCIES)
t-eolottery: $(t_eolottery_OBJECTS) $(t_eolottery_DEPENDENCIES) t-eolottery: $(t_eolottery_OBJECTS) $(t_eolottery_DEPENDENCIES)
@rm -f t-eolottery @rm -f t-eolottery
$(CXXLINK) $(t_eolottery_LDFLAGS) $(t_eolottery_OBJECTS) $(t_eolottery_LDADD) $(LIBS) $(CXXLINK) $(t_eolottery_LDFLAGS) $(t_eolottery_OBJECTS) $(t_eolottery_LDADD) $(LIBS)
t_eornd: $(t_eornd_OBJECTS) $(t_eornd_DEPENDENCIES)
@rm -f t_eornd
$(CXXLINK) $(t_eornd_LDFLAGS) $(t_eornd_OBJECTS) $(t_eornd_LDADD) $(LIBS)
t_eovector: $(t_eovector_OBJECTS) $(t_eovector_DEPENDENCIES)
@rm -f t_eovector
$(CXXLINK) $(t_eovector_LDFLAGS) $(t_eovector_OBJECTS) $(t_eovector_LDADD) $(LIBS)
t_eoaged: $(t_eoaged_OBJECTS) $(t_eoaged_DEPENDENCIES)
@rm -f t_eoaged
$(CXXLINK) $(t_eoaged_LDFLAGS) $(t_eoaged_OBJECTS) $(t_eoaged_LDADD) $(LIBS)
t_eoid: $(t_eoid_OBJECTS) $(t_eoid_DEPENDENCIES)
@rm -f t_eoid
$(CXXLINK) $(t_eoid_LDFLAGS) $(t_eoid_OBJECTS) $(t_eoid_LDADD) $(LIBS)
t_eostring: $(t_eostring_OBJECTS) $(t_eostring_DEPENDENCIES)
@rm -f t_eostring
$(CXXLINK) $(t_eostring_LDFLAGS) $(t_eostring_OBJECTS) $(t_eostring_LDADD) $(LIBS)
t_ops: $(t_ops_OBJECTS) $(t_ops_DEPENDENCIES)
@rm -f t_ops
$(CXXLINK) $(t_ops_LDFLAGS) $(t_ops_OBJECTS) $(t_ops_LDADD) $(LIBS)
t_popops: $(t_popops_OBJECTS) $(t_popops_DEPENDENCIES)
@rm -f t_popops
$(CXXLINK) $(t_popops_LDFLAGS) $(t_popops_OBJECTS) $(t_popops_LDADD) $(LIBS)
t_pop: $(t_pop_OBJECTS) $(t_pop_DEPENDENCIES)
@rm -f t_pop
$(CXXLINK) $(t_pop_LDFLAGS) $(t_pop_OBJECTS) $(t_pop_LDADD) $(LIBS)
t_es: $(t_es_OBJECTS) $(t_es_DEPENDENCIES)
@rm -f t_es
$(CXXLINK) $(t_es_LDFLAGS) $(t_es_OBJECTS) $(t_es_LDADD) $(LIBS)
t_opsel: $(t_opsel_OBJECTS) $(t_opsel_DEPENDENCIES)
@rm -f t_opsel
$(CXXLINK) $(t_opsel_LDFLAGS) $(t_opsel_OBJECTS) $(t_opsel_LDADD) $(LIBS)
t_opfactory: $(t_opfactory_OBJECTS) $(t_opfactory_DEPENDENCIES)
@rm -f t_opfactory
$(CXXLINK) $(t_opfactory_LDFLAGS) $(t_opfactory_OBJECTS) $(t_opfactory_LDADD) $(LIBS)
t_opMut: $(t_opMut_OBJECTS) $(t_opMut_DEPENDENCIES)
@rm -f t_opMut
$(CXXLINK) $(t_opMut_LDFLAGS) $(t_opMut_OBJECTS) $(t_opMut_LDADD) $(LIBS)
t_eobitfact: $(t_eobitfact_OBJECTS) $(t_eobitfact_DEPENDENCIES)
@rm -f t_eobitfact
$(CXXLINK) $(t_eobitfact_LDFLAGS) $(t_eobitfact_OBJECTS) $(t_eobitfact_LDADD) $(LIBS)
.cpp.o: .cpp.o:
$(CXXCOMPILE) -c $< $(CXXCOMPILE) -c $<
.cpp.lo: .cpp.lo:

View file

@ -1,10 +1,15 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// t-eobreeder.cpp // t-eobreeder.cpp
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// to avoid long name warnings
#pragma warning(disable:4786)
#include <stdlib.h> // srand #include <eoBin.h> // eoBin, eoPop, eoBreeder
#include <time.h> // time #include <eoPop.h>
#include <eo> // eoBin, eoPop, eoBreeder #include <eoBitOp.h>
#include <eoProportionalOpSel.h>
#include <eoBreeder.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -25,14 +30,12 @@ void binary_value(Chrom& chrom)
main() main()
{ {
srand(time(NULL));
const unsigned POP_SIZE = 8, CHROM_SIZE = 4; const unsigned POP_SIZE = 8, CHROM_SIZE = 4;
unsigned i; unsigned i;
eoUniform<Chrom::Type> uniform(false, true); eoUniform<Chrom::Type> uniform(false, true);
eoBinRandom<Chrom> random; eoBinRandom<Chrom> random;
eoPop<Chrom> pop, pop2; eoPop<Chrom> pop;
for (i = 0; i < POP_SIZE; i++) for (i = 0; i < POP_SIZE; i++)
{ {
@ -42,22 +45,22 @@ main()
pop.push_back(chrom); pop.push_back(chrom);
} }
eoBinBitFlip<Chrom> bitflip; cout << "population:" << endl;
eoBinCrossover<Chrom> xover;
eoBreeder<Chrom> breeder;
breeder.add(bitflip, 1.0);
breeder.add(xover, 1.0);
pop2 = pop;
breeder(pop2);
for (i = 0; i < pop2.size(); i++)
binary_value(pop2[i]);
cout << "population: \tnew population" << endl;
for (i = 0; i < pop.size(); i++) for (i = 0; i < pop.size(); i++)
cout << pop[i] << " " << pop[i].fitness() << " \t" cout << pop[i] << " " << pop[i].fitness() << endl;
<< pop2[i] << " " << pop2[i].fitness() << endl;
eoBinBitFlip<Chrom> bitflip;
eoBinCrossover<Chrom> xover;
eoProportionalOpSel<Chrom> propSel;
eoBreeder<Chrom> breeder( propSel );
propSel.addOp(bitflip, 0.25);
propSel.addOp(xover, 0.75);
breeder(pop);
cout << "new population:" << endl;
for (i = 0; i < pop.size(); i++)
cout << pop[i] << " " << pop[i].fitness() << endl;
return 0; return 0;
} }

View file

@ -32,8 +32,8 @@ main()
for (unsigned POP_SIZE = 4; POP_SIZE <=6; POP_SIZE++) for (unsigned POP_SIZE = 4; POP_SIZE <=6; POP_SIZE++)
{ {
eoPop<Chrom> pop; eoPop<Chrom> pop;
unsigned i;
for (unsigned i = 0; i < POP_SIZE; i++) for ( i = 0; i < POP_SIZE; i++)
{ {
Chrom chrom(CHROM_SIZE); Chrom chrom(CHROM_SIZE);
random(chrom); random(chrom);

View file

@ -25,13 +25,14 @@ ostream& operator<<(ostream& os, const Chrom& chrom)
class Easy//: public eoProblem<Chrom> class Easy//: public eoProblem<Chrom>
{ {
public: public:
const size = 1; static const unsigned size;
float operator()(const Chrom& chrom) float operator()(const Chrom& chrom)
{ {
return 1.0 / (fabs(chrom[0]) + 1.0); return 1.0 / (fabs(chrom[0]) + 1.0);
} }
}; };
const unsigned Easy::size = 1;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------