ERGO-Code/HiGHS

.lp file parser silently accepts integer-named variables

Closed this issue · 2 comments

In the .lp file format, one is supposed to keep only variable names on left hand side of constraints, and constants on the right hand side.

That is, the following would be an invalid file:

Minimize
  x
Subject to
  x - 1 >= 2
Integer
  x
End

Nevertheless, HiGHS accepts this file as valid and concludes that the optimal objective is 2:

$ highs test.lp
Running HiGHS 1.6.0: Copyright (c) 2023 HiGHS under MIT licence terms
MIP  test has 1 rows; 1 cols; 1 nonzeros; 1 integer variables
Presolving model
0 rows, 0 cols, 0 nonzeros
0 rows, 0 cols, 0 nonzeros
Presolve: Optimal

Solving report
  Status            Optimal
  Primal bound      2
  Dual bound        2
  Gap               0% (tolerance: 0.01%)
  Solution status   feasible
                    2 (objective)
                    0 (bound viol.)
                    0 (int. viol.)
                    0 (row viol.)
  Timing            0.00 (total)
                    0.00 (presolve)
                    0.00 (postsolve)
  Nodes             0
  LP iterations     0 (total)
                    0 (strong br.)
                    0 (separation)
                    0 (heuristics)

I would expect it to either fail for this input, or to at least provide the result one would expect if this were a valid input; that is, an optimal objective value of 3.

Interesting. Gurobi also returns an optimal value of 2 but - critically - gives a warning

Warning: Numeric variable name in LP file ('1') - often the result of a constant term in the left-hand side of a constraint.

I'll add a warning to HiGHS

Fixing this - even writing out a warning and returning kWarning - is far too much work to justify at present.