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;
|
typedef typename EOT::AtomType AtomType;
|
||||||
|
|
||||||
eoInitPermutation(unsigned _chromSize, bool _isOneIndexed=true)
|
eoInitPermutation(unsigned _chromSize, unsigned _startFrom=0)
|
||||||
: chromSize(_chromSize), isOneIndexed(_isOneIndexed){}
|
: chromSize(_chromSize), startFrom(_startFrom){}
|
||||||
|
|
||||||
virtual void operator()(EOT& chrom)
|
virtual void operator()(EOT& chrom)
|
||||||
{
|
{
|
||||||
chrom.resize(chromSize);
|
chrom.resize(chromSize);
|
||||||
for(unsigned idx=0;idx <chrom.size();idx++)
|
for(unsigned idx=0;idx <chrom.size();idx++)
|
||||||
if(isOneIndexed)
|
chrom[idx]=idx+startFrom;
|
||||||
chrom[idx]=idx+1;
|
|
||||||
else
|
|
||||||
chrom[idx]=idx;
|
|
||||||
std::random_shuffle(chrom.begin(), chrom.end(),gen);
|
std::random_shuffle(chrom.begin(), chrom.end(),gen);
|
||||||
chrom.invalidate();
|
chrom.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
unsigned chromSize;
|
unsigned chromSize;
|
||||||
bool isOneIndexed;
|
unsigned startFrom;
|
||||||
UF_random_generator<unsigned int> gen;
|
UF_random_generator<unsigned int> gen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue