[gecode-users] Difference between minus_r and nq

Christian Schulte cschulte at kth.se
Wed Nov 11 09:30:54 CET 2015


Please read a little bit more careful and follow the examples in MPG: gq
enforces that the values of a variable are at least as large as some given
integer.

 

Christian

 

--

Christian Schulte, www.gecode.org/~schulte

Professor of Computer Science, KTH,  <mailto:cschulte at kth.se>
cschulte at kth.se

Expert Researcher, SICS,  <mailto:cschulte at sics.se> cschulte at sics.se

 

From: mehdi m [mailto:medistif at hotmail.fr] 
Sent: Wednesday, November 11, 2015 08:22 AM
To: cschulte at kth.se; users at gecode.org
Subject: RE: [gecode-users] Difference between minus_r and nq

 

Hi,

 

I read and what i conclude (correct me please if i'm wrong) is that the two
methods are equivalents in the case where the iterator represent only one
value so minus_r will behave as an "nq" since it will remove only one value
as "nq" do it !

 

Also, what i didn't notice is the difference in the case of "gq", for
example :

 

x0 = {1,2,3,4,5}

 

If the iterator r represent the value {1,2,3}, so 

GECODE_ME_CHECK(x0.minus_r(home, r)); will remove these values from x0.

And if i post :

GECODE_ME_CHECK(x0.gq(home, 4)); in this case the value {1,2,3} are also
removed from x0.

 

So, what is here the difference since the two methods remove the whole
values {1,2,3} ?

 

Thanks.

  _____  

From: cschulte at kth.se
To: medistif at hotmail.fr; users at gecode.org
Subject: RE: [gecode-users] Difference between minus_r and nq
Date: Tue, 10 Nov 2015 21:08:44 +0100

Hi,

 

No, not all. For the details please read chapter 25 in MPG, it has the full
story!

 

The difference (in short) is that nq removes a single integer value, whereas
minus_r removes a whole set of values represented by a range iterator. As
said, please check MPG.

 

Christian

 

--

Christian Schulte,  <http://www.gecode.org/~schulte> www.gecode.org/~schulte


Professor of Computer Science, KTH,  <mailto:cschulte at kth.se>
cschulte at kth.se

Expert Researcher, SICS,  <mailto:cschulte at sics.se> cschulte at sics.se

 

From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of mehdi m
Sent: Tuesday, November 10, 2015 08:36 PM
To: users at gecode.org
Subject: [gecode-users] Difference between minus_r and nq

 

Hi everyone,

 

In the propagator implementation are the two following methods to remove
values from domains equivalents ?

 

- method 1 :

Int::ViewRanges<Int::IntView> r(x1);

GECODE_ME_CHECK(x0.minus_r(home, r));

 

- method 2

GECODE_ME_CHECK(x0.nq(home, val));

 

Or there is any difference ? I see that the first one takes a ViewRange and
the second can takes an Int directly but what about correctness and
efficiency of pruning ?

 

Thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20151111/ddb0180d/attachment-0001.html>


More information about the users mailing list