LP Writer does not write RHS values for constraints
Hello!
I tried to export the following model as .lp file:
// [...]
double[] cc = { 1, -2 };
double[] cl = { -1, 0 };
double[] cu = { 10, 10 };
double[] rl = { 0, 0 };
double[] ru = { 2, 1 };
int[] conStart = { 0, 2 };
int[] conVarIndex = { 0, 1, 0, 1 };
double[] conCoeff = { 1, 2, 1, 3 };
HighsObjectiveSense sense = HighsObjectiveSense.kMinimize;
double offset = 0;
HighsMatrixFormat a_format = HighsMatrixFormat.kColwise;
HighsModel model = new HighsModel(cc, cl, cu, rl, ru, conStart, conVarIndex, conCoeff, offset, a_format, sense);
HighsLpSolver solver = new HighsLpSolver();
HighsStatus status = solver.passLp(model);
solver.writeModel("test.lp");
// [...]
The produced test.lp does not contain the <= RHS parts for the constraints:
\ File written by Highs .lp filereader
min
obj: +1 x1 -2 x2
st
con1lo: +1 x1 +1 x2 >= +0
con2lo: +2 x1 +3 x2 >= +0
bounds
-1 <= x1 <= +10
+0 <= x2 <= +10
end
I'd expect the LP file to contain something similar to this:
con1up: +1 x1 +1 x2 <= +2
con2up: +2 x1 +3 x2 <= +1
Note: The model is solved correctly regardless, i.e. the RHS are considered by the solver:
Presolving model
2 rows, 2 cols, 4 nonzeros
2 rows, 2 cols, 4 nonzeros
Presolve : Reductions: rows 2(-0); columns 2(-0); elements 4(-0)
Solving the presolved LP
Using EKK dual simplex solver - serial
Iteration Objective Infeasibilities num(sum)
0 0.0000000000e+00 Ph1: 0(0) 0s
1 -3.0000000000e+00 Pr: 0(0) 0s
Solving the original LP from the solution after postsolve
Model status : Optimal
Simplex iterations: 1
Objective value : -3.0000000000e+00
HiGHS run time : 0.07
Status: kOk
Modelstatus: kOptimal
Activity for row 0 = 0
Activity for row 1 = 1
Reduced cost x[0] = 2,333333333333333
Reduced cost x[1] = 0
Dual value for row 0 = -0
Dual value for row 1 = -0,6666666666666666
x0 = -1 is kLower
x1 = 1 is kBasic
Best Regards Jannick
Sorry, we've fixed other issues with the .lp file writer recently, and this error must have crept in somehow. I'll get it fixed
Actually, now I see that you have lower bounds on the rows, what you've exposed is a bug in v1.2.2 that was one of the issues I quoted as having been fixed, and will be correct in our next release. With master, I get
cat test.lp \ File written by HiGHS .lp file handler min obj: +1 x1 -2 x2 st con1lo: +1 x1 +1 x2 >= +0 con1up: +1 x1 +1 x2 <= +2 con2lo: +2 x1 +3 x2 >= +0 con2up: +2 x1 +3 x2 <= +1 bounds -1 <= x1 <= 10 0 <= x2 <= 10 end