LeeAnnJ / MO-TSP-with-EA

多目标旅行商问题的演化算法优化,使用NSGA-II与SPEA2,开箱即用
7 stars 1 forks source link

使用相对路径时出错 #1

Closed Nika978 closed 1 month ago

Nika978 commented 2 months ago

[info] processing file: dantzig42.tsp Traceback (most recent call last): File "c:/xue/code/python/MO-TSP-with-EA-main/Code/NSGA-II/main.py", line 129, in nsga_ii_optimization(file, result_folder) File "c:/xue/code/python/MO-TSP-with-EA-main/Code/NSGA-II/main.py", line 77, in nsga_iioptimization DIM,,dis_matrix,edge_weight_matrix = Reader.read_tsp_file(f"{ARG.DATA_FOLDER}{tsp_file}") File "c:\xue\code\python\MO-TSP-with-EA-main\Code\NSGA-II\data_reader.py", line 79, in read_tsp_file with open(file_name,'r') as file: FileNotFoundError: [Errno 2] No such file or directory: '../../Data/dantzig42.tsp'

LeeAnnJ commented 2 months ago

请注意 readme 中给出的运行命令,main程序是在“NSGA-II”文件夹或者“SPEA2”文件夹下运行的,如果觉得不方便,可以在 argument.py 中更改文件的路径,感谢提出 issue~