Changes to eo1d interface and bug fixes
This commit is contained in:
parent
06db0c058e
commit
759dba7ea8
47 changed files with 759 additions and 204 deletions
17
eo/src/EO.h
17
eo/src/EO.h
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// EO.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 EO_H
|
||||
|
|
|
|||
18
eo/src/eo
18
eo/src/eo
|
|
@ -1,6 +1,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eo
|
||||
// (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_
|
||||
|
|
@ -12,6 +29,7 @@
|
|||
#include <eoObject.h>
|
||||
#include <eoPrintable.h>
|
||||
#include <eoPersistent.h>
|
||||
#include <eoFitness.h>
|
||||
#include <EO.h>
|
||||
|
||||
#include <eoID.h>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eo1d.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 _EO1D_H
|
||||
|
|
@ -16,7 +33,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
/** @name EO1d class
|
||||
/** @name eo1d class
|
||||
* Randomly accesible evolvable object with one dimension, with
|
||||
variable length.
|
||||
* 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 = "");
|
||||
|
||||
/** Ctor from a istream. It just passes the stream to EO.
|
||||
@param _is the input stream; eo1d just cares about the fitness
|
||||
/** Ctor from a istream. It just passes the stream to EO, subclasses should
|
||||
have to implement this.
|
||||
@param _is the input stream
|
||||
*/
|
||||
eo1d( istream& _is): EO<fitnessT>( _is ){};
|
||||
|
||||
|
|
@ -77,7 +95,7 @@ public:
|
|||
@return what's inside the gene, with the correct type
|
||||
@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
|
||||
* new value. This means that the assignment operator
|
||||
|
|
@ -86,7 +104,7 @@ public:
|
|||
@return what's inside the gene, with the correct type
|
||||
@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
|
||||
* _i = length(), it should insert it at the end.
|
||||
|
|
@ -116,19 +134,21 @@ public:
|
|||
virtual void readFrom(istream& _s) {
|
||||
|
||||
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
|
||||
// it's skipped
|
||||
}
|
||||
|
||||
/** Print itself: inherited from eoObject implementation. Declared virtual so that
|
||||
it can be reimplemented anywhere. Instance from base classes are processed in
|
||||
base classes, so you don´t have to worry about, for instance, fitness.
|
||||
/** 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{
|
||||
for ( unsigned i = 0; i < length(); i ++ ) {
|
||||
_s << gene( i ) << " ";
|
||||
_s << getGene( i ) << " ";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
// eoAged.h
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoAge.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 EOAGED_H
|
||||
|
|
|
|||
|
|
@ -25,20 +25,20 @@ template <class F> class eoBin: public eoVector<bool, F>
|
|||
* (Default) Constructor.
|
||||
* @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) {}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @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);
|
||||
}
|
||||
|
||||
/// Constructor from istream.
|
||||
/// @param is The istream to read from.
|
||||
/** Constructor from istream.
|
||||
@param is The istream to read from.*/
|
||||
eoBin(istream& _is):eoVector<bool,F>(_is){};
|
||||
|
||||
/// My class name.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
// eoBitOpFactory.h
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoOpFactory.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 _EOBITOPFACTORY_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoDrawable.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 EODRAWABLE_H
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
// eoDup.h
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoKill.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 _EODUP_h
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoESChrom.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
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoEvalFunc.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 eoEvalFunc_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoEvaluator.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 _EOEVALUATOR_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoFactory.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 _EOFACTORY_H
|
||||
|
|
|
|||
|
|
@ -1,6 +1,24 @@
|
|||
// eoFitness.h
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoFitness.cpp
|
||||
// (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
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoID.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 EOID_H
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ template<class Chrom> class eoInsertion: public eoMerge<Chrom>
|
|||
{
|
||||
public:
|
||||
/// (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.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoKill.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 _EOKILL_h
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoMultiMonOp.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 _EOMULTIMONOP_h
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoMutation.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 _EOMUTATION_H
|
||||
#define _EOMUTATION_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoNegExp.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 _EONEGEXP_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoNormal.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 _EONORMAL_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoObject.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 EOOBJECT_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
// eoOpFactory.h
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoMonOpFactory.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 _EOOPFACTORY_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoOpSelMason.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 _EOOPSELMASON_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoOpSelector.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 EOOPSELECTOR_H
|
||||
|
|
@ -44,7 +61,7 @@ public:
|
|||
@param _id a previously assigned ID
|
||||
@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
|
||||
virtual eoOp<EOT>* Op() = 0;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoPersistent.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 EOPERSISTENT_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoPop.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 _EOPOP_H
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
// eoPopOps.h
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eo1d.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 _EOPOPOPS_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoPrintable.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 EOPRINTABLE_H
|
||||
|
|
|
|||
|
|
@ -1,6 +1,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoProblem.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 EOPROBLEM_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoProportionalOpSel.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 EOPROPORTIONALOPSEL_H
|
||||
|
|
@ -67,7 +84,7 @@ public:
|
|||
@param _id a previously assigned ID
|
||||
@throw runtime_error if the ID does not exist
|
||||
*/
|
||||
virtual deleteOp( ID _id ) {
|
||||
virtual void deleteOp( ID _id ) {
|
||||
unsigned j;
|
||||
MMF::iterator i;
|
||||
for ( i=begin(), j=1; i!=end(); i++,j++ ) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoRandomBreed.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 _EORANDOMBREED_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoRandomSelect.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 EORANDOMSELECT_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoRank.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 _eoRank_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoRnd.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 _EORND_H
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
// eoSelectFactory.h
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// EOFactory.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 _EOSELECTFACTORY_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoSimpleEval.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 _EOSimpleEval_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoString.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 _eoString_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoTournament.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 _EOGSTOURN_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoTranspose.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 _EOTRANSPOSE_h
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
// eoUniform.h
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// EOUniform.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 _EOUNIFORM_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoVector.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
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
@ -24,7 +41,7 @@
|
|||
template <class T, class fitnessT>
|
||||
class eoVector: public eo1d<T, fitnessT>, public vector<T> {
|
||||
public:
|
||||
typedef Type T;
|
||||
typedef T Type ;
|
||||
|
||||
/// 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>
|
||||
@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() )
|
||||
throw out_of_range( "out_of_range when reading gene");
|
||||
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>
|
||||
@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() )
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoXOver2.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 _EOXOVER2_h
|
||||
|
|
|
|||
|
|
@ -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_eovector_LDFLAGS = -lm
|
||||
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
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
|
@ -238,33 +162,6 @@ t_eobin_OBJECTS = t-eobin.o
|
|||
t_eobin_LDFLAGS =
|
||||
t_eolottery_OBJECTS = t-eolottery.o
|
||||
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@
|
||||
CXXCOMPILE = $(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
|
||||
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-eolottery.P .deps/t-eoproblem.P .deps/t_eoaged.P \
|
||||
.deps/t_eobitfact.P .deps/t_eoid.P .deps/t_eornd.P .deps/t_eostring.P \
|
||||
.deps/t_eovector.P .deps/t_es.P .deps/t_opMut.P .deps/t_opfactory.P \
|
||||
.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)
|
||||
.deps/t-eolottery.P .deps/t-eoproblem.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)
|
||||
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)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
|
|
@ -369,58 +263,6 @@ t-eobin: $(t_eobin_OBJECTS) $(t_eobin_DEPENDENCIES)
|
|||
t-eolottery: $(t_eolottery_OBJECTS) $(t_eolottery_DEPENDENCIES)
|
||||
@rm -f t-eolottery
|
||||
$(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:
|
||||
$(CXXCOMPILE) -c $<
|
||||
.cpp.lo:
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eobreeder.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// to avoid long name warnings
|
||||
#pragma warning(disable:4786)
|
||||
|
||||
#include <stdlib.h> // srand
|
||||
#include <time.h> // time
|
||||
#include <eo> // eoBin, eoPop, eoBreeder
|
||||
#include <eoBin.h> // eoBin, eoPop, eoBreeder
|
||||
#include <eoPop.h>
|
||||
#include <eoBitOp.h>
|
||||
#include <eoProportionalOpSel.h>
|
||||
#include <eoBreeder.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -25,14 +30,12 @@ void binary_value(Chrom& chrom)
|
|||
|
||||
main()
|
||||
{
|
||||
srand(time(NULL));
|
||||
|
||||
const unsigned POP_SIZE = 8, CHROM_SIZE = 4;
|
||||
unsigned i;
|
||||
|
||||
eoUniform<Chrom::Type> uniform(false, true);
|
||||
eoBinRandom<Chrom> random;
|
||||
eoPop<Chrom> pop, pop2;
|
||||
eoPop<Chrom> pop;
|
||||
|
||||
for (i = 0; i < POP_SIZE; i++)
|
||||
{
|
||||
|
|
@ -42,22 +45,22 @@ main()
|
|||
pop.push_back(chrom);
|
||||
}
|
||||
|
||||
eoBinBitFlip<Chrom> bitflip;
|
||||
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;
|
||||
cout << "population:" << endl;
|
||||
for (i = 0; i < pop.size(); i++)
|
||||
cout << pop[i] << " " << pop[i].fitness() << " \t"
|
||||
<< pop2[i] << " " << pop2[i].fitness() << endl;
|
||||
cout << pop[i] << " " << pop[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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ main()
|
|||
for (unsigned POP_SIZE = 4; POP_SIZE <=6; POP_SIZE++)
|
||||
{
|
||||
eoPop<Chrom> pop;
|
||||
|
||||
for (unsigned i = 0; i < POP_SIZE; i++)
|
||||
unsigned i;
|
||||
for ( i = 0; i < POP_SIZE; i++)
|
||||
{
|
||||
Chrom chrom(CHROM_SIZE);
|
||||
random(chrom);
|
||||
|
|
|
|||
|
|
@ -25,13 +25,14 @@ ostream& operator<<(ostream& os, const Chrom& chrom)
|
|||
class Easy//: public eoProblem<Chrom>
|
||||
{
|
||||
public:
|
||||
const size = 1;
|
||||
static const unsigned size;
|
||||
|
||||
float operator()(const Chrom& chrom)
|
||||
{
|
||||
return 1.0 / (fabs(chrom[0]) + 1.0);
|
||||
}
|
||||
};
|
||||
const unsigned Easy::size = 1;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Reference in a new issue