From efdb69843d29ecbec944054a51ee8dbb8ed8f964 Mon Sep 17 00:00:00 2001 From: Karol Piotrowski Date: Sun, 7 Jun 2020 13:24:23 +0000 Subject: [PATCH] =?UTF-8?q?Prze=C5=9Blij=20pliki=20do=20''?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Main.cpp | 45 ++++++++++++++++++++++++---------------- algorytm_genetyczny.md | 47 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 algorytm_genetyczny.md diff --git a/Main.cpp b/Main.cpp index d76f96e..525a1f8 100644 --- a/Main.cpp +++ b/Main.cpp @@ -290,14 +290,11 @@ void genetic_algorithm(string * population, int populationSize, int parentsNumbe string * nextGen = new string[populationSize]; crossover(parents,nextGen,parentsNumber,populationSize); - - delete[] population; - - population = new string[populationSize]; + for(i=0;i=rozmiarPopulacji) { scoreBuraki = 0; - delete[] burakiDoSadzenia; - string * burakiDoSadzenia = new string[20]; + for(int i = 0;i<20;i++) { burakiDoSadzenia[i] = "000000000"; } genetic_algorithm(zebraneBuraki, rozmiarPopulacji, rozmiarPopulacji - 5, burakiDoSadzenia, 20); gmoLeftBuraki = 20; - delete[] zebraneBuraki; - string * zebraneBuraki = new string[rozmiarPopulacji]; + for(int i = 0; i=rozmiarPopulacji) { scoreZiemniaki = 0; - delete[] ziemniakiDoSadzenia; - string * ziemniakiDoSadzenia = new string[20]; + for(int i = 0;i<20;i++) { ziemniakiDoSadzenia[i] = "000000000"; } genetic_algorithm(zebraneZiemniaki, rozmiarPopulacji, rozmiarPopulacji - 5, ziemniakiDoSadzenia, 20); gmoLeftZiemniaki = 20; - delete[] zebraneZiemniaki; - string * zebraneZiemniaki = new string[rozmiarPopulacji]; + for(int i = 0; i