[gecode-users] usage of abs() constraint

Christian Schulte cschulte at kth.se
Mon Oct 15 22:10:41 CEST 2007


Hi,

did you trigger propagation? That is, did you invoke space->status() so that
the constraints are propagated?

Christian

--
Christian Schulte, http://www.imit.kth.se/~schulte/ 

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Stanimir Dragiev
Sent: Monday, October 15, 2007 9:53 PM
To: users at gecode.org
Subject: [gecode-users] usage of abs() constraint


Hello to all on the list!

I was pretty frustrated, that I couldn't get following to work:
---- code ---
//init var_a, var_b
IntVar abs_diff(space, 0, MAX_DIFF);
IntVar signed_diff = post(space, var_a -  var_b);
abs( space, signed_diff, abs_diff);
---- end ---

But I found an example  in the gecode example models using abs, and I turned
it into:

---- code ---
//init var_a, var_b
IntVar abs_diff(space, 0, MAX_DIFF);
abs_diff =  post(space,
		abs(space,
			minus(space, var_a, var_b, 
			ICL_DOM), 
		ICL_DOM), 
	ICL_DOM);
---- end ---


The latter one does what I expect, while the first leaves abs_diff with it's
original bounds: 0 to MAX_DIFF.

Now I'm a little more frustrated than before, since I don't understand what
is going on :o)

Is it not expected, that both behave the same way?

--
cheers
stanio


_______________________________________________
Gecode users mailing list
users at gecode.org https://www.gecode.org/mailman/listinfo/gecode-users





More information about the gecode-users mailing list