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

Update to JuMP and MOI v1 #291

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Update to JuMP and MOI v1 #291

wants to merge 7 commits into from

Conversation

blegat
Copy link

@blegat blegat commented Aug 29, 2024

Closes #289

test/Project.toml Outdated Show resolved Hide resolved
@Wikunia
Copy link
Owner

Wikunia commented Aug 29, 2024

Thanks a lot for your work. Appreciate it 😊

@blegat
Copy link
Author

blegat commented Aug 29, 2024

I'm giving a tutorial next Wednesday and I'd like to show that one can swap MiniZinc with CBLS or ConstraintSolver so I'll first update with this PR and then transition to the MOI sets for the sets that I need (e.g., MOI.AllDifferent instead of CPE.AllDifferent). Do you think you could make a release before the tutorial so that users of the tutorial don't have to checkout the package ? I'll release a new version of CPE soon so that your dependencies are released.

@blegat
Copy link
Author

blegat commented Aug 29, 2024

I'm now getting

Simple: Error During Test at /home/blegat/.julia/dev/ConstraintSolver/test/constraints/element1Dconst.jl:2
  Got exception outside of a @test
  BoundsError: attempt to access 25-element Vector{Int64} at index [28]
  Stacktrace:
    [1] getindex
      @ ./essentials.jl:13 [inlined]
    [2] prune_constraint!(com::ConstraintSolver.ConstraintSolverModel{Float64}, constraint::ConstraintSolver.Element1DConstConstraint, fct::MathOptInterface.VectorOfVariables, set::ConstraintSolver.Element1DConstInner; logs::Bool)
      @ ConstraintSolver ~/.julia/dev/ConstraintSolver/src/constraints/element1Dconst.jl:153
    [3] prune!(com::ConstraintSolver.ConstraintSolverModel{Float64}; pre_backtrack::Bool, all::Bool, only_once::Bool, initial_check::Bool)
      @ ConstraintSolver ~/.julia/dev/ConstraintSolver/src/pruning.jl:95
    [4] prune!
      @ ~/.julia/dev/ConstraintSolver/src/pruning.jl:53 [inlined]
    [5] backtrack!(com::ConstraintSolver.ConstraintSolverModel{Float64}, max_bt_steps::Int64; sorting::Bool, log_table::Bool, first_parent_idx::Int64, single_path::Bool, compute_bounds::Bool, check_bounds::Bool, cb_finished_pruning::ConstraintSolver.var"#159#161")
      @ ConstraintSolver ~/.julia/dev/ConstraintSolver/src/ConstraintSolver.jl:602
    [6] backtrack!
      @ ~/.julia/dev/ConstraintSolver/src/ConstraintSolver.jl:509 [inlined]
    [7] solve_with_backtrack!(com::ConstraintSolver.ConstraintSolverModel{Float64}, max_bt_steps::Int64; sorting::Bool)
      @ ConstraintSolver ~/.julia/dev/ConstraintSolver/src/ConstraintSolver.jl:480

Not sure how to fix it 🤔

@Wikunia
Copy link
Owner

Wikunia commented Aug 30, 2024

In general I'm happy to release a new version before that. Not sure about the error though. Don't have much time this weekend but will check.

I guess the one test case you removed is currently a limitation though.

@Wikunia
Copy link
Owner

Wikunia commented Aug 30, 2024

Ah just saw that a new JuMP version with the fix was already released.

@blegat
Copy link
Author

blegat commented Aug 30, 2024

When it's a bug fix, we prefer to release it quickly. Quite convenient to open an issue late yesterday and to have the bug fixed and released overnight, thanks @odow !

@Wikunia
Copy link
Owner

Wikunia commented Aug 30, 2024

@blegat I'm currently running into the problem that JuMP defines operator_to_set(error_fn::Function, ::Val{:<}) which is a method that I define as well to work with CPE.Strictly.

(ConstraintSolver) pkg> instantiate
Precompiling project...
        Info Given ConstraintSolver was explicitly requested, output will be shown live 
WARNING: Method definition operator_to_set(Function, Base.Val{:<}) in module JuMP at /Users/olek/.julia/packages/JuMP/PKxEW/src/macros/@constraint.jl:560 overwritten in module ConstraintSolver at /Users/olek/Code/git/ConstraintSolver.jl/src/MOI_wrapper/constraints.jl:5.
ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.
  ? ConstraintSolver

Does this make it impossible to use < with JuMP? I'm quite confused why this problem doesn't appear in CI.

@blegat
Copy link
Author

blegat commented Aug 30, 2024

I also have it locally but it doesn't prevent the tests from passing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants