From 825c8ade60aba3de40a6751e4a7693c890e27820 Mon Sep 17 00:00:00 2001 From: odow Date: Wed, 25 Jan 2023 10:20:17 +1300 Subject: [PATCH] Fix bug when setting a quadratic objective --- Project.toml | 2 +- src/MOI_wrapper.jl | 1 + test/MOI_wrapper.jl | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 028d93b..05011b3 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "HiGHS" uuid = "87dc4568-4c63-4d18-b0c0-bb2238e4078b" -version = "1.4.1" +version = "1.4.2" [deps] HiGHS_jll = "8fd58aa0-07eb-5a78-9b36-339c94fd15ea" diff --git a/src/MOI_wrapper.jl b/src/MOI_wrapper.jl index b5a6c32..912689a 100644 --- a/src/MOI_wrapper.jl +++ b/src/MOI_wrapper.jl @@ -928,6 +928,7 @@ function MOI.set( ) _check_ret(ret) model.hessian = Q + model.is_objective_function_set = true return end diff --git a/test/MOI_wrapper.jl b/test/MOI_wrapper.jl index b28dedf..976fc97 100644 --- a/test/MOI_wrapper.jl +++ b/test/MOI_wrapper.jl @@ -390,6 +390,20 @@ function test_option_type() end end +function test_quadratic_sets_objective() + model = HiGHS.Optimizer() + MOI.Utilities.loadfromstring!( + model, + """ + variables: x + minobjective: 1.0 * x * x + """, + ) + attr = MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{Float64}}() + @test attr in MOI.get(model, MOI.ListOfModelAttributesSet()) + return +end + end TestMOIHighs.runtests()