|
1 | 1 | from algorithm.algorithm import Algorithm |
2 | 2 | from parsers.input_parser import parse_input |
3 | 3 | from utils.solution_checker import check_solution |
| 4 | +from parsers.output_builder import save_solution |
4 | 5 | import time |
5 | 6 |
|
| 7 | + |
6 | 8 | def main(): |
7 | 9 | # input_file = "files/videos_worth_spreading.in" |
8 | 10 | # input_file = "files/kittens.in" |
9 | 11 | # input_file = "files/example1.in" |
10 | | - input_file = "files/me_at_the_zoo.in" |
11 | | - # input_file = "files/trending_today.in" |
| 12 | + # input_file = "files/me_at_the_zoo.in" |
| 13 | + input_file = "files/trending_today.in" |
12 | 14 |
|
13 | 15 | # solution_file = "files/example1.out" |
14 | 16 | # solution = check_solution(input_file, solution_file) |
15 | 17 | # print(solution) |
16 | 18 |
|
17 | 19 | before = time.time() |
18 | | - score = Algorithm.execute(parse_input(input_file)) |
| 20 | + best_solution = Algorithm.execute(parse_input(input_file)) |
| 21 | + save_solution(best_solution, "files/out1.out") |
| 22 | + score = check_solution(input_file, "files/out1.out") |
19 | 23 | after = time.time() |
20 | 24 |
|
| 25 | + print(best_solution) |
21 | 26 | print("-----------------------------") |
22 | 27 | print("Algorithm took: " + str(round(after-before, 2)) + " s") |
23 | 28 | print("-----------------------------") |
24 | | - print("Saved time: " + str(round(score / 1000, 2)) + " s") |
| 29 | + print("Saved time: " + str(round(score / 1000, 2)) + " s (score: " + str(score) + ")") |
25 | 30 |
|
26 | 31 | if __name__ == '__main__': |
27 | 32 | main() |
0 commit comments