JuMP: allunique as a constraint?

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

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?

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.

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.

1 Like

Thank you.

Is there any update on this constraint or do you still recommend MiniZinc?

You could try: GitHub - Wikunia/ConstraintSolver.jl: ConstraintSolver in Julia: Blog posts ->

1 Like

Thank you Oscar.