coin-or / CoinUtils

COIN-OR Utilities
Other
44 stars 41 forks source link

'+' in lp file is interpreted as variable name #195

Closed MitI-7 closed 1 year ago

MitI-7 commented 2 years ago

Error occurs when reading the following lp file. It seems to interpret '+' as a variable name. invalid.txt

Cbc-releases.2.10.8-x86_64-ubuntu18-gcc750-static.tar (https://github.com/coin-or/Cbc/releases/tag/releases/2.10.8)

Welcome to the CBC MILP Solver
Version: 2.10.8
Build Date: May  5 2022

command line - ./cbc invalid.lp (default strategy 1)
 CoinLpIO::readLp(): Maximization problem reformulated as minimization
### CoinLpIO::is_invalid_name(): Name + contains illegal character '+'
### CoinLpIO::are_invalid_names(): Invalid name: vnames[92]: +
### CoinLpIO::readLp(): Invalid column names
Now using default column names.
Coin0009I Switching back to maximization to get correct duals etc
Presolve 0 (-1) rows, 0 (-94) columns and 0 (-93) elements
Empty problem - 0 rows, 0 columns and 0 elements
Optimal - objective value 10
After Postsolve, objective 10, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 10 - 0 iterations time 0.002, Presolve 0.00
Total time (CPU seconds):       0.00   (Wallclock seconds):       0.00

It worked fine in the older version. Cbc-2.9.10-linux-x86_64-gcc4.8.tgz (https://www.coin-or.org/download/binary/Cbc/)

Welcome to the CBC MILP Solver
Version: 2.9.10
Build Date: Feb 23 2019

command line - ./cbc invalid.lp (default strategy 1)
 CoinLpIO::readLp(): Maximization problem reformulated as minimization
Presolve 0 (-1) rows, 0 (-93) columns and 0 (-93) elements
Empty problem - 0 rows, 0 columns and 0 elements
Optimal - objective value -10
After Postsolve, objective -10, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective -10 - 0 iterations time 0.002, Presolve 0.00
Total time (CPU seconds):       0.00   (Wallclock seconds):       0.00
jjhforrest commented 2 years ago

In current version input buffer is 1024 characters long.  It looks as if in the past it may have been 8192 (at least in some places) and the equation is more than 1024 characters.

Will look at it - although I am not the expert for CoinLpIO.  Should be able to code for infinite length lines.

On 13/08/2022 05:49, MitI_7 wrote:

Error occurs when reading the following lp file. It seems to interpret '+' as a variable name. invalid.txt https://github.com/coin-or/CoinUtils/files/9330760/invalid.txt

Cbc-releases.2.10.8-x86_64-ubuntu18-gcc750-static.tar (https://github.com/coin-or/Cbc/releases/tag/releases/2.10.8)

|Welcome to the CBC MILP Solver Version: 2.10.8 Build Date: May 5 2022 command line - ./cbc invalid.lp (default strategy 1) CoinLpIO::readLp(): Maximization problem reformulated as minimization

CoinLpIO::is_invalid_name(): Name + contains illegal character '+'

CoinLpIO::are_invalid_names(): Invalid name: vnames[92]: +

CoinLpIO::readLp(): Invalid column names Now using default column names. Coin0009I Switching back to maximization to get correct duals etc Presolve 0 (-1) rows, 0 (-94) columns and 0 (-93) elements Empty problem - 0 rows, 0 columns and 0 elements Optimal - objective value 10 After Postsolve, objective 10, infeasibilities - dual 0 (0), primal 0 (0) Optimal objective 10 - 0 iterations time 0.002, Presolve 0.00 Total time (CPU seconds): 0.00 (Wallclock seconds): 0.00 |

It worked fine in the older version. Cbc-2.9.10-linux-x86_64-gcc4.8.tgz (https://www.coin-or.org/download/binary/Cbc/)

|Welcome to the CBC MILP Solver Version: 2.9.10 Build Date: Feb 23 2019 command line - ./cbc invalid.lp (default strategy 1) CoinLpIO::readLp(): Maximization problem reformulated as minimization Presolve 0 (-1) rows, 0 (-93) columns and 0 (-93) elements Empty problem - 0 rows, 0 columns and 0 elements Optimal - objective value -10 After Postsolve, objective -10, infeasibilities - dual 0 (0), primal 0 (0) Optimal objective -10 - 0 iterations time 0.002, Presolve 0.00 Total time (CPU seconds): 0.00 (Wallclock seconds): 0.00 |

— Reply to this email directly, view it on GitHub https://github.com/coin-or/CoinUtils/issues/195, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWJYHH2XJSYPGR5ZMZSUYTVY4SMXANCNFSM56NQMUEQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

jjhforrest commented 2 years ago

Simple fix in stable shouldn't do any harm. Changes in master for very long names would also seem to work, but this is simple change.