chiark / gitweb /
Implement constraint on available capital
[ypp-sc-tools.db-test.git] / yarrg / web / routetrade
index 0da1fd80a81929454605e46df2064d56d26d3083..73740ea346621e5b678a9641e2b9ef5911afc412 100644 (file)
@@ -41,6 +41,7 @@ $qa
 $max_mass
 $max_volume
 $lossperleaguepct
+$max_capital
 </%args>
 <&| script &>
   da_pageload= Date.now();
@@ -451,6 +452,12 @@ foreach my $ci (0..($#islandids-1)) {
        join(" + ", map { ($_->{"unit$mv"}*1e-3).' f'.$_->{Ix} } @rel_flows).
        " <= $max";
        }
+       if (defined $max_capital) {
+          $cplex .= "
+   ". sprintf("%-10s","capital_$ci:")." ".
+       join(" + ", map { ($_->{"org_price"}).' f'.$_->{Ix} } @rel_flows).
+        " <= $max_capital";
+        }
        $cplex.= "\n";
 }