X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=yarrg%2Fweb%2Froutetrade;h=7db07721efa2b04da634b27eaef3ade6cab34621;hp=ce319facae713bb9e32edddf86a1509d979b4772;hb=ae926461ebeb67c806caa7be5d85d18a02a08177;hpb=05a607330cc73832ccc778cd10f69cbac8e6dba3 diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index ce319fa..7db0772 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -407,11 +407,17 @@ Maximize totalprofit: "; +my %stall_poe_limits; + foreach my $sf (@subflows) { my $eup= $sf->{Flow}{ExpectedUnitProfit}; $eup *= (1.0-$loss_per_delay_slot) ** $sf->{Org}; $cplex .= sprintf " %+.20f %s", $eup, $sf->{Var}; + if ($qa->{ShowStalls}>=2) { + my $stall= $sf->{Flow}{'dst_stallid'}; + push @{ $stall_poe_limits{$stall} }, $sf; + } } $cplex .= " @@ -485,6 +491,24 @@ foreach my $ci (0..($#islandids-1)) { $cplex.= "\n"; } +if ($qa->{ShowStalls}>=2) { + my $stallpoe= $dbh->prepare(< $b } keys %stall_poe_limits) { + $stallpoe->execute($stallid); + my ($lim)= $stallpoe->fetchrow_array(); + $stallpoe->finish(); + $cplex.= " + ". sprintf("%-15s","poe_$stallid:")." ". + join(" + ", map { + sprintf "%d %s", $_->{Flow}{'dst_price'}, $_->{Var}; + } @{ $stall_poe_limits{$stallid} }). + " <= $lim"; + } + $cplex.= "\n"; +} + $cplex.= " Bounds ".(join " @@ -512,7 +536,7 @@ if ($qa->{'debug'}) { my $input= pipethrough_prep(); print $input $cplex or die $!; my $output= pipethrough_run_along($input, undef, 'glpsol', - qw(glpsol --tmlim 2 --memlim 5 --intopt --cuts --bfs + qw(glpsol --tmlim 5 --memlim 5 --intopt --cuts --bfs --cpxlp /dev/stdin -o /dev/stdout)); print "
\n" if $qa->{'debug'};
 	my $found_section= 0;
@@ -546,7 +570,7 @@ if ($qa->{'debug'}) {
 		my ($varname, $qty) = m/^
 			\s* \d+ \s+
 			(\w+) \s+ (?: [A-Z*]+ \s+ )?
-			([0-9.]+) \s
+			([+-e0-9.]+) \s
 			/x or die "$cplex \n==\n $glpsol_out $_ ?";
 		if ($varname =~ m/^f(\d+)s(\d+)_/) {
 			my ($ix,$orgix) = ($1,$2);