Patrik Haslum <[EMAIL PROTECTED]> writes:

> I have a finite set variable X, with domain {0..N-1} (though I could 
> replace it by an array of booleans if that turns out to be more 
> convenient). Every element i in the domain of X has a certain weight, 
> w(i) (which is in the range 0..K; K is typically small). I want to post 
> the constraint
>
> Y = min_{i in X} w(i)  if X is non-empty
>      0                  if X is empty.

For example, you could do it this way:

X' = X U {N}
S  = U<{w(0)},{w(1)},...,{w(N-1)},{K+1}>[X']       (elementsUnion)
Y' = min(S)
Y  = <0,Y'>[Y'<(K+1)]                              (element)

Cheers,

--Denys

_______________________________________________
Gecode users mailing list
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to