+<%perl>
+}
+
+{
+ my $input= pipethrough_prep();
+ print $input $cplex or die $!;
+ my $output= pipethrough_run_along($input, undef, 'glpsol',
+ qw(glpsol --cpxlp /dev/stdin -o /dev/stdout));
+ print "<pre>\n" if $qa->{'debug'};
+ my $found_section= 0;
+ while (<$output>) {
+ print encode_entities($_) if $qa->{'debug'};
+ if (m/^\s*No\.\s+Column name\s+St\s+Activity\s/) {
+ die if $found_section>0;
+ $found_section= 1;
+ next;
+ }
+ next unless $found_section==1;
+ next if m/^[- ]+$/;
+ if (!/\S/) {
+ $found_section= 2;
+ next;
+ }
+ m/^\s*\d+\s+f(\d+)\s+\S+\s+(\d+)\s/ or die "$_ ?";
+ die if $1 >= @flows;
+ $flows[$1]{Optimal}= $2;
+ }
+ print "</pre>\n" if $qa->{'debug'};
+ pipethrough_run_finish($output, 'glpsol');
+ die unless $found_section;
+};
+
+print join ' ', map { $_->{Optimal} } @flows;
+
+</%perl>
+% } # ========== OPTIMISATION ==========