From 2af7b7905705d4ebc774e3f9a95850bd042fe0e3 Mon Sep 17 00:00:00 2001 From: JonZhao <1044264932@qq.com> Date: Tue, 4 Jun 2019 10:51:20 +0800 Subject: add function: print_and_write_in_file --- example3.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 example3.py (limited to 'example3.py') diff --git a/example3.py b/example3.py new file mode 100644 index 0000000..a01434c --- /dev/null +++ b/example3.py @@ -0,0 +1,20 @@ +from vrptw_base import VrptwGraph +from multiple_ant_colony_system import MultipleAntColonySystem +import os + + +if __name__ == '__main__': + ants_num = 10 + beta = 1 + q0 = 0.1 + show_figure = False + for file_name in os.listdir('./solomon-100'): + file_path = os.path.join('./solomon-100', file_name) + print('-' * 100) + print('file_path: %s' % file_path) + print('\n') + file_to_write_path = os.path.join('./result', file_name.split('.')[0] + '-result.txt') + graph = VrptwGraph(file_path) + macs = MultipleAntColonySystem(graph, ants_num=ants_num, beta=beta, q0=q0, whether_or_not_to_show_figure=show_figure) + macs.run_multiple_ant_colony_system(file_to_write_path) + print('\n' * 10) -- cgit v1.2.3