Re: [eclipse-clp-users] Propagators with a state

From: Joachim Schimpf <>
Date: Mon, 16 Feb 2009 22:54:42 +1100
Wit Jakuczun wrote:
> 2009/2/16 Joachim Schimpf <>:
>>> Here the state is a domain of a variable.
>>> What is the better way to deal with such propagators?
>> As Kish said, you add a State variable, and use setarg/3 on its arguments.
>> For your example above this would be
>> :- demon propagate/3.
>> propagate(Var, State, Susp) :-
>>     State = state(OldDom),
>>     propagate(Var),
>>     ic:get_domain_as_list(Var, NewDom),
>>     setarg(1, State, NewDom).
> Thank you! That is exactly what I needed.
>> You can find examples of this in the library files ic_constraints.ecl or
>> generic_global_constraints.ecl
>> Btw, in 6.1 I intend to add set_suspension_arg/3 for this purpose.
> That could be an interesting addon. And what about priorities?
> Are you going to standarize them somehow?

Yes, if I can get input for a workable specification - this has been
discussed at length in the past and proven very tricky, so let's try
to keep it simple!

One thing we can definitely do is a static mapping from symbolic names
to numeric priorities (which only gets changed when someone comes up with
a convincing use case for introducing a new level).  For propagators,
we could use Gecode's scheme, where the priorities are called
{unary, binary, ternary, linear, quadratic, cubic, veryslow}
i.e. they initially distinguish constraint arity, then complexity.
For ECLiPSe, where delayed goals can be used for things other than
propagators, I would extend this on both ends as follows:

1-debug (goals that always succeed and do not affect program semantics)
2-check (tests that succeed or fail or abort)
9-subsolver (e.g. the eplex demon)
10-mopup (bookkeeping to be done after all propagation, e.g. lib(changeset))
11-search (nondeterministic goals)
12-main program

This gives us the 12 levels we currently have.  Since we use 4 bits to store
priorities, it would be natural to extend to 15 (giving some flexibility
that can be used e.g. for the case of the ternary propagators in lib(ic)
which schedule themselves up/down one level depending on whether they
achieved some useful propagation or not. This kind of dynamic adjustment
may well be more important than a fine grained static classification).

Any comments?

-- Joachim
Received on Mon Feb 16 2009 - 12:55:38 CET

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