Hi all,

I have an optimization problem where I have several sets of IntVars S1, S2, etc.

For each set, I would like to set

max1 = Max(S1), max2 = Max(S2) etc.

min1 = min(S1), min2 = min(S2) etc.

And I would like to find the solution that minimizes (max1 + max2 + ...) - (min1 + min2 + ...)

I know I can set an IntVar cost and a constraint (max1 + max2 + ...) = cost + (min1 + min2 + ...).

This would work perfectly, but I don't know how to find the maximum of each set.

Thank you!