Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FileFormats.MPS] Problem when reading generated MPS with CPLEX #2425

Closed
remi-garcia opened this issue Feb 9, 2024 · 3 comments · Fixed by #2431
Closed

[FileFormats.MPS] Problem when reading generated MPS with CPLEX #2425

remi-garcia opened this issue Feb 9, 2024 · 3 comments · Fixed by #2431
Labels
Submodule: FileFormats About the FileFormats submodule Type: Bug

Comments

@remi-garcia
Copy link
Contributor

When a binary variable is fixed, the generated MPS cannot be read with CPLEX due to 'FX' bound type illegal when prior bound given.

using JuMP
m = Model()
@variable(m, foo, Bin)
fix(foo, 1)
write_to_file(m, "mwe.mps")

mwe.mps file content:

NAME          
ROWS
 N  OBJ
COLUMNS
    MARKER    'MARKER'                 'INTORG'
    foo       OBJ       0
RHS
RANGES
BOUNDS
 BV bounds    foo
 FX bounds    foo       1
ENDATA

Then in CPLEX:

CPLEX> read mwe.mps
Selected objective sense:  MINIMIZE
Selected objective  name:  OBJ
Selected bound      name:  bounds
CPLEX Error  1454: Line 11: 'FX' bound type illegal when prior bound given.
No file read.

Removing BV bounds foo works. If the variable is fixed, the fact that it is a binary variable should not be stated anymore in the MPS file.

@odow
Copy link
Member

odow commented Feb 10, 2024

I hate non-standardized file formats.

Gurobi can read it fine:

(base) oscar@Oscars-MBP /tmp % gurobi_cl bug.mps 
Set parameter LogFile to value "gurobi.log"
Using license file /Users/oscar/gurobi.lic

Gurobi Optimizer version 10.0.0 build v10.0.0rc2 (mac64[x86])
Copyright (c) 2022, Gurobi Optimization, LLC

Warning: duplicate bounds for column foo.
Read MPS format model from file bug.mps
Reading time = 0.00 seconds
: 0 rows, 1 columns, 0 nonzeros

CPU model: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads

Optimize a model with 0 rows, 1 columns and 0 nonzeros
Model fingerprint: 0x4557e55e
Variable types: 0 continuous, 1 integer (1 binary)
Coefficient statistics:
  Matrix range     [0e+00, 0e+00]
  Objective range  [0e+00, 0e+00]
  Bounds range     [1e+00, 1e+00]
  RHS range        [0e+00, 0e+00]
Found heuristic solution: objective 0.0000000

Explored 0 nodes (0 simplex iterations) in 0.00 seconds (0.00 work units)
Thread count was 1 (of 8 available processors)

Solution count 1: 0 

Optimal solution found (tolerance 1.00e-04)
Best objective 0.000000000000e+00, best bound 0.000000000000e+00, gap 0.0000%

although it gives Warning: duplicate bounds for column foo..

From https://www.ibm.com/docs/en/icos/22.1.0?topic=standard-records-in-mps-format

image

So I guess we should treat BV as having implicit bounds, even though MOI tends to tread ZeroOne and bounds as a separate concept. (You could declare a variable as binary and fix it to 2, rendering the problem infeasible.)

I don't have a CPLEX binary, so can you check what it does for this (I assume also error):

NAME          
ROWS
 N  OBJ
COLUMNS
    MARKER    'MARKER'                 'INTORG'
    foo       OBJ       0
RHS
RANGES
BOUNDS
 BV bounds    foo
 UP bounds    foo       0.5
ENDATA

@odow odow added Type: Bug Submodule: FileFormats About the FileFormats submodule labels Feb 10, 2024
@remi-garcia
Copy link
Contributor Author

Thank you for your quick reply!

It fails again:

CPLEX> read test.mps
Selected objective sense:  MINIMIZE
Selected objective  name:  OBJ
Selected bound      name:  bounds
CPLEX Error  1458: Line 11: Repeated upper bound.
No file read.

@odow
Copy link
Member

odow commented Feb 10, 2024

Sigh. I guess we can/should fix this to prevent duplicate bounds from being written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Submodule: FileFormats About the FileFormats submodule Type: Bug
Development

Successfully merging a pull request may close this issue.

2 participants