Skip to content

MPS code is not deterministic #1106

@mlubin

Description

@mlubin

I haven't tried to create examples, but the use of Dict at

mutable struct TempMPSModel
name::String
obj_name::String
columns::Dict{String, TempColumn}
rows::Dict{String, TempRow}
intorg_flag::Bool # A flag used to parse COLUMNS section.
TempMPSModel() = new("", "", Dict{String, TempColumn}(),
Dict{String, TempRow}(), false)
end

likely makes copy_to not deterministic, e.g.,

for (name, column) in temp.columns

for (c_name, row) in temp.rows

Same issue in the ordering of variables when the problem is written out:

coefficients = Dict{String, Vector{Tuple{String, Float64}}}()

for (variable, terms) in coefficients

bounds = Dict{MOI.VariableIndex, Tuple{Float64, Float64}}()

for (index, (lower, upper)) in bounds

Unless we have a good reason not to, variables should keep their ordering when you round-trip read and write to an MPS file. The ordering of variables makes a huge difference for MIP solvers. Ideally the same would hold for constraints, although that's a bit more complex because of how we represent them in MOI.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions