Question: Bad solution display from LPSolve

The solution from LPSolve shown in the worksheet below is displayed very weirdly:

  1. The first element is rounded to 3 significant digits.
  2. The variable indices have decimal points.
  3. Zeros are displayed as just decimal points with no digit 0.

Closer inspection (with, say, lprint) will reveal that the weirdness is only with the prettyprinting; the actual entries are as expected.
 

restart:

<(kernelopts,interface)(version), interface~([prettyprint, typesetting])[]>;

Vector(4, {(1) = `Maple 2022.1, X86 64 WINDOWS, May 26 2022, Build ID 1619613`, (2) = `Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`, (3) = 2, (4) = extended})

(a,b,c):= (2,4,5):

X:= Matrix((a,b), symbol= x):
Y:= Matrix((b,c), symbol= y):
Z:= Matrix((a,c), symbol= z):

RegionC:= <5, 15, 8, 10, 15>:

RegionA:= <90, 75>:

RegionB:= <35, 20, 30, 15>:

Cost1:= <
    2, 1, 3/2,   3;
  5/2, 2, 7/2, 3/2
>:

Cost2:= <
    3/2, 4/5, 1/2, 3/2,   3;
      1, 1/2, 1/2,   1, 1/2;
      1, 3/2,   2,   2, 1/2;
    5/2, 3/2, 3/5, 3/2, 1/2
>:

Cost3:= <
    11/4, 7/2, 5/2, 3,   5/2;
       3, 7/2, 7/2, 5/2, 2
>:

Cost__Total:= (add@(add@`*`~)~)([Cost||(1..3)], [X,Y,Z]):

CapB:= add(X[i], i= 1..a) <=~ RegionB:

CapA:= add(<X|Z>[..,j], j= 1..b+c) <=~ RegionA:

ReqC:= add(<Y,Z>[i], i= 1..a+b) >=~ RegionC:

InEqOutB:= add(<X, -Y^%T>[i], i= 1..a+c) =~ 0:

Cons:= seq~({CapA, CapB, ReqC, InEqOutB}):

Sol:= Optimization:-LPSolve(Cost__Total, Cons, assume= nonnegative);

[103.800000000310, [x[1, 1] = HFloat(0.0), x[1, 2] = HFloat(20.000000000344205), x[1, 3] = HFloat(7.999999999311598), x[1, 4] = HFloat(0.0), x[2, 1] = HFloat(0.0), x[2, 2] = HFloat(0.0), x[2, 3] = HFloat(0.0), x[2, 4] = HFloat(15.000000000688408), y[1, 1] = HFloat(0.0), y[1, 2] = HFloat(0.0), y[1, 3] = HFloat(-1.7763568394002505e-15), y[1, 4] = HFloat(0.0), y[1, 5] = HFloat(0.0), y[2, 1] = HFloat(0.0), y[2, 2] = HFloat(15.0), y[2, 3] = HFloat(5.000000000344206), y[2, 4] = HFloat(0.0), y[2, 5] = HFloat(0.0), y[3, 1] = HFloat(5.000000000000002), y[3, 2] = HFloat(0.0), y[3, 3] = HFloat(0.0), y[3, 4] = HFloat(0.0), y[3, 5] = HFloat(2.9999999993115956), y[4, 1] = HFloat(0.0), y[4, 2] = HFloat(0.0), y[4, 3] = HFloat(2.9999999996557944), y[4, 4] = HFloat(0.0), y[4, 5] = HFloat(12.000000000688413), z[1, 1] = HFloat(0.0), z[1, 2] = HFloat(0.0), z[1, 3] = HFloat(0.0), z[1, 4] = HFloat(0.0), z[1, 5] = HFloat(0.0), z[2, 1] = HFloat(0.0), z[2, 2] = HFloat(0.0), z[2, 3] = HFloat(0.0), z[2, 4] = HFloat(10.0), z[2, 5] = HFloat(0.0)]]

 

 

Download BadLPSolveDisp.mw

Please Wait...