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

📄 genseeds,v

📁 Lin-Kernighan heuristic for the TSP and minimum weight perfect matching
💻
字号:
head	1.1;access;symbols	zero-five-zero:1.1;locks	neto:1.1; strict;comment	@# @;1.1date	98.12.05.23.31.00;	author neto;	state Exp;branches;next	;desc@Generate generated data@1.1log@Initial revision@text@@@seeds=qw/ben.0.820.1000 dsjr.45.1000 pr1002 dsj1000 ben.7.827.1000/;@@salts=('ignacuosu','foble');open LOG, ">>genseeds.log";#print LOG scalar(localtime);my %outfiles = ();my $outfile;&generate;print LOG "\n",join("\n",(sort keys %outfiles)),"\n";print LOG "\n\n";print join("\n",(sort keys %outfiles)),"\n";close LOG;exit 0;sub generate {	foreach (@@salts) {		my $salt = $_;		print LOG  "SALT: $salt\n";		foreach (@@seeds) {			my $inst = $_;			print "$inst\n";			$outfile="infill.$inst.tsp"; $outfiles{$outfile}=1;			&doit("../src/infill .1 <$inst.tsp >$outfile");			my $seed = &hash("$inst"."cd$salt");			$outfile="cd.$seed.$inst.tsp"; $outfiles{$outfile}=1;			&doit("../src/clusterdiscount $seed <$inst.tsp >$outfile");			$seed = &hash($inst."cn$salt");			$outfile="cn.$seed.$inst.tsp"; $outfiles{$outfile}=1;			&doit("../src/clusternoise $seed <$inst.tsp >$outfile");			my @@pfs=qw/1 10 100/;			my @@jlbs=qw/-1 0.75 1/;			foreach (shift @@pfs) {				my $pf = $_;				my $jlb = shift @@jlbs;				$seed = &hash($inst."explode$salt");				$outfile="explode.s$seed.j$jlb.p$pf.$inst.tsp"; $outfiles{$outfile}=1;				&doit("../src/lk.deg -M $<inst.tsp | ../src/tspgen -s $seed -j $jlb -p $pf <$inst.tsp >$outfile");				$seed = &hash($inst."dangle$salt");				$outfile="dangle.s$seed.j$jlb.p$pf.$inst.tsp"; $outfiles{$outfile}=1;				&doit("../src/lk.deg -M $<inst.tsp | ../src/tspgen -i -s $seed -j $jlb -p $pf <$inst.tsp >$outfile");			}			if ( ! ($inst eq 'dsjr.45.1000' )) {				# Geometric only.				$seed = &hash($inst."jitter$salt");				$outfile="jitter.$seed.$inst.tsp"; $outfiles{$outfile}=1;				&doit("../src/jitter -s $seed <$inst.tsp >$outfile");				$seed = &hash($inst."shake$salt");				$outfile="shake.$seed.$inst.tsp"; $outfiles{$outfile}=1;				&doit("../src/shake -s $seed <$inst.tsp >$outfile");			}		}	}}sub doit{	my $cmd = shift;	print LOG $cmd,"\n";	print $cmd,"\n";#	system $cmd;}sub hash { 	my $str=shift;	if  ( !defined($str) ) { $str = "foobar" };	print LOG "   hash: .$str.\n";	my $ch;	my $c1 = 52845;  #Adobe type 1 font "encryption" constants...	my $c2 = 22719;  # But not the "encryption" algorithm.	my $val=0;	foreach $ch ( split(//,$str) ) {		$val = $val ^ $invchr{$ch};		$val = int($val * $c1 + $c2);	}	int ($val & 0x7ffff);}@

⌨️ 快捷键说明

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