jump-dev / MiniZinc.jl

A Julia interface to the MiniZinc constraint modeling language
https://www.minizinc.org/
MIT License
18 stars 4 forks source link

Add support for MOI.EqualTo{Bool} #59

Closed odow closed 9 months ago

odow commented 9 months ago

Closes #58

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (01bc0f7) 97.45% compared to head (1df0a13) 97.45%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #59 +/- ## ======================================= Coverage 97.45% 97.45% ======================================= Files 3 3 Lines 471 471 ======================================= Hits 459 459 Misses 12 12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

odow commented 9 months ago

This now works:

julia> using JuMP, MiniZinc

julia> model = GenericModel{Int}(() -> MiniZinc.Optimizer{Int}("chuffed"));

julia> @variable(model, 1 <= x[1:3] <= 3);

julia> @constraint(model, x in MOI.AllDifferent(3));

julia> @constraint(model, x[1] == 2 || x[3] == 2 := true)
(x[1] == 2) || (x[3] == 2) = true

julia> @objective(model, Max, sum(i * x[i] for i in 1:3));

julia> optimize!(model)

julia> value.(x)
3-element Vector{Int64}:
 2
 1
 3