-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathocenatestow.py
41 lines (34 loc) · 1.27 KB
/
ocenatestow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from solvers.GreedySolver import GreedySolver
from solvers.DynamicSolver import DynamicSolver
from solvers.SmartGreedySolver import SmartGreedySolver
import os
import json
for file in os.listdir("tests/"):
if file.endswith(".in"):
path = os.path.join("tests/", file)
with open(path, "r") as f:
print(path)
input = json.load(f)
greedySolver = GreedySolver(input)
greedySolver()
print(greedySolver.result)
smartGreedySolver = SmartGreedySolver(input)
smartGreedySolver()
print(smartGreedySolver.result)
dynamicSolver = DynamicSolver(input)
dynamicSolver()
print(dynamicSolver.result)
def sum_results(result):
return sum([i[0][0] for i in result]), sum([i[0][1] for i in result])
print(sum_results(greedySolver.result), "|",
sum_results(smartGreedySolver.result), "|",
sum_results(dynamicSolver.result))
# for test in "tests/":
# wczytaj test
# gs = GreedySolver(wczytane_dane)
# gs()
# wynik_greedy = sum(gs.result, key=lambda x:x[0][0])
# smart...
# dynamic
# zapamietaj wyniki
# po petli: dla kazdego wyniku wyswietl: "sciezka testu", "wyniki 1, 2, 3" "N", "C"