Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FileFormats/NL/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mutable struct _CacheModel
objective::Expr
sense::MOI.OptimizationSense
complements_map::Dict{Int,Int}
defined_variables::Dict{Int,Expr}
defined_variables::Dict{Int,Union{Float64,MOI.VariableIndex,Expr}}

function _CacheModel()
return new(
Expand All @@ -33,7 +33,7 @@ mutable struct _CacheModel
:(),
MOI.FEASIBILITY_SENSE,
Dict{Int,Int}(),
Dict{Int,Expr}(),
Dict{Int,Union{Float64,MOI.VariableIndex,Expr}}(),
)
end
end
Expand Down
21 changes: 21 additions & 0 deletions test/FileFormats/NL/test_read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,27 @@ function test_parse_V()
return
end

function test_parse_V_constant()
model = NL._CacheModel()
io = IOBuffer("V2 0 0\nn0\n")
seekstart(io)
NL._parse_section(io, model)
@test length(model.defined_variables) == 1
@test model.defined_variables[2] === 0.0
return
end

function test_parse_V_variable()
model = NL._CacheModel()
NL._resize_variables(model, 2)
io = IOBuffer("V1 0 0\nv0\n")
seekstart(io)
NL._parse_section(io, model)
@test length(model.defined_variables) == 1
@test model.defined_variables[1] === MOI.VariableIndex(1)
return
end

function test_parse_L()
model = NL._CacheModel()
io = IOBuffer()
Expand Down
Loading