infiniteopt / InfiniteOpt.jl

An intuitive modeling interface for infinite-dimensional optimization problems.
https://infiniteopt.github.io/InfiniteOpt.jl/stable
MIT License
251 stars 17 forks source link

Fix Ambiguity with JuMP 1.10 #310

Closed pulsipher closed 1 year ago

pulsipher commented 1 year ago

Fixes the issue discussed in https://github.com/jump-dev/JuMP.jl/issues/3330. It appears we can just enforce set::MOI.AbstractSet to fix the problem.

I also removed some unnecessary type checks when I was at it.

codecov[bot] commented 1 year ago

Codecov Report

Merging #310 (60f696a) into master (c28796f) will increase coverage by 0.05%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #310      +/-   ##
==========================================
+ Coverage   99.71%   99.77%   +0.05%     
==========================================
  Files          33       36       +3     
  Lines        7088     7095       +7     
==========================================
+ Hits         7068     7079      +11     
+ Misses         20       16       -4     
Impacted Files Coverage Δ
src/constraints.jl 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

odow commented 1 year ago

This is definitely one weakness of multiple dispatch. You sometimes need to know the right incantation of argument types to get things to dispatch properly. https://github.com/jump-dev/MathOptInterface.jl/pull/2161 is another case where you need to add a very particular method to get things to work.

pulsipher commented 1 year ago

This is definitely one weakness of multiple dispatch. You sometimes need to know the right incantation of argument types to get things to dispatch properly. jump-dev/MathOptInterface.jl#2161 is another case where you need to add a very particular method to get things to work.

It certainly make backwards compatibility troublesome at times. It is hard to always recognize all the implicit assumptions, like the use of MOI.AbstractSet in this case.