-
Notifications
You must be signed in to change notification settings - Fork 87
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
Typo in sets #1024
Typo in sets #1024
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to think about sets containing functions.
For example:
x in Count([u, v, w], 2)
is better as
[x, u, v, w] in Count(2)
What do you think of the latest version? |
Better this way? I also added Sort, SortPermutation, BinPacking, and CapacitatedBinPacking. I think this set of constraints is enough as a first step. |
Codecov Report
@@ Coverage Diff @@
## master #1024 +/- ##
==========================================
- Coverage 95.19% 95.16% -0.04%
==========================================
Files 100 100
Lines 11279 11283 +4
==========================================
Hits 10737 10737
- Misses 542 546 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I like the direction this is going, but there's a lot of sets here.
I propose that you (we) develop a ConstraintProgrammingExtensions.jl
package to contain these definitions.
Then ConstraintSovler.jl
can depend on that package, enabling:
using JuMP
using ConstraintProgrammingExtensions
using ConstraintSolver
const CP = ConstraintProgrammingExtensions
model = Model(ConstraintSolver.Optimizer)
@variable(model, x[1:4], Int)
@constraint(model, x in CP.AllDifferent(4))
It's similar to what I proposed for #996 (comment).
The upside of an extension package is we would get to play around with different sets and definitions without having to depend on them forever in MOI. If, at some point, they become stable and well supported, then we could look at bringing them into MOI.
I completely agree with your objection. Regarding the JuMP PR (jump-dev/JuMP.jl#2051), I suppose it makes no sense to have support in JuMP for sets that are not in MOI. This PR could then be reduced to the minimum to allow implementing things, with the actual constraints being implemented in that other package (say ConstraintProgrammingExtensions.jl, or another one so that solvers do not have a dependency on JuMP, like JuCP.jl or anything). (Also tagging @blegat on this, due to his feedback on the JuMP PR.) Also, would that ConstraintProgrammingExtensions.jl package be a good place to implement bridges, like in MOI? |
You could even have JuMP as a dependency to @logicalconstraint(model, all_different(x)) which re-writes to @constraint(model, x in CP.AllDifferent(length(x)) I guess the points I want to make are:
So I would close #2051, but more because the timing is off, rather than us not wanting to add it.
Yes, perfect place for it. CP -> MIP bridges are probably a good way of getting solvers hooked up to test various things. |
I agree, MOI already integrated 3 packages: MathOptFormat, MathOptInterfaceTests and MathOptInterfaceBridges. |
Thanks for your thoughts! I just created a new package for these sets (not yet registered): https://github.com/dourouc05/ConstraintProgrammingExtensions.jl I repurposed this PR just to correct two typos in IndicatorSet. |
@@ -711,9 +711,9 @@ end | |||
""" | |||
IndicatorSet{A, S <: AbstractScalarSet}(set::S) | |||
|
|||
``\\{((y, x) \\in \\{0, 1\\} \\times \\mathbb{R}^n : y = 0 \\implies x \\in set\\}`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you added opening parentheses, which is the closing one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I removed parentheses that were not closed anywhere.
Thanks @dourouc05! Let's keep discussing things in your extension package. |
Needed part for jump-dev/JuMP.jl#2051, to gather some feedback.