chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-test.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Docs correct for new expected losses box
[ypp-sc-tools.db-test.git]
/
yarrg
/
web
/
routetrade
diff --git
a/yarrg/web/routetrade
b/yarrg/web/routetrade
index cb7550e5e127f1a8e7a1623d8861b80144507d2b..831a1b1a26a2d46f051ec4265f8089cb13fbf7da 100644
(file)
--- a/
yarrg/web/routetrade
+++ b/
yarrg/web/routetrade
@@
-38,15
+38,24
@@
$dbh
@islandids
@archipelagoes
$qa
@islandids
@archipelagoes
$qa
+$max_mass
+$max_volume
+$lossperleaguepct
</%args>
<&| script &>
da_pageload= Date.now();
</&script>
</%args>
<&| script &>
da_pageload= Date.now();
</&script>
+% if (defined $max_mass || defined $max_volume) {
+<strong>WARNING - VESSEL CAPACITY LIMIT NOT YET IMPLEMENTED</strong>
+<p>
+% }
+
<%perl>
<%perl>
+my $loss_per_league= defined $lossperleaguepct ? $lossperleaguepct*0.01 : 1e-7;
+
my $now= time;
my $now= time;
-my $loss_per_league= 1e-7;
my @flow_conds;
my @query_params;
my @flow_conds;
my @query_params;
@@
-365,7
+374,7
@@
die "$cmpu $uue ?" if length $cmpu > 20;
<p>
% if (@islandids<=1) {
<p>
% if (@islandids<=1) {
-Route
is trivial
.
+Route
contains only one location
.
% }
% if (!$specific) {
Route contains archipelago(es), not just specific islands.
% }
% if (!$specific) {
Route contains archipelago(es), not just specific islands.
@@
-383,9
+392,9
@@
my $cplex= "
Maximize
totalprofit:
Maximize
totalprofit:
- ".(join "
+
+ ".(join "
", map {
", map {
- sprintf "%.20f %s", $_->{ExpectedUnitProfit}, $_->{Var}
+ sprintf "%
+
.20f %s", $_->{ExpectedUnitProfit}, $_->{Var}
} @flows)."
Subject To
} @flows)."
Subject To
@@
-472,7
+481,14
@@
if ($qa->{'debug'}) {
die $prerr unless $found_section;
};
die $prerr unless $found_section;
};
-$addcols->({ DoReverse => 1 }, qw(
+$addcols->({ DoReverse => 1, Special => sub {
+ my ($flow,$col,$v,$spec) = @_;
+ if ($flow->{ExpectedUnitProfit} < 0) {
+ $spec->{Span}= 3;
+ $spec->{String}= '(Small margin)';
+ $spec->{Align}= 'align=center';
+ }
+} }, qw(
OptQty
));
$addcols->({ Total => 0, DoReverse => 1 }, qw(
OptQty
));
$addcols->({ Total => 0, DoReverse => 1 }, qw(
@@
-551,16
+567,25
@@
$addcols->({ Total => 0, DoReverse => 1 }, qw(
<td><input type=hidden name=R<% $flow->{UidShort} %> value="">
<input type=checkbox name=T<% $flow->{UidShort} %> value=""
<% $flow->{Suppress} ? '' : 'checked' %> >
<td><input type=hidden name=R<% $flow->{UidShort} %> value="">
<input type=checkbox name=T<% $flow->{UidShort} %> value=""
<% $flow->{Suppress} ? '' : 'checked' %> >
-% foreach my $ci (1..$#cols) {
+% my $ci= 1;
+% while ($ci < @cols) {
% my $col= $cols[$ci];
% my $col= $cols[$ci];
+% my $spec= {
+% Span => 1,
+% Align => ($col->{Text} ? '' : 'align=right')
+% };
% my $v= $flow->{$col->{Name}};
% my $v= $flow->{$col->{Name}};
+% if ($col->{Special}) { $col->{Special}($flow,$col,$v,$spec); }
% $col->{Total} += $v
% if defined $col->{Total} and not $flow->{Suppress};
% $v='' if !$col->{Text} && !$v;
% my $sortkey= $col->{SortColKey} ?
% $flow->{$col->{SortColKey}} : $v;
% $ts_sortkeys{$ci}{$rowid}= $sortkey;
% $col->{Total} += $v
% if defined $col->{Total} and not $flow->{Suppress};
% $v='' if !$col->{Text} && !$v;
% my $sortkey= $col->{SortColKey} ?
% $flow->{$col->{SortColKey}} : $v;
% $ts_sortkeys{$ci}{$rowid}= $sortkey;
-<td <% $col->{Text} ? '' : 'align=right' %>><% $v |h %>
+<td <% $spec->{Span} ? "colspan=$spec->{Span}" : ''
+ %> <% $spec->{Align}
+ %>><% exists $spec->{String} ? $spec->{String} : $v |h %>
+% $ci += $spec->{Span};
% }
% }
<tr id="trades_total">
% }
% }
<tr id="trades_total">
@@
-597,11
+622,11
@@
$addcols->({ Total => 0, DoReverse => 1 }, qw(
<tr><td colspan=3>
% $iquery->execute($islandids[$i]);
% my ($islandname) = $iquery->fetchrow_array();
<tr><td colspan=3>
% $iquery->execute($islandids[$i]);
% my ($islandname) = $iquery->fetchrow_array();
-% my $this_dist= $distance->($islandids[$i-1],$islandids[$i]);
-% $total_dist += $this_dist;
% if (!$i) {
<strong>Start at <% $islandname |h %></strong>
% } else {
% if (!$i) {
<strong>Start at <% $islandname |h %></strong>
% } else {
+% my $this_dist= $distance->($islandids[$i-1],$islandids[$i]);
+% $total_dist += $this_dist;
<strong>Sail to <% $islandname |h %></strong>
- <% $this_dist |h %> leagues </td>
% }
<strong>Sail to <% $islandname |h %></strong>
- <% $this_dist |h %> leagues </td>
% }