Browse Source

The Roulette wheel was broke lol

remotes/origin/HEAD
Mike 2 years ago
parent
commit
dc75f730ab
2 changed files with 13 additions and 1 deletions
  1. +4
    -0
      Population.cpp
  2. +9
    -1
      RouletteWheel.cpp

+ 4
- 0
Population.cpp View File

@ -534,6 +534,10 @@ namespace BitEvolver
mama = this->roulette_wheel->Spin();
papa = this->roulette_wheel->Spin();
//
//cout << "Roulette Wheel (mama): " << mama->ToString() << endl;
//cout << "Roulette Wheel (papa): " << papa->ToString() << endl;
//
kiddo = this->breeder->Breed(
mama, papa,


+ 9
- 1
RouletteWheel.cpp View File

@ -12,11 +12,16 @@
#include <mutex>
#include <algorithm>
#include <memory>
#include <iostream>
//
namespace BitEvolver
{
//
using std::cout;
using std::endl;
//
RouletteWheel::RouletteWheel()
{
@ -115,7 +120,7 @@ namespace BitEvolver
// Find the corresponding chromosome
for ( i=0; i<this->wheel_slots.size(); i++ ) {
if ( this->wheel_slots[i].first <= spin ) {
if ( this->wheel_slots[i].first >= spin ) {
return this->wheel_slots[i].second;
}
}
@ -172,6 +177,9 @@ namespace BitEvolver
//
pairs.push_back(pair);
//
//cout << "[" << pair.first << "]" << chromosome->ToString() << endl;
}
return pairs;


Loading…
Cancel
Save