coin-or/CoinUtils

is_sense parsing error when `<` at position 1023 in a constraint line

dlaehnemann opened this issue · 3 comments

I've been tripped up by a very weird bug, that led to a line parsing failure and then down the line to renamed variables, so that I could not use the eventual solution. Here's the minimal example to reproduce the problem (simply rename to the extension '.lp, GitHub doesn't allow uploads with that extension...):

buffer_size_issue.txt

When running cbc buffer_size_issue.lp solve on it, it throws:

Welcome to the CBC MILP Solver 
Version: 2.10.5 
Build Date: Dec  8 2020 

command line - cbc weird_corner_case.lp solve (default strategy 1)
### ERROR: CoinLpIO: is_sense(): string: < 
 CoinLpIO::readLp(): Maximization problem reformulated as minimization
### CoinLpIO::is_invalid_name(): Name < contains illegal character '<'
### CoinLpIO::are_invalid_names(): Invalid name: vnames[63]: <
### CoinLpIO::readLp(): Invalid column names
Now using default column names.

As deleting any single char in the c6708: line makes this error go away, and the < char (from <=) is in position 1023 of the line, and the buffer size for parsing is 1024, I am assuming it is something to do with this combination chopping up the <= and then is_sense complaining that there's only the < and no = following it in the buffer. I guess this special requires explicit handling in is_sense and maybe elsewhere, as well?

Hi John,

the swift response is very much appreciated, and this does fix the minimal example I provided. So I'll close this issue.

However, I've found some further parsing issues and created the follow-up issues #145 and #146.

Thanks a lot and best regards,
David