Skip to content

[FileFormats.LP] read files with [] in names #2992

@odow

Description

@odow

This came up during the HiGHS developer call.

CVXPY was writing LP files that contained []: cvxpy/cvxpy#3282

HiGHS failed. JuMP does too:

julia> using JuMP

julia> write("/tmp/test.lp", "minimize x[1]\nst\nc:x[1] >= 0\nend")
32

julia> read_from_file("/tmp/test.lp")
ERROR: Error parsing LP file on line 1:
minimize x[1]
          ^
Got the symbol `[`. We expected this token to be a keyword defining a new section.
Stacktrace:

But Gurobi runs without a problem.

I think we should keep the current behaviour of replacing [] with _ during write because technically they are not valid LP files.

The argument for reading them is that x[1,2] is a fairly common naming convention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions