X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Froutetrade;h=5dc5e774a40f8c839a26ef28c75d8c6b9bc7b31a;hb=62e5bf60d55a8e6ff3d938e2719d910ee4367210;hp=1f8df2a5afdb6eafd5215a38f71cce74ad03dce5;hpb=f7c3c04f684b0e9cac4518beeece11853ef75109;p=ypp-sc-tools.web-test.git diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 1f8df2a..5dc5e77 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -261,6 +261,15 @@ foreach my $v (qw(MaxMass MaxVolume)) { <& dumptable:end, qa => $qa &> % } +% if (@islandids==1) { +% if (defined $islandids[0]) { +Searched for arbitrage trades only. +% } else { +Searched for arbitrage trades only, in <% $archipelagoes[0] |h %> +[?]. +% } +% } + <%perl> my @sail_total; @@ -415,7 +424,7 @@ foreach my $flow (@flows) { if ($flow->{Suppress}) { foreach my $sf (@{ $flow->{Subflows} }) { $cplex .= " - $sf->{Var} = 0"; + $sf->{Var} = 0\n"; } next; } @@ -524,7 +533,7 @@ if ($qa->{'debug'}) { $found_section= 1; next; } - if (m/^Objective:\s+totalprofit = (\d+\.\d*) /) { + if (m/^Objective:\s+totalprofit = (\d+(?:\.\d*)?) /) { $expected_total_profit= $1; } next unless $found_section==1; @@ -545,7 +554,7 @@ if ($qa->{'debug'}) { \s* \d+ \s+ (\w+) \s+ (?: [A-Z*]+ \s+ )? ([0-9.]+) \s - /x or die "$_ ?"; + /x or die "$cplex \n==\n $glpsol_out $_ ?"; if ($varname =~ m/^f(\d+)s(\d+)_/) { my ($ix,$orgix) = ($1,$2); my $flow= $flows[$ix] or die; @@ -565,6 +574,7 @@ if ($qa->{'debug'}) { my $prerr= "\n=====\n$cplex\n=====\n$glpsol_out\n=====\n "; pipethrough_run_finish($output,$prerr); map { defined $_->{OptQty} or die "$prerr $_->{Flow}{Ix}" } @subflows; + defined $expected_total_profit or die "$prerr ?"; }; $addcols->({ DoReverse => 1, TotalSubflows => 1, Special => sub { @@ -596,11 +606,20 @@ $addcols->({ Total => 0, DoReverse => 1, TotalSubflows => 1 }, qw( + + % }
  • Data age summary
  • Relevant trades +% } else { +% my @tl= gmtime $now or die $!; +

    +Generated by YARRG at <% + sprintf "%04d-%02d-%02d %02d:%02d:%02d UTC", + $tl[5]+1900, @tl[4,3,2,1,0] + |h %>. % } % if ($optimise) { # ========== TRADING PLAN ========== @@ -613,9 +632,16 @@ $addcols->({ Total => 0, DoReverse => 1, TotalSubflows => 1 }, qw( %

    Voyage trading plan

    - +
    > +% my $tbody= sub { +% if (!printable($m)) { return ''; } +%# return " +<% $tbody->(1) %> +<% $tbody->(0) %> % } % $total += $t->{Total}; % my $span= 0 + keys %{ $t->{Stalls} }; % my $td= "td rowspan=$span"; - +% tr_datarow($m,$dline); <<% $td %>><% $collectdeliver %> <<% $td %>><% $t->{'commodname'} |h %> % @@ -741,7 +767,7 @@ $addcols->({ Total => 0, DoReverse => 1, TotalSubflows => 1 }, qw( <<% $td %> align=right><% $t->{Total} |h %> total % % foreach my $stallix (1..$#stalls) { - +% tr_datarow($m,$dline); % $pstall->($stallix); % } % @@ -773,7 +799,7 @@ $addcols->({ Total => 0, DoReverse => 1, TotalSubflows => 1 }, qw( $show_total_now->($totals); } - +<% $tbody->(1) %>

    "; +% my ($c)= qw(40 00)[$_[0]]; +% return "
    "; +% }; +% % foreach my $i (0..$#islandids) { -
    % $iquery->execute($islandids[$i]); % my ($islandname) = $iquery->fetchrow_array(); @@ -720,12 +746,12 @@ $addcols->({ Total => 0, DoReverse => 1, TotalSubflows => 1 }, qw( (Data age: <% prettyprint_age($age) %>) % } elsif (!defined $total) { % $total= 0; -
    Total distance: <% $total_dist %> leagues. Overall net cash flow <% @@ -831,14 +857,6 @@ END <&| query_age:agestable, now => $now, fetchrow => $fetchrow &> Islands shown in reverse order of visits.
    -% } else { -% my @tl= gmtime $now or die $!; -

    -Generated by YARRG at <% - sprintf "%04d-%02d-%02d %02d:%02d:%02d UTC", - $tl[5]+1900, @tl[4,3,2,1,0] - |h %>. -%# % } % if (!printable($m)) {