-
Notifications
You must be signed in to change notification settings - Fork 92
[FileFormats.MPS] fix scale factor in Gurobi's QCMATRIX #2628
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now I get the correct solution: julia> using JuMP, Gurobi
julia> filename = "/Users/oscar/Downloads/Initial_problem_set/Test_prob_20.mps"
"/Users/oscar/Downloads/Initial_problem_set/Test_prob_20.mps"
julia> model = read_from_file(filename)
obj
├ solver: none
├ objective_sense: MIN_SENSE
│ └ objective_function_type: AffExpr
├ num_variables: 2518
├ num_constraints: 4346
│ ├ AffExpr in MOI.EqualTo{Float64}: 391
│ ├ AffExpr in MOI.LessThan{Float64}: 400
│ ├ QuadExpr in MOI.EqualTo{Float64}: 1284
│ ├ VariableRef in MOI.GreaterThan{Float64}: 1793
│ ├ VariableRef in MOI.LessThan{Float64}: 78
│ └ VariableRef in MOI.ZeroOne: 400
└ Names registered in the model: none
julia> set_optimizer(model, Gurobi.Optimizer)
Set parameter LicenseID to value 890341
julia> optimize!(model)
Gurobi Optimizer version 12.0.0 build v12.0.0rc1 (mac64[x86] - Darwin 24.1.0 24B83)
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 791 rows, 2518 columns and 5384 nonzeros
Model fingerprint: 0xbc4cd974
Model has 1284 quadratic constraints
Variable types: 2118 continuous, 400 integer (400 binary)
Coefficient statistics:
Matrix range [4e-03, 2e+02]
QMatrix range [1e+00, 1e+00]
QLMatrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [8e+00, 1e+05]
RHS range [3e+00, 3e+04]
Presolve removed 263 rows and 1315 columns
Presolve time: 0.01s
Presolved: 1784 rows, 1204 columns, 4909 nonzeros
Presolved model has 314 bilinear constraint(s)
Warning: Model contains variables with very large bounds participating
in product terms.
Presolve was not able to compute smaller bounds for these variables.
Consider bounding these variables or reformulating the model.
Solving non-convex MIQCP
Variable types: 798 continuous, 406 integer (406 binary)
Found heuristic solution: objective 1192.2587333
Root relaxation: objective 2.832780e+02, 826 iterations, 0.01 seconds (0.01 work units)
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 283.27800 0 55 1192.25873 283.27800 76.2% - 0s
H 0 0 700.4259893 283.27800 59.6% - 0s
H 0 0 695.3995543 283.27800 59.3% - 0s
H 0 0 690.4524243 283.27800 59.0% - 0s
0 0 296.30035 0 56 690.45242 296.30035 57.1% - 0s
H 0 0 689.1690910 296.40604 57.0% - 0s
H 0 0 686.4094214 296.40604 56.8% - 0s
0 0 296.46363 0 55 686.40942 296.46363 56.8% - 0s
0 0 296.93701 0 44 686.40942 296.93701 56.7% - 0s
H 0 0 683.3435487 296.93701 56.5% - 0s
0 0 296.93701 0 44 683.34355 296.93701 56.5% - 0s
0 0 329.80643 0 162 683.34355 329.80643 51.7% - 0s
H 0 0 674.1846106 332.82229 50.6% - 0s
H 0 0 669.2743489 332.82229 50.3% - 0s
H 0 0 668.4192038 332.82229 50.2% - 0s
0 2 332.82229 0 162 668.41920 332.82229 50.2% - 0s
H 272 297 654.4575487 379.87319 42.0% 135 0s
H 441 454 626.2078539 379.87319 39.3% 112 1s
H 675 577 622.2688539 414.17694 33.4% 92.2 1s
H 678 603 612.2159838 414.17694 32.3% 92.7 1s
H 1166 941 610.4720390 589.66608 3.41% 92.9 2s
H 1166 894 609.4456039 589.66608 3.25% 92.9 2s
H 1167 849 599.1760747 594.50476 0.78% 92.8 2s
H 1171 810 598.9191764 594.70995 0.70% 93.2 2s
Cutting planes:
Gomory: 1
Cover: 4
MIR: 9
Flow cover: 9
Explored 1255 nodes (112627 simplex iterations) in 3.10 seconds (2.25 work units)
Thread count was 8 (of 8 available processors)
Solution count 10: 598.919 599.176 609.446 ... 669.274
Optimal solution found (tolerance 1.00e-04)
Best objective 5.989191764127e+02, best bound 5.989191764127e+02, gap 0.0000%
User-callback calls 4360, time in user-callback 0.01 sec where previously I got julia> optimize!(model)
Gurobi Optimizer version 12.0.0 build v12.0.0rc1 (mac64[x86] - Darwin 24.1.0 24B83)
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 791 rows, 2518 columns and 5384 nonzeros
Model fingerprint: 0xc497b58d
Model has 1284 quadratic constraints
Variable types: 2118 continuous, 400 integer (400 binary)
Coefficient statistics:
Matrix range [4e-03, 2e+02]
QMatrix range [5e-01, 5e-01]
QLMatrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [8e+00, 1e+05]
RHS range [3e+00, 3e+04]
Presolve removed 263 rows and 326 columns
Presolve time: 0.00s
Explored 0 nodes (0 simplex iterations) in 0.00 seconds (0.00 work units)
Thread count was 1 (of 8 available processors)
Solution count 0
Model is infeasible or unbounded
Best objective -, best bound -, gap -
User-callback calls 126, time in user-callback 0.00 sec |
odow
commented
Feb 16, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2627
I still need better testing for this.
The underlying issue is that Gurobi's QCMATRIX section does not match CPLEX and Mosek (It is missing a /2): https://docs.gurobi.com/projects/optimizer/en/current/reference/fileformats/modelformats.html#qcmatrix-section