Re: [eclipse-clp-users] Hooking into constraint propagation

From: Kish Shen <kisshen_at_cisco.com>
Date: Tue, 16 Aug 2011 18:15:06 +0100
Hi Chris,

Associating names with constraints is something that was discussed by 
the ECLiPSe team at IC-Parc, and I don't think we ever came up with a 
good scheme to do it.

One important aim was that we wanted a general constraint naming scheme, 
which can be used in different solvers, so that we didn't have different 
schemes for different solvers (e.g. ic and eplex) -- I think this was 
largely a question of syntax, but I don't remember the details of the 
discussion we had, but I think one issue was what to relate the name of 
the constraint to (e.g. the "source", i.e. the constraint as posted by 
the user, or the "implementation", which is what you are interested in), 
what you can do with the names of the constraints, and how this can be 
made uniform across different solvers. Names can be used in different 
ways, and we certainly did not want to have different schemes for the 
different usages.

For ic, some of the issue that I remember is that the implementation of 
a constraint can be quite complex -- there is not always a one-to-one 
mapping between a constraint and the code that implements it (the 
propagator). A constraint can map to multiple propagators, and/or the 
constraint may map to different propagator during the life time of the 
constraint. I seem to remember that were even cases where multiple 
constraints mapped to the same propagator.

To implement naming correctly so that you can use the name as a hook 
into its propagator(s), I suspect you probably need to develop some sort 
of protocol, e.g. to register a constraint name and associate it with 
the predicate(s)/suspension(s) that implements the propagator(s). This 
would probably mean extensive rewrite of all the constraint 
implementations of ic.

Cheers,

Kish

On 16/08/2011 08:17, Chris Mears wrote:
> Hello all,
>
> I would like to execute some code before and after the waking of every
> ic constraint. I'd like to be able to examine the domains of the
> variables involved in the constraint, and obtain the "name" of the
> constraint as specified when the constraint is posted.
>
> For example, I would like to do:
>
>    [W,X,Y,Z] #:: 1..5,
>    post(first_constraint, alldifferent([W,X,Y])),
>    post(second_constraint, alldifferent([X,Y,Z])),
>
> where 'first_constraint' and 'second_constraint' are simply names for
> the constraints. Then, if I later (during search, say) assign X=1, I
> would like this output to be produced:
>
>    first_constraint waking up, with domains {1..5}, {1}, {1..5}
>    first_constraint finished, with domains {2..5}, {1}, {2..5}
>    second_constraint waking up, with domains {1}, {2..5}, {1..5}
>    second_constraint finished, with domains {1}, {2..5}, {2..5}
>
> Can anyone please suggest what parts of Eclipse to modify, in the ic
> library or elsewhere, that would help to achieve this?
>
> Thanks,
> Chris Mears
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at:  http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users


-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Tue Aug 16 2011 - 17:15:16 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET