Modified the className() method so that the Atom underlying operator is listed
This commit is contained in:
parent
5fb8958b28
commit
f69b785b39
2 changed files with 43 additions and 4 deletions
|
|
@ -21,7 +21,7 @@
|
|||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||
Marc.Schoenauer@polytechnique.fr
|
||||
mak@dhi.dk
|
||||
CVS Info: $Date: 2001-03-21 13:35:09 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/src/eoVariableLengthCrossover.h,v 1.6 2001-03-21 13:35:09 jmerelo Exp $ $Author: jmerelo $
|
||||
CVS Info: $Date: 2001-09-04 06:51:59 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/src/eoVariableLengthCrossover.h,v 1.7 2001-09-04 06:51:59 evomarc Exp $ $Author: evomarc $
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -45,6 +45,7 @@ class eoAtomExchange : public eoBF<unsigned, Atom &, bool>
|
|||
public:
|
||||
// a function to initlialize - to be called before every crossover
|
||||
virtual void randomize(unsigned int, unsigned int){}
|
||||
virtual string className() const=0;
|
||||
};
|
||||
|
||||
/** Uniform crossover - well, not really for FixedLength */
|
||||
|
|
@ -68,6 +69,9 @@ public:
|
|||
{
|
||||
return mask[_i];
|
||||
}
|
||||
|
||||
virtual string className() const {return "eoUniformAtomExchange";}
|
||||
|
||||
private:
|
||||
double rate;
|
||||
vector<bool> mask;
|
||||
|
|
@ -143,11 +147,21 @@ public :
|
|||
_eo2.swap(tmp2);
|
||||
return true; // should we test that? Yes, but no time now
|
||||
}
|
||||
|
||||
virtual string className() const
|
||||
{
|
||||
char s[1024];
|
||||
ostrstream os(s, 1022);
|
||||
os << "eoVlAtomExchangeQuadOp(" << atomExchange.className() << ")" << ends;
|
||||
return string(s);
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned Min, Max;
|
||||
eoAtomExchange<AtomType> & atomExchange;
|
||||
};
|
||||
/** Exchange Crossover using an AtomExchange
|
||||
|
||||
/** Crossover using an AtomCrossover (probably irrelevant in Variable Length)
|
||||
*/
|
||||
|
||||
template <class EOT>
|
||||
|
|
@ -173,6 +187,14 @@ public :
|
|||
}
|
||||
return changed; // should we test that? Yes, but no time now
|
||||
}
|
||||
|
||||
virtual string className() const
|
||||
{
|
||||
char s[1024];
|
||||
ostrstream os(s, 1022);
|
||||
os << "eoInnerExchangeQuadOp(" << atomExchange.className() << ")" << ends;
|
||||
return string(s);
|
||||
}
|
||||
private:
|
||||
float rate;
|
||||
eoQuadOp<AtomType> & op;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||
Marc.Schoenauer@polytechnique.fr
|
||||
mak@dhi.dk
|
||||
CVS Info: $Date: 2001-07-11 06:26:11 $ $Version$ $Author: evomarc $
|
||||
CVS Info: $Date: 2001-09-04 06:51:59 $ $Version$ $Author: evomarc $
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -71,6 +71,9 @@ public :
|
|||
_eo.insert(_eo.begin()+pos, atom);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual string className() const { return "eoVlAddMutation"; }
|
||||
|
||||
private:
|
||||
unsigned nMax;
|
||||
eoInit<AtomType> & atomInit;
|
||||
|
|
@ -79,7 +82,11 @@ private:
|
|||
/** A helper class for choosing which site to delete */
|
||||
template <class EOT>
|
||||
class eoGeneDelChooser : public eoUF<EOT &, unsigned int>
|
||||
{};
|
||||
{
|
||||
public:
|
||||
virtual string className() const =0;
|
||||
|
||||
};
|
||||
|
||||
/** Uniform choice of gene to delete */
|
||||
template <class EOT>
|
||||
|
|
@ -91,6 +98,7 @@ public:
|
|||
{
|
||||
return eo::rng.random(_eo.size());
|
||||
}
|
||||
virtual string className() const { return "eoUniformGeneChooser"; }
|
||||
};
|
||||
|
||||
/** Deletion of a gene
|
||||
|
|
@ -130,6 +138,15 @@ public :
|
|||
_eo.erase(_eo.begin()+pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual string className() const
|
||||
{
|
||||
char s[1024];
|
||||
ostrstream os(s, 1022);
|
||||
os << "eoVlDelMutation(" << chooser.className() << ")" << ends;
|
||||
return string(s);
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned nMin;
|
||||
eoUniformGeneChooser<EOT> uChooser;
|
||||
|
|
|
|||
Reference in a new issue