Replaced "_isOneIndexed" boolean by an unsigned "_startFrom"
This commit is contained in:
parent
259dad2820
commit
596d24511a
1 changed files with 5 additions and 7 deletions
|
|
@ -158,24 +158,22 @@ class eoInitPermutation: public eoInit<EOT>
|
|||
|
||||
typedef typename EOT::AtomType AtomType;
|
||||
|
||||
eoInitPermutation(unsigned _chromSize, bool _isOneIndexed=true)
|
||||
: chromSize(_chromSize), isOneIndexed(_isOneIndexed){}
|
||||
eoInitPermutation(unsigned _chromSize, unsigned _startFrom=0)
|
||||
: chromSize(_chromSize), startFrom(_startFrom){}
|
||||
|
||||
virtual void operator()(EOT& chrom)
|
||||
{
|
||||
chrom.resize(chromSize);
|
||||
for(unsigned idx=0;idx <chrom.size();idx++)
|
||||
if(isOneIndexed)
|
||||
chrom[idx]=idx+1;
|
||||
else
|
||||
chrom[idx]=idx;
|
||||
chrom[idx]=idx+startFrom;
|
||||
|
||||
std::random_shuffle(chrom.begin(), chrom.end(),gen);
|
||||
chrom.invalidate();
|
||||
}
|
||||
|
||||
private :
|
||||
unsigned chromSize;
|
||||
bool isOneIndexed;
|
||||
unsigned startFrom;
|
||||
UF_random_generator<unsigned int> gen;
|
||||
};
|
||||
|
||||
|
|
|
|||
Reference in a new issue