JuMP: allunique as a constraint?


#1

How may I write a constraint for a list of variables requiring all to have unique integer values?


#2

I have done very little with constraints in JuMP, but I believe it allows for non-linear constraints. For each of your variables, could you not define a constraint that its minimum distance from the other variables is positive?


#3

JuMP does not support modeling the “all unique” constraint nor does it connect to constraint programming solvers. This may change in the future. For now I would recommend systems like MiniZinc.


#4

The constraint “all unique” is typically called “all different”.

There is a variety of work discussing MIP encodings, which could be implemented in JuMP.

If your problem is primarily combinatorial, I also would recommend systems like MiniZinc.


#5

Thank you.