[gecode-users] Variable updates and copies

Guido Tack tack at ps.uni-sb.de
Sun Jul 22 12:18:27 CEST 2007


Javier Andrés Mena Zapata wrote:
> I wonder which is the objective of the update and copy methods. My  
> question arise, because the intermediate variables doesn't need to  
> be update.

That's right. You only need to copy those variables that you want to  
access in order to e.g. print a solution.
Copying works in two steps: first all propagators copy the variables  
that they depend upon, and after that the "user" variables are  
copied. That means that if no propagator depends on some variable x  
any more,  but you need x to print the solution, you have to copy x  
(in the copy function). If x is an intermediate variable and you  
don't need it for the solution, you don't have to copy it, and it  
will be automatically "garbage collected".
Note that variables are not actually copied every time you call their  
update function. Only at most one copy will be made, no matter how  
many propagators copy the variable and no matter whether you update  
it again in the copy function of your space subclass.

Cheers,
	Guido

-- 
Guido Tack
Programming Systems Lab, Saarland University, Germany
http://www.ps.uni-sb.de/~tack



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20070722/b95d3b02/attachment.htm>


More information about the gecode-users mailing list