Monday, November 21, 2011

MPS Files (2)

As follow up on http://yetanothermathprogrammingconsultant.blogspot.com/2011/10/mps-files.html it is noted that Microsoft Solver Foundation also reads some MPS files incorrectly. E.g. consider the files:

C:\Users\erwin\Documents>type mip4mps.oml
Model[
  Decisions[Integers[0, Infinity], x],
  Constraints[x <= 5],
  Goals[Maximize[x]]
]

C:\Users\erwin\Documents>type output.mps
NAME          MODEL
ROWS
L  constrai
N  goal_8ef
COLUMNS
    INTMARK   'MARKER'                 'INTORG'
    x         constrai   1             goal_8ef  -1
    INTMARK   'MARKER'                 'INTEND'
RHS
    RHS       constrai   5
BOUNDS
ENDATA

C:\Users\erwin\Documents>

The MPS file was generated from the OML file. If we inspect the MPS file we see no bounds on x. This means the variable x should be binary.

If we solve the MPS file with Solver Foundation we see:

C:\Users\erwin\Documents>"\Program Files (x86)\Microsoft Solver Foundation\3.0.2.10889\Bin\MSFCli.exe" +verbose 3 output.mps
===== Processing .\output.mps =====
Solution Quality: Optimal
===Solver Foundation Service Report===
Date: 11/21/2011 10:27:00 PM
Version: Microsoft Solver Foundation 3.0.2.10889 Standard Edition
Model Name: DefaultModel
Capabilities Applied: MILP
Solve Time (ms): 367
Total Time (ms): 489
Solve Completion Status: Optimal
Solver Selected: Microsoft.SolverFoundation.Solvers.SimplexSolver
Algorithm: Primal
Arithmetic: Hybrid
Variables: 1 -> 1 + 2
Rows: 2 -> 2
Nonzeros: 2
Eliminated Slack Variables: 0
Pricing (exact): SteepestEdge
Pricing (double): SteepestEdge
Basis: Slack
Pivot Count: 1
Phase 1 Pivots: 0 + 0
Phase 2 Pivots: 1 + 0
Factorings: 4 + 1
Degenerate Pivots: 0 (0.00 %)
Branches: 0
===Solution Details===
Goals:
goal_8ef: -5

Decisions:
x: 5
===== Finished .\output.mps: 00:00:00.5501834 =====

This is incorrect. The reported value of x=5 indicates x is not read as a binary variable. If we solve the MPS file with CBC we see:

C:\Users\erwin\Documents>..\Downloads\cbc output.mps -solve -solution stdout
Welcome to the CBC MILP Solver
Version: 2.7.5
Build Date: Nov 10 2011
Revision Number: 1759

command line - ..\Downloads\cbc output.mps -solve -solution stdout (default strategy 1)
At line 1 NAME          MODEL
At line 2 ROWS
At line 5 COLUMNS
At line 9 RHS
At line 11 BOUNDS
At line 12 ENDATA
Problem MODEL has 1 rows, 1 columns and 1 elements
Coin0008I MODEL read with 0 errors
Continuous objective value is -1 - 0.00 seconds
Cgl0004I processed model has 0 rows, 0 columns (0 integer) and 0 elements
Cbc3007W No integer variables - nothing to do
Cuts at root node changed objective from -1 to -1.79769e+308
Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)

Result - Optimal solution found

Objective value:                -1.00000000
Enumerated nodes:               0
Total iterations:               0
Time (CPU seconds):             0.01
Time (Wallclock seconds):       0.01

Optimal - objective value -1.00000000
      0 x                      1                     -1
Total time (CPU seconds):       0.02   (Wallclock seconds):       0.02


C:\Users\erwin\Documents>

The output is a little bit confusing, but indeed x assumes the value 1. This confirms x is binary.

No comments:

Post a Comment