diff --git a/genetyczny.py b/genetyczny.py index 95da281..53419fe 100644 --- a/genetyczny.py +++ b/genetyczny.py @@ -3,5 +3,12 @@ import mlrose def best_route (lista_paczek): koordynaty_paczek = mlrose.TravellingSales(coords = lista_paczek) - + + #length oznacza liczbe paczek w naszej liscie + problem_fit = mlrose.TSPOpt(length = 5, fitness_fn = koordynaty_paczek, maximize = False) + + # Znalesc najlepsza paczke za pomocy algorytmu genetycznego + best_state, best_fitness = mlrose.genetic_alg(problem_fit, mutation_prob = 0.5, max_attempts = 100, random_state = 2) + + print('Najlepsza sciezka: ', best_state) return best_state \ No newline at end of file