Skip to content

Commit

Permalink
Displaying the results
Browse files Browse the repository at this point in the history
  • Loading branch information
devincapriola committed Dec 4, 2021
1 parent 040d82a commit 2d8a0a8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions train.py
Expand Up @@ -113,3 +113,21 @@ def mix(self, dna1, dna2):
newRoute.mix(dna1, dna2)

population.append(newRoute)

# Displaying the results
env.reset()

for i in range(dnaLength):
action = sortedPop[0].dna[i]
_ = env.step(action, "none")

if generation % 100 == 0:
env.reset()

for i in range(dnaLength):
action = sortedPop[0].dna[i]
_ = env.step(action, "beautiful")

print("Generation:", generation + str(generation) +
"Shortest Distance: {:.2f}".format(bestDist) +
"light years")

0 comments on commit 2d8a0a8

Please sign in to comment.