[gecode-users] modelling question

Patrik Haslum patrik.haslum at anu.edu.au
Fri Nov 28 04:03:52 CET 2008


Hi,
This is not really question specific to gecode, but since there are 
presumably a lot of constraint-savvy people on this list, I'll ask anyway:

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.

Y is used in an expression that is minimised, so upper-bounding it 
(which would be simple) is not enough. The best I've been able to come 
up with is to write something like

(i in X) & (forall j s.t. w(j) < w(i) : not(j in X)) -> (Y = w(i)).

Does anyone know of a better way to formulate it?

Thanks,
			/P at trik




More information about the gecode-users mailing list