[gecode-users] Update function

Zhu Zichen's cse zzhu at cse.cuhk.edu.hk
Mon Nov 11 09:07:11 CET 2013


Dear Christian,

     Thanks for your reply. I read the chapter on Search, but I am still
confusing. For sequential search where shared always being true, when I
update a BoolVar x, why cannot I simply write x=OldSpace.x? It constraints
the two variables to take the same value. They might need extra propagation
compared with using update function, but the result should be same. Can you
help for this? Many thanks.


Zichen


On Thu, Nov 7, 2013 at 10:20 PM, Christian Schulte <cschulte at kth.se> wrote:

> Hi,
>
>
>
> The answer to the first question is simple: because you have to! Update
> updates variables during cloning g and is needed for search. Posting a
> constraint as you suggest is something very different.
>
>
>
> There can be no global variables in Gecode provided you mean something
> such as Gecode’s integer variables as they are always situated inside a
> given space (this is the space you given when initializing a Gecode
> variable). Or dou you mean variable as in C++-variable? Then it does not
> need to be updated.
>
>
>
> Maybe you would like to read the chapter on Search in MPG that explains
> what happens during search in Gecode.
>
>
>
> Cheers
>
> Christian
>
>
>
> --
>
> Christian Schulte, Professor of Computer Science, KTH,
> www.ict.kth.se/~cschulte/
>
>
>
>
>
> *From:* users-bounces at gecode.org [mailto:users-bounces at gecode.org] *On
> Behalf Of *Zhu Zichen's cse
> *Sent:* Thursday, November 07, 2013 3:12 PM
> *To:* users at gecode.org
> *Subject:* [gecode-users] Update function
>
>
>
> Dear All,
>
>           For variables, why do we have to use update function when we
> copying? Why cannot I simply use rel(*this,x==_x)? And there are problems
> when I use update function to update a global variable from another global
> variable. What should I do when I update global variables?
>
>
>
>
>
> Best Regards,
>
> Zichen Zhu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20131111/4b9a528a/attachment.html>


More information about the users mailing list