From 42d14c715e4cb730ae0fe353e0e0dc9358c67d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Wed, 9 Oct 2024 15:08:34 +0200 Subject: [PATCH 1/2] Add supports for ObjectiveFunction --- src/FlatZinc/model.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/FlatZinc/model.jl b/src/FlatZinc/model.jl index c9bd998a..e36ce1ac 100644 --- a/src/FlatZinc/model.jl +++ b/src/FlatZinc/model.jl @@ -102,6 +102,8 @@ function MOI.get(model::Model, ::MOI.ObjectiveFunction{MOI.VariableIndex}) return model.objective_function end +MOI.supports(::Model, ::MOI.ObjectiveFunction{MOI.VariableIndex}) = true + function MOI.set( model::Model, ::MOI.ObjectiveFunction{MOI.VariableIndex}, From 8564a350eec0a28c9d635ed4b7129e80abead2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Wed, 9 Oct 2024 15:10:05 +0200 Subject: [PATCH 2/2] Add test --- test/FlatZinc/model.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/FlatZinc/model.jl b/test/FlatZinc/model.jl index 742a7622..f4b3cb17 100644 --- a/test/FlatZinc/model.jl +++ b/test/FlatZinc/model.jl @@ -7,6 +7,10 @@ @testset "Supported constraints" begin m = CP.FlatZinc.Model() + @test MOI.supports( + m, + MOI.ObjectiveFunction{MOI.VariableIndex}(), + ) @test MOI.supports_constraint( m, MOI.VariableIndex, @@ -105,4 +109,4 @@ @test MOI.supports_add_constrained_variable(m, S) @test MOI.supports_add_constrained_variables(m, S) end -end \ No newline at end of file +end