[Gecode] Discarding propagators

Christian Schulte schulte at imit.kth.se
Tue Mar 29 17:27:15 CEST 2005


As I tried to point out earlier is that you confuse two issues here: one is
how to structure your code (such as by inheritance, etc). The other one is
creation of propagators. You just can't do that and it is just not useful. I
don't see how parametrization pertains to that issue. You can still, if you
wish inherit from Propagator, add a static method and do what you want
without creating a new propagator (that's the only problem here).

Look to other examples of propagators (such as the domain consistent version
of distinct which uses also the naïve version of it). Here the delegation is
by calling the propagate method which has been overriden by inheritance. But
not by creating a new propagator!

Also, creating propagators is costly as it requires quite some book keeping.

Christian

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

-----Original Message-----
From: Gustavo Gutierrez [mailto:ggutierrez at atlas.puj.edu.co] 
Sent: Tuesday, March 29, 2005 5:09 PM
To: schulte at imit.kth.se
Cc: 'Technical discussions about Gecode'
Subject: RE: [Gecode] Discarding propagators


Hi,

Christian Schulte said:
> Hi,
>
> the problem is to call the propagate method directly: this is not 
> possible! The only interaction that is allowed for a propagator is 
> creation!
>

Actually, what I am doing at propagate method is just a by-pass (i.e it
returns whatever the method implementing the consistency will return). So
the propagate method is never called directly.


> What is not entirely clear to me why do you want to have temporay 
> propagators.

Temporary propagators intend to separate the behaviour of a propagator. This
is a design decision. Different algorithms (in terms of complexity) may
enforce the same consistency technique. In this context, the idea of using a
propagator as an auxiliar tool to build up a more sophisticated,
parametrized consistency technique makes sense.

>From a design view, one could write propagators that can be *parametrized*
with other propagators. For instance, a propagator implementing some
consistency technique that uses other low level consistency technique. The
way in which the other (low level) consistency is used depends entirely on
the new propagator.

The propagator I am implementing uses the returned value from a low level
propagator to decide whether to prune domains or not. A failure of the low
level propagator does not imply that the propagator must fail. Here is when
temporary propagators come into play. The temporary propagator is created
only for checking purposes and depending on its output some actions are
taken. For instance, another low level propagator may be invoked. That is
why i need temporary propagators.

>As far as I understand, you are just using some propagation  method, 
>that's it. Why not use a method that can be used without creating  a
> propagator first?

That is another choice. To implement functions enforcing consistency
techniques and to make this functions friends of propagator objects. I think
this could work but in my opinion it is not as clear as the temporary
propagator approach and it does not allow parametrization either.

Thanks in advance,
Gustavo Gutierrez

>
> 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: Friday, March 18, 2005 11:00 PM
> To: gecode at ps.uni-sb.de
> Subject: [Gecode] Discarding propagators
>
>
> Hi all,
>
> Few weeks ago i posted a message with subject "design question". 
> There, i was trying to implement a propagator that uses other 
> propagators to verify some kind of consistency and then decide to 
> prune or not domain values. That is, the user-imposed propagator calls 
> auxiliar propagators, and using the outcome of such propagators, takes 
> certain actions.
>
> In order to do that without fall in space failures i use a copy of 
> variables and create a new propagator, then call the propagate method 
> directly. This new propagator needs to be disabled after the 
> consistency proof (i.e. it will not exist as long as ordinary 
> propagators imposed by user). In order to
> "simulate" propagator disabling i added a new method that contains a flag.
> When the flag becomes true the propagate method returns ES_SUBSUMMED. My
> hope is that the auxiliar propagator will be removed (in a safe way) from
> the propagation queue at some time after this.
>
> I was able of implementing the "main" propagator following this 
> approach. My problem is that it works fine in some examples, but for 
> others it raises a segfault. Very likely, I have a misassumption 
> regarding the role and functioning of the propagation queue. I would 
> apprecciate any comments and/or suggestions on this issue.
>
> Thanks in advance,
>
> Gustavo Gutierrez _______________________________________________
> Gecode mailing list
> Gecode at ps.uni-sb.de http://www.ps.uni-sb.de/mailman/listinfo/gecode


--------------------------------------------------------------
 Please avoid sending me Word or PowerPoint attachments.
 See http://www.gnu.org/philosophy/no-word-attachments.html







More information about the gecode-users mailing list