Comments (3)
Of course one must understand that at compile time the where condition is not entailed so no constraint is posted for runtime but raising an error when a where condition involves decision variables might perhaps be preferred ?
from libminizinc.
The where
clause in MiniZinc's comprehensions (or comprehension calls) is equivalent to an "if-then" condition in the body of the comprehension. This means that the constraint is equivalent to
constraint forall(i,j in 1..3) ( if A[i] > B[j] then A[i] < B[j] else true endif);
Since A[i] < B[j]
is only enforced when A[i] > B[j]
, it actually enforces not (A[i] > B[j])
. Otherwise, it would be unsatisfiable.
Did you maybe mean to write the following constraint?
constraint forall(i,j in 1..3 where i < j) (A[i] < B[j]);
Note that it is fine to use decision variables in a condition, and these do not have to be entailed during compilation. The MiniZinc compiler will still take the condition into account.
from libminizinc.
Thank you for your answer.
It's just that I am writing in Prolog a MiniZinc interpreter not going through FlatZinc transformation (for several reasons) and I came to this question.
There is no issue in fact ;-)
from libminizinc.
Related Issues (20)
- if-then-else-var MIP HOT 1
- float_EPS=0.0 leads to strong presolve
- Gecode 6.3.0: multiple problems with floats HOT 2
- Bound evaluation error with -O2 optimisation but not -O1
- timeout not working for specific models HOT 1
- not all variables are assigned a value after solve HOT 1
- minizinc 2.8.3 Memory violation detected (segmentation fault) HOT 1
- Crash with huge number of array concats. HOT 3
- 2d array slicing in comprehension fails, array of arrays not supported HOT 4
- empty set as default value for optional set fails HOT 2
- Invalid solution found when solving with Gecode or Ortools. HOT 1
- Subcircuit of length 1? HOT 2
- MiniZinc 2.8.3: error passing .fzn to minizinc/gecode HOT 2
- Inconsistent reification of stricty_increasing
- MiniZinc 2.8.4: FindMUS "multiple errors:" HOT 2
- Difference in handling of JSON annotated sections in 2.8.* using --json-stream HOT 1
- Gecode CANNOT solve official "Real Number Solving" example
- Apparent mishandling of nested `opt` declarations in the JSON interface
- JSON input bug, record type-inst error with enumerated type HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libminizinc.