[gecode-users] Adding IntActivity to space

Christian Schulte cschulte at kth.se
Wed Feb 25 09:58:25 CET 2015


Hi Kish,

Using both the constructor as well as update will not work (there is some
reference counting going on and then things will be counted twice!). I
checked, just using the constructor should work.

Cheers
Christian

--
Christian Schulte, www.gecode.org/~schulte
Professor of Computer Science, KTH, cschulte at kth.se
Expert Researcher, SICS, cschulte at sics.se


-----Original Message-----
From: Kish Shen [mailto:kisshen at cisco.com] 
Sent: Wednesday, February 25, 2015 6:42 AM
To: cschulte at kth.se; users at gecode.org
Subject: Re: [gecode-users] Adding IntActivity to space

Hi Christian,

Thanks for your help. I have now written the initial version of code that
allow IntActivity to be used in the variable selection predicate of gfd. I
have one question on what needs to be done during cloning, as you mentioned
that update needs to be caled:

On 17/02/2015 08:51, Christian Schulte wrote:

> Yes, that looks okay. You have to call update() on the activity object 
> when you clone a space.

In my space class (GecodeSpace), the activity object, if it exist, is
pointed to by an actp filed:

IntActivity* actp;

which is NULL otherwise.
In my space constructor used for cloning, the activity object is constructed
using the copy constructor:

   GecodeSpace(bool share, GecodeSpace& s) : ....

   if (s.actp != NULL) {
	actp = new IntActivity(*(s.actp));

do I still need to call update in this case, i.e. something like:

         actp->update(*this, share, *(s.actp));

or does the copy constructor already does the copying needed?

Thanks and cheers,

Kish






More information about the users mailing list