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

From: Wit Jakuczun <wit.jakuczun_at_...6...>
Date: Mon, 16 Feb 2009 20:12:03 +0100
2009/2/16 Kish Shen <kisshen_at_...5...>:
> Hi Wit,
> You can avoid writing two versions of propagator by checking if there
> is a suspension in the propagator/3 code, e.g.:
Thanks, that was too simple solution for me... :)

> On a more general point, if I understood you correctly, you are doing the
> update_state/3 in propagator/2 in your original code because the
> state can change between calling propagator/2 and executing the goals
> in propagator/2, because other propagators can wake up and update the State.

State or variables. State can be also calculated basing on a variables.

> If this is your concern, then I am not sure if your code would avoid the
> problem, because the update can happen after you do the
> update_state/3.
It does not have to... :/

> To avoid this problem, you should use call_priority/2 to call
> propagator/2 with a higher priority than what you are suspending your
> propagators at -- so 2 in your case. In this case, you can also
> miss out the initial update_state, and simplify the code a little.

I am afraid you are right. This means that almost all non trivial
propagators should be called via call_priority/2. This is the only
way to make propagators atomic.

Thank you very much for your help.

Best regards
[ Wit Jakuczun  w.jakuczun_at_...116... ]
[ WLOG Solutions   ]
Received on Mon Feb 16 2009 - 19:12:07 CET

This archive was generated by hypermail 2.3.0 : Sat Aug 24 2019 - 09:15:00 CEST