我按照上面“Stephen Davison”给出的答案进行尝试,但是仍然遇到了缺少cygwin1.dll文件的错误。我的C盘中已安装32位的cygwin。我所做的是从C:\cygwin\bin目录下获取cygwin1.dll文件,并将其粘贴到我的R工作目录E:\ RA \ Concorde_Code中。
然后在我安装有64位R-studio的计算机上,我运行了以下代码来检查Concorde是否可用:
concordePath = "E:/RA/Concorde_Code/"
concorde_path(concordePath)
它说以下内容
found: concorde concorde.exe
然后我运行了以下代码
concorde_help()
它给了我以下的输出。
The following options can be specified in solve_TSP with method "concorde" using clo in control:
/Concorde_Code/concorde
Usage: /Concorde_Code/concorde [-see below-] [dat_file]
-B do not branch
-C
-d use dfs branching instead of bfs
-D f edgegen file for initial edge set
-e f initial edge file
-E f full edge file (must contain initial edge set)
-f write optimal tour as edge file (default is tour file)
-F f read extra cuts from file
-g h be a grunt for boss h
-h be a boss for the branching
-i just solve the blossom polytope
-I just solve the subtour polytope
-J
-k
-K h use cut server h
-M f master file
-m use multiple passes of cutting loop
-n s problem location (just a name or host:name, not a file name)
-o f output file name (for optimal tour)
-P f cutpool file
-q do not cut the root lp
-r
-R f restart file
-s
-S f problem file
-t f tour file (in node node node format)
-u v initial upperbound
-U do not permit branching on subtour inequalities
-v verbose (turn on lots of messages)
-V just run fast cuts
-w just subtours and trivial blossoms
-x delete files on completion (sav pul mas)
-X f write the last root fractional solution to f
-y use simple cutting and branching in DFS
-z
-N
0=MAX, 1=L1, 2=L2, 3=3D, 4=USER, 5=ATT, 6=GEO, 7=MATRIX,
8=DSJRAND, 9=CRYSTAL, 10=SPARSE, 11-15=RH-norm 1-5, 16=TOROIDAL
17=GEOM, 18=JOHNSON
这证实了Concorde已经正确安装并且正常工作。
安装完成后,我运行了TSP代码来检查Concorde的工作情况,使用以下代码:
tour_test <- solve_TSP(tsp_test, method = "concorde")
现在它正常工作了。我得到了以下输出
Used control parameters:
clo =
exe = E:\RA\Concorde_Code\/concorde
precision = 6
verbose = TRUE
keep_files = FALSE
/Concorde_Code/concorde -x -o file225841777aa0.sol file225841777aa0.dat
Host: Pasha Current process id: 1193
Using random seed 1586547969
Problem Name: TSP
Generated by write_TSPLIB (R-package TSP)
Problem Type: TSP
Number of Nodes: 6
Explicit Lengths (CC_MATRIXNORM)
Optimal Solution: 60000.00
Total Running Time: 0.01 (seconds)