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

From: Wit Jakuczun <wit.jakuczun_at_...6...>
Date: Mon, 16 Feb 2009 08:15:19 +0100
2009/2/16 Joachim Schimpf <joachim.schimpf@...44...>:

>> 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?

Best regards
-- 
[ Wit Jakuczun  w.jakuczun@...116... ]
[ WLOG Solutions http://wlogsolutions.com   ]
Received on Mon Feb 16 2009 - 07:15:22 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST