visualization.py

This module handles all the visualization for any evolution. The current implementation uses pygame

makeScreen(W, H)

Make an empty screen of width W and height H

normalize(point, (olow, ohigh), (low, high))

This is a helper function. It takes a value for point, originally measured in the scale [olow, ohigh]. The returned value is the corresponding value of point on the scale [low, high]

draw(tour, window, W, H, SCORES, COORDS)

Draws a tour of a traveling salesman, and writes the score of the tour on the window.

Each city in the tour is represented as a red dot, with white lines connecting them.

COORDS is a dictionary that contains the coordinates of the various cities.

The fitness score of tour is also written to window

killscreen()

This function cleans up pygame and destroys the window and the screen; to be called at the end of evolution.

Table Of Contents

Previous topic

settings.py

Next topic

Contracts

This Page