#!/usr/bin/perl

$colors = 3;
@multipliers = (2.0);
@cases = (60);
$startgraph = 1;
$startcase = 1;
$TYPE = "APO2";
$RANDOMIZE = "SAT";
foreach $multiplier (@multipliers){
	foreach $i (@cases){
  		$prec = $i * $multiplier;
  		$edges = int($prec + 0.5);
  		for ($g = $startgraph; $g <=10; $g++) {
			for($c = $startcase;$c<=10;$c++){
      				run($i, $edges, $colors, $g, $c);	
    			}
    			$startcase = 1;
  		}
  		$startgraph = 1;
	}
}

sub run {
	($NODES, $EDGES, $COLORS, $GNUM, $CASENUM) = @_;
	$CMD = "./rungraphcolor -type $TYPE -nodes $NODES -edges $EDGES -colors 3 -vfile ./cases/$NODES-$EDGES-$COLORS-$GNUM-$CASENUM.txt -gfile ./cases/$NODES-$EDGES-$COLORS-$GNUM.txt -randomize $RANDOMIZE";

	print "$CMD\n";
	system ("$CMD");
	print "- rungraphcolor done\n";

	`cp ../simulator/simulator.sav ./data/$TYPE.$NODES.$EDGES.$COLORS.$GNUM.$CASENUM.sav`;
	`cp ../graphcolor/colors.log ./data/$TYPE.$NODES.$EDGES.$COLORS.$GNUM.$CASENUM.log`;
	`killall -9 rmiregistry`;
	sleep(10);
}
