Skip to content

Commit ff7a1c8

Browse files
authored
Add supports for ObjectiveFunction (#36)
* Add supports for ObjectiveFunction * Add test
1 parent ddb8c5b commit ff7a1c8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/FlatZinc/model.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ function MOI.get(model::Model, ::MOI.ObjectiveFunction{MOI.VariableIndex})
102102
return model.objective_function
103103
end
104104

105+
MOI.supports(::Model, ::MOI.ObjectiveFunction{MOI.VariableIndex}) = true
106+
105107
function MOI.set(
106108
model::Model,
107109
::MOI.ObjectiveFunction{MOI.VariableIndex},

test/FlatZinc/model.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
@testset "Supported constraints" begin
88
m = CP.FlatZinc.Model()
99

10+
@test MOI.supports(
11+
m,
12+
MOI.ObjectiveFunction{MOI.VariableIndex}(),
13+
)
1014
@test MOI.supports_constraint(
1115
m,
1216
MOI.VariableIndex,
@@ -105,4 +109,4 @@
105109
@test MOI.supports_add_constrained_variable(m, S)
106110
@test MOI.supports_add_constrained_variables(m, S)
107111
end
108-
end
112+
end

0 commit comments

Comments
 (0)