# Cannot Read LP file

**URL:** <https://discourse.julialang.org/t/cannot-read-lp-file/92787>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [January 11, 2023, 2:16am UTC](https://discourse.julialang.org/t/cannot-read-lp-file/92787 "2023-01-11T02:16:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stuart\_Rogers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stuart_rogers/32/10694_2.png) [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Post date:** [January 11, 2023, 2:16am UTC](https://discourse.julialang.org/t/cannot-read-lp-file/92787/1 "2023-01-11T02:16:04Z")

</div>

read\_from\_file throws an error when trying to read an LP file (min\_max\_overlap\_Gen8.lp, which is 1.6 MB and is comprised of 33,885 lines), representing a MILP. SCIP on the NEOS Server is able to read and solve the LP file. The code below works fine for a very simple LP file (model2.lp).

The error is:  
$ julia solve\_LP.jl  
ERROR: LoadError: AssertionError: token\_types[offset] == \_TOKEN\_QUADRATIC\_OFF\_DIAG  
Stacktrace:  
[1] \_get\_term  
@ ~/.julia/packages/MathOptInterface/o3YPB/src/FileFormats/LP/LP.jl:551 [inlined]  
[2] \_parse\_function(f::MathOptInterface.ScalarAffineFunction{Float64}, model::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.LP.ModelFunctionConstraints{Float64}}, cache::MathOptInterface.FileFormats.LP.\_ReadCache, tokens::Vector{String})  
@ MathOptInterface.FileFormats.LP ~/.julia/packages/MathOptInterface/o3YPB/src/FileFormats/LP/LP.jl:589  
[3] \_parse\_section(#unused#::Val{:constraints}, model::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.LP.ModelFunctionConstraints{Float64}}, cache::MathOptInterface.FileFormats.LP.\_ReadCache, line::SubString{String})  
@ MathOptInterface.FileFormats.LP ~/.julia/packages/MathOptInterface/o3YPB/src/FileFormats/LP/LP.jl:705  
[4] read!(io::IOStream, model::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.LP.ModelFunctionConstraints{Float64}})  
@ MathOptInterface.FileFormats.LP ~/.julia/packages/MathOptInterface/o3YPB/src/FileFormats/LP/LP.jl:959  
[5] #11  
@ ~/.julia/packages/MathOptInterface/o3YPB/src/FileFormats/FileFormats.jl:121 [inlined]  
[6] open(::MathOptInterface.FileFormats.var"#11#12"{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.LP.ModelFunctionConstraints{Float64}}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})  
@ Base ./io.jl:330  
[7] open(::Function, ::String, ::String)  
@ Base ./io.jl:328  
[8] compressed\_open(f::Function, filename::String, mode::String, #unused#::MathOptInterface.FileFormats.NoCompression)  
@ MathOptInterface.FileFormats ~/.julia/packages/MathOptInterface/o3YPB/src/FileFormats/utils.jl:213  
[9] compressed\_open(f::Function, filename::String, mode::String, #unused#::MathOptInterface.FileFormats.AutomaticCompression)  
@ MathOptInterface.FileFormats ~/.julia/packages/MathOptInterface/o3YPB/src/FileFormats/utils.jl:251  
[10] read\_from\_file(model::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.LP.ModelFunctionConstraints{Float64}}, filename::String)  
@ MathOptInterface.FileFormats ~/.julia/packages/MathOptInterface/o3YPB/src/FileFormats/FileFormats.jl:120  
[11] read\_from\_file(filename::String; format::MathOptInterface.FileFormats.FileFormat, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})  
@ JuMP ~/.julia/packages/JuMP/vuP7I/src/file\_formats.jl:112  
[12] read\_from\_file(filename::String)  
@ JuMP ~/.julia/packages/JuMP/vuP7I/src/file\_formats.jl:110  
[13] top-level scope  
@ ~/solve\_LP.jl:4  
in expression starting at /home/muck/solve\_LP.jl:4

The code is below:  
using JuMP  
using SCIP

m = read\_from\_file(“min\_max\_overlap\_Gen8.lp”)  
#m = read\_from\_file(“model2.lp”)  
#m = read\_from\_file(“sample2.mps”)  
set\_optimizer(m,SCIP.Optimizer)  
optimize!(m)

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [January 11, 2023, 4:45am UTC](https://discourse.julialang.org/t/cannot-read-lp-file/92787/2 "2023-01-11T04:45:49Z")

</div>

Please open a reproducible bug report [Issues · jump-dev/MathOptInterface.jl · GitHub](https://github.com/jump-dev/MathOptInterface.jl/issues)

---

<div class="post-metadata">

**Author:** ![Stuart\_Rogers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stuart_rogers/32/10694_2.png) [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Post date:** [January 11, 2023, 5:11am UTC](https://discourse.julialang.org/t/cannot-read-lp-file/92787/3 "2023-01-11T05:11:16Z")

</div>

I opened a reproducible bug report: [Cannot Read LP file · Issue #2075 · jump-dev/MathOptInterface.jl · GitHub](https://github.com/jump-dev/MathOptInterface.jl/issues/2075)
