rooq37

cpp

Dec 30th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. void Population::printPopulation() {
  2. for (int i = 0; i < numberOfPopulation; i++) {
  3. cout<<population[i]->printTree()<<" wynik: "<<population[i]->getAdaptation()<<endl;
  4. }
  5. }
  6.  
  7. void Population::findBest() {
  8. for (int i = 0; i < numberOfPopulation; i++) {
  9. if (((population[i]->getAdaptation()) < bestResult) && population[i]->isXAndY()) {
  10. bestResult = population[i]->getAdaptation();
  11. delete bestTree;
  12. bestTree = new Tree(*population[i]);
  13. }
  14. }
  15. if (bestTree != NULL) {
  16. cout << "Najlepsza funkcja: " << bestTree->printTree() << " wynik = " << bestTree->getAdaptation() << endl;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment