Skip to content

Commit

Permalink
Add supports for ObjectiveFunction (#36)
Browse files Browse the repository at this point in the history
* Add supports for ObjectiveFunction

* Add test
  • Loading branch information
blegat authored Oct 9, 2024
1 parent ddb8c5b commit ff7a1c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/FlatZinc/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
6 changes: 5 additions & 1 deletion test/FlatZinc/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -105,4 +109,4 @@
@test MOI.supports_add_constrained_variable(m, S)
@test MOI.supports_add_constrained_variables(m, S)
end
end
end

0 comments on commit ff7a1c8

Please sign in to comment.