* indentations + whitespace cleanup
This commit is contained in:
parent
8457e39efe
commit
56c6edab04
285 changed files with 6068 additions and 6223 deletions
|
|
@ -4,7 +4,7 @@
|
|||
// eoShiftMutation.h
|
||||
// (c) GeNeura Team, 2000 - EEAAX 2000 - Maarten Keijzer 2000
|
||||
// (c) INRIA Futurs - Dolphin Team - Thomas Legrand 2007
|
||||
/*
|
||||
/*
|
||||
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
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||
thomas.legrand@lifl.fr
|
||||
thomas.legrand@lifl.fr
|
||||
Marc.Schoenauer@polytechnique.fr
|
||||
mak@dhi.dk
|
||||
*/
|
||||
|
|
@ -40,13 +40,13 @@
|
|||
template<class EOT> class eoShiftMutation: public eoMonOp<EOT>
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
typedef typename EOT::AtomType GeneType;
|
||||
|
||||
|
||||
/// CTor
|
||||
eoShiftMutation(){}
|
||||
|
||||
|
||||
|
||||
|
||||
/// The class name.
|
||||
virtual std::string className() const { return "eoShiftMutation"; }
|
||||
|
||||
|
|
@ -57,36 +57,35 @@ template<class EOT> class eoShiftMutation: public eoMonOp<EOT>
|
|||
*/
|
||||
bool operator()(EOT& _eo)
|
||||
{
|
||||
|
||||
unsigned i, j, from, to;
|
||||
|
||||
unsigned i, j, from, to;
|
||||
GeneType tmp;
|
||||
|
||||
|
||||
// generate two different indices
|
||||
i=eo::rng.random(_eo.size());
|
||||
do j = eo::rng.random(_eo.size()); while (i == j);
|
||||
|
||||
do j = eo::rng.random(_eo.size()); while (i == j);
|
||||
|
||||
// indexes
|
||||
from=std::min(i,j);
|
||||
to=std::max(i,j);
|
||||
|
||||
// keep the first component to change
|
||||
tmp=_eo[to];
|
||||
|
||||
tmp=_eo[to];
|
||||
|
||||
// shift
|
||||
for(unsigned int k=to ; k > from ; k--)
|
||||
_eo[k]=_eo[k-1];
|
||||
|
||||
_eo[k]=_eo[k-1];
|
||||
|
||||
// shift the first component
|
||||
_eo[from]=tmp;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
/** @example t-eoShiftMutation.cpp
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue