[Gecode] Propgator copy

Christian Schulte schulte at imit.kth.se
Thu Feb 10 09:22:27 CET 2005


The first issue is that of course your propagator is in charge of copying,
if needed.

Secondly, consider whether you really want to always copy! Have a look to
int/distinct/dom.icc. There the propagator also needs a graph only during
propagation. It maintains this graph as follows: when the propagator is
created or copied set the graph to empty. If the propagate function is
invoked, check whether the graph exists. If not, create it. If yes, update
it accordingly. Upon destruction delete it, if it exists. Make sure that the
destructor is called! This you have to do by giving a special flag to the
propagator. Again see the above mentioned example.

All the best
Christian 

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

-----Original Message-----
From: gecode-bounces at ps.uni-sb.de [mailto:gecode-bounces at ps.uni-sb.de] On
Behalf Of Gustavo Gutierrez
Sent: Wednesday, February 09, 2005 6:01 PM
To: gecode at ps.uni-sb.de
Subject: [Gecode] Propgator copy


Hi,

First of all congratulations, GECODE is a really good piece of software! it
is very useful and really *easily* extensible. Source code is very clear, at
least the parts i've read.

I have a question about propagators. I am writing a propagator, for instance
Prop, which needs to maintain a binary tree with some information and a
variable vector (VarArray). This propagator inherits from NaryPropagator. Is
there any special issue with this tree structure i need to take into
account? 

The tree is used only by the propagate method and  it doesn't change its
structure along propagation. I have some doubts implementing two methods:

Prop(Space* home, Prop<Var>& p);

Call the super class NaryPropagator method to do this is not enough, what
would happened with the tree?

Actor* copy(Space* home, bool);
This method call the constructor i mentioned before, so i think all depends
on that implementation.

Finally, i think the memory allocated by the tree must be freed only at
propagator destructor method.


Thanks in advance and hope to be clear. Feel free to ask for more details.

Gustavo Gutierrez _______________________________________________
Gecode mailing list
Gecode at ps.uni-sb.de http://www.ps.uni-sb.de/mailman/listinfo/gecode





More information about the gecode-users mailing list