distcalc.pl.in

来自「Lin-Kernighan heuristic for the TSP and 」· IN 代码 · 共 27 行

IN
27
字号
#! @PERL@# @configure_input@# distcalc.pl# Read a TSPLIB instance on the input, followed by pairs of vertices u,v.# For each pair $u,v$, output the distance between u and v in that# instance.# The TSPLIB instance must end with EOF, so we know where to start looking# at pairs of vertices.# The vertices are 1-based, just like in TSPLIB instances.use TSP;$|=1;$tsp = new TSP;$tsp->read(\*STDIN);#$tsp->write(\*STDOUT);while (<>) {	if (m/(\d+)\s+(\d+)/) {		$u = $1;		$v = $2;		print "u is $u v is $v\n";		print "Distance between $u and $v is ",$tsp->cost($u,$v),"\n";	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?