How to model a large array e.g. "array[1..10000000] of int: A;" which has a lot of 0 as default value. Is there a way to specify "default" value to MiniZinc in order to reduce the data file size?
Asked
Active
Viewed 329 times
1 Answers
0
MiniZinc is a declarative language where you can not change the value of an assigned variable. This makes the question a bit strange, there is no need of a default value since the value of a variable can't be changed.
I would use an array comprehension [if i == 3 then i else 0 endif | i in 1..10000000]
and switch the condition and result of the if-statement depending on what you need.
There might a another way of representing the array? An array that is mostly empty does not sound very effective.

Kobbe
- 809
- 5
- 16