-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature element 1D const #213
Conversation
Codecov Report
@@ Coverage Diff @@
## master #213 +/- ##
========================================
Coverage 97.62% 97.62%
========================================
Files 52 54 +2
Lines 4328 4547 +219
========================================
+ Hits 4225 4439 +214
- Misses 103 108 +5
Continue to review full report at Codecov.
|
This does currently not work inside reified or indicator constraints because the constraint itself gets added to the entire model.
would be translated to:
If the variable z is only used inside an inner constraint it will get removed from the model and instead added to the list of inner constraints. |
This is finally in a stage which might be usable. If you want to play around with it @hakank please give it a go! |
I hope I figured it out now ... c = collect(1:5)
crev = reverse(c)
@variable(m, b, Bin)
@constraint(m, b < 0.5)
@variable(m, 1 <= idx <= length(c), Int)
@constraint(m, b := { c[idx] == crev[idx]}) should be transformed into: c = collect(1:5)
crev = reverse(c)
@variable(m, b, Bin)
@constraint(m, b < 0.5)
@variable(m, 1 <= idx <= length(c), Int)
@variable(m, 1 <= y <= 5, Int)
@variable(m, 1 <= z <= 5, Int)
@constraint(m, b := {!(([y, idx] in CS.Element1DConst(c)) ⊻ (y == z))})
@constraint(m, b := {!(([z, idx] in CS.Element1DConst(crev)) ⊻ (y == z))})
@constraint(m, b := { y == z }) so the global element constraint needs to be deactivated but the activator constraint itself stays as it is. |
Should check |
Benchmark Report for ConstraintSolverJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
|
Is this model expected to work (tested with #master version)?
It throws this error:
|
No unfortunately it isn't supported yet currently the array has to be constant. Your request is tracked here: #198 |
OK. Thanks for the clarification. I tested some variants with constant arrays and found no problems. |
Perfect thanks a lot for testing! |
This PR adds the functionality of element constraint for a 1D constant standard Julia Vector.
The user can therefore now write things like
T[x] == y
wherex
is a variable as long asT
is aVector{Int}
.Syntax example
This code will sort the elements in
c
Closes #196
is_constraint_violated
XNOR
to combine it when insideActivatorConstraint
orOrConstraint
. Implement xor and xnor #259XNOR
will then be a global constraint and&&
will continue to be the inner constraintAndConstraint
OrConstraint
||
outside ofActivatorConstraint
z == T[y]