24 lines
716 B
Python
24 lines
716 B
Python
import csv
|
|
import matplotlib.pyplot as plt
|
|
|
|
with open("lab2/docs/data/results.csv", encoding="utf-8") as file:
|
|
rows = list(csv.DictReader(file))
|
|
|
|
mazes = ["simple.txt", "dead.txt", "large.txt", "empty.txt", "noexit.txt"]
|
|
strategies = ["BFS", "DFS", "A*"]
|
|
|
|
for maze in mazes:
|
|
values = []
|
|
|
|
for strategy in strategies:
|
|
for row in rows:
|
|
if row["maze"] == maze and row["strategy"] == strategy:
|
|
values.append(float(row["time_ms"]))
|
|
|
|
plt.bar(strategies, values)
|
|
plt.title("Время поиска: " + maze)
|
|
plt.xlabel("Стратегия")
|
|
plt.ylabel("Время, мс")
|
|
plt.savefig("lab2/docs/data/" + maze.replace(".txt", "_time.png"))
|
|
plt.close()
|