diff options
| author | JonZhao <[email protected]> | 2019-06-04 10:51:20 +0800 |
|---|---|---|
| committer | JonZhao <[email protected]> | 2019-06-04 10:51:20 +0800 |
| commit | 2af7b7905705d4ebc774e3f9a95850bd042fe0e3 (patch) | |
| tree | d6dd1c2c20a7264e119c23ff527430f03e621ee9 /example3.py | |
| parent | 6c95eeebca7c843a3b9a775a4215836af2f5ab42 (diff) | |
| download | VRPTW-ACO-python-2af7b7905705d4ebc774e3f9a95850bd042fe0e3.tar.gz VRPTW-ACO-python-2af7b7905705d4ebc774e3f9a95850bd042fe0e3.tar.bz2 VRPTW-ACO-python-2af7b7905705d4ebc774e3f9a95850bd042fe0e3.zip | |
add function: print_and_write_in_file
Diffstat (limited to 'example3.py')
| -rw-r--r-- | example3.py | 20 |
1 files changed, 20 insertions, 0 deletions
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) |
