float span_end;
double fenotype() {
- int fen = 0;
- int rat = 1;
+ int _fenotype = 0;
+ int ratio = 1;
for (unsigned int i = 0; i < chromosome.get().size(); i++) {
- fen = fen + chromosome.get()[i].get() * rat;
- rat = rat * 2;
+ _fenotype = _fenotype + chromosome.get()[i].get() * ratio;
+ ratio = ratio * 2;
}
- return fen;
+ return _fenotype;
}
double calculateFenotype() {
return span_start + (span_end - span_start) * this->fenotype() / power2N;
}
public:
- WSTI(_Chromosome& chromosome, float start, float end) {
- this->chromosome = chromosome;
- this->span_start = start;
- this->span_end = end;
+ WSTI(_Chromosome& _chromosome, float start, float end)
+ : chromosome(_chromosome.get()), span_start(start), span_end(end) {
}
double calculate() {