From aa6ac48076d0035d826e4fa880d30693247a9c1d Mon Sep 17 00:00:00 2001 From: odow Date: Wed, 12 Jun 2024 11:46:46 +1200 Subject: [PATCH] Update --- src/FileFormats/NL/read.jl | 2 +- test/FileFormats/NL/read.jl | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/FileFormats/NL/read.jl b/src/FileFormats/NL/read.jl index bcc4d75985..dc399d06ad 100644 --- a/src/FileFormats/NL/read.jl +++ b/src/FileFormats/NL/read.jl @@ -234,7 +234,7 @@ function _expr_to_function(expr::Expr) @assert Meta.isexpr(expr, :call) f = _try_scalar_affine_function(expr) if f !== nothing - return f + return convert(MOI.ScalarAffineFunction{Float64}, f) end return MOI.ScalarNonlinearFunction( expr.args[1], diff --git a/test/FileFormats/NL/read.jl b/test/FileFormats/NL/read.jl index 9ee80c7250..eed46db26a 100644 --- a/test/FileFormats/NL/read.jl +++ b/test/FileFormats/NL/read.jl @@ -720,10 +720,10 @@ function test_hs071_free_constraint_nlexpr() open(joinpath(@__DIR__, "data", "hs071_free_constraint.nl"), "r") do io return read!(io, model) end - @test MOI.get(model, MOI.ListOfConstraintTypesPresent()) == [ - (MOI.ScalarNonlinearFunction, MOI.GreaterThan{Float64}), - (MOI.ScalarNonlinearFunction, MOI.Interval{Float64}), - ] + types = MOI.get(model, MOI.ListOfConstraintTypesPresent()) + @test length(types) == 2 + @test (MOI.ScalarAffineFunction{Float64}, MOI.GreaterThan{Float64}) in types + @test (MOI.ScalarNonlinearFunction, MOI.Interval{Float64}) in types for (F, S) in MOI.get(model, MOI.ListOfConstraintTypesPresent()) @test MOI.get(model, MOI.NumberOfConstraints{F,S}()) == 1 end