Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix writing integer variables with float bounds #78

Merged
merged 1 commit into from
Jul 22, 2024
Merged

Fix writing integer variables with float bounds #78

merged 1 commit into from
Jul 22, 2024

Conversation

odow
Copy link
Member

@odow odow commented Jul 22, 2024

Closes #77

Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.78%. Comparing base (8c7a7d3) to head (7504580).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
+ Coverage   97.76%   97.78%   +0.01%     
==========================================
  Files           3        3              
  Lines         493      496       +3     
==========================================
+ Hits          482      485       +3     
  Misses         11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@odow
Copy link
Member Author

odow commented Jul 22, 2024

julia> using JuMP

julia> import MiniZinc

julia> model = Model(() -> MiniZinc.Optimizer{Float64}("highs"))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: MiniZinc

julia> @variable(model, 1 <= x[1:3] <= 3, Int)
3-element Vector{VariableRef}:
 x[1]
 x[2]
 x[3]

julia> @constraint(model, x in MOI.AllDifferent(3))
[x[1], x[2], x[3]] ∈ MathOptInterface.AllDifferent(3)

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

julia> optimize!(model)

julia> @show value.(x)
value.(x) = [1.0, 2.0, 3.0]
3-element Vector{Float64}:
 1.0
 2.0
 3.0

@odow odow merged commit bc8751f into master Jul 22, 2024
7 checks passed
@odow odow deleted the od/fix branch July 22, 2024 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

MiniZinc example in the docs does not work.
1 participant