11import time
22from argparse import ArgumentParser
3- from os .path import join
4-
5- from os import getcwd
63
74from algorithm .algorithm import Algorithm
85from parsers .input_parser import parse_input
96from parsers .output_builder import save_solution
7+ from utils .argument_parser_util import add_parser_arguments
108from utils .solution_checker import check_solution
119
1210
1311def main ():
14- input_file = args .i
15- output_file = args .o
12+ input_file , output_file = args .i , args .o
13+ n , m , e = args .n , args .m , args .e
14+ nep , nsp , ngh = args .nep , args .nsp , args .ngh
15+ iterations = args .max
1616
1717 before = time .time ()
18- best_solution = Algorithm .execute (parse_input (input_file ))
18+ best_solution = Algorithm .execute (parse_input (input_file ), n , m , e , nep , nsp , ngh , iterations )
1919 save_solution (best_solution , output_file )
2020 score = check_solution (input_file , output_file )
2121 after = time .time ()
@@ -29,14 +29,6 @@ def main():
2929
3030if __name__ == "__main__" :
3131 parser = ArgumentParser (description = "Distributed cache problem solver." )
32-
33- default_input_filename = "me_at_the_zoo.in"
34- parser .add_argument ("-i" , "-input_file" , help = "Path to input file." , type = str ,
35- default = join (getcwd (), "files" , default_input_filename ))
36-
37- default_output_filename = "solution.out"
38- parser .add_argument ("-o" , "-output_file" , help = "Path to output file." , type = str ,
39- default = join (getcwd (), "files" , default_output_filename ))
40-
32+ add_parser_arguments (parser )
4133 args = parser .parse_args ()
4234 main ()
0 commit comments