⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lkdoitcmp.in

📁 Lin-Kernighan heuristic for the TSP and minimum weight perfect matching
💻 IN
字号:
#! @PERL@# @configure_input@# doitcmp# Make multiple versions of lk binaries, each with different levels of # declustering support.# This Perl script got a little out of hand.  # I didn't want to change the Makefile too much...  :)# This must be run from within the source directory.## This script takes no arguments$header= "declevel.h";$tmpheader= "/tmp/perlsub$$";$ident_expr="[A-Za-z_][A-Za-z_0-9]*";&compile("lk.no_d","JBMR_DECLUSTER_IN_ELIGIBILITY_TEST",0,"JBMR_DECLUSTER_IN_GREEDY",0);&compile("lk.deg","JBMR_DECLUSTER_IN_ELIGIBILITY_TEST",1,"JBMR_DECLUSTER_IN_GREEDY",1);# Put declustering second so that it is the default left in declevel.h# when we ship out the code.exit 0;sub compile {	local($name) = shift(@_);	&substitute(@_);	system("touch $header"); print "===touch $header\n";	system("touch lk.c"); print "===touch lk.c\n";	system("rm lk.o"); print "===rm lk.o\n";	system("make lk"); 		 print "===make lk\n";	system("mv lk $name");   print "===mv lk $name\n";#	system("strip $name");  # This is optional.	print STDERR "made $name\n";}sub substitute {	local(%substitutions)=@_;	local(%dict);	local($processing)=1;	local($s);	foreach $symbol (keys(%substitutions)) {		$dict{$symbol} = 1;	}	open(HEADERIN,"<$header") || die "Can't open $header for reading";	open(HEADEROUT, ">$tmpheader") || die "Can't open $tmpheader for writing";	while(<HEADERIN>) {		#print "line:$_";		if ($processing && m/^.define\s+($ident_expr)/ && $dict{$1} ) {			#print "MATCH";			$s=$substitutions{$1};			print HEADEROUT "#define $1 $s\n";		} elsif (m/Don\'t touch the following/) {			$processing=0;			#print "STOP PROCESSING\n";			print HEADEROUT;		} else {			print HEADEROUT;		}	}	close(HEADERIN);	close(HEADEROUT);	open(HEADERIN,"<$tmpheader") || die "Can't open $tmpheader for reading";	open(HEADEROUT, ">$header") || die "Can't open $header for writing";	while(<HEADERIN>) {		print HEADEROUT;	}	close(HEADERIN);	close(HEADEROUT);	unlink($tmpheader);}

⌨️ 快捷键说明

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