1 / 13

Action Rules (AR)

Action Rules (AR). Early Implementation methods Complex abstract machines (e.g., CHIP) Special purpose constructs Indexicals, delay constructs, attribute variables General purpose language (CHR) Motivation of AR

leif
Download Presentation

Action Rules (AR)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Action Rules (AR) • Early Implementation methods • Complex abstract machines (e.g., CHIP) • Special purpose constructs • Indexicals, delay constructs, attribute variables • General purpose language (CHR) • Motivation of AR • A powerful , flexible, and efficient language for implementing propagation-based constraint solvers by Neng-Fa Zhou

  2. Suspension & Domain Variables • Suspension variables • susp_attach_term(X,T) • Attach term T to X • susp_attached_term(X,T) • The attached term to X is T • Domain variables • fd_var(V),fd_first(V,N),fd_last(V,N),fd_size(V,N),fd_true(V,E),fd_set_false(V,E),fd_next(V,E,NextE),fd_prev(V,E,PrevE) by Neng-Fa Zhou

  3. Syntax and Semantics of AR • Syntax Agent, Condition, {Event} => Action • Operational semantics • An agent (sub-goal) C will be suspended if: • C matches Agent, • Condition is met, and • Event is not empty • C is activated whenever an event in Event is posted • Action is executed when C is activated and Condition is met • C is suspended again after Action is executed • The next rule is tried if Condition fails • Cfails if Action fails by Neng-Fa Zhou

  4. Posting Events: post(E) • event(X,O) • X – suspension variable • O – event object • Events for programming propagators • ins(X) – X is instantiated • bound(X) – The bound of the domain of X is updated • dom(X,E) – E is excluded from the domain of X by Neng-Fa Zhou

  5. Example 1An Echoing Agent echo_agent(X), {event(X,Message)} => write(Message),nl. by Neng-Fa Zhou

  6. Example 2freeze(X,G) freeze(X,G), var(X), {ins(X)} => true. freeze(X,G) => call(G). by Neng-Fa Zhou

  7. Propagators for aX=bY+c • Forward checking 'aX=bY+c_forward'(A,X,B,Y,C),var(X),var(Y), {ins(X),ins(Y)} => true. 'aX=bY+c_forward'(A,X,B,Y,C),var(X) => T is B*Y+C,Ex is T//A, A*Ex=:=T. 'aX=bY+c_forward'(A,X,B,Y,C) => T is A*X-C, Ey is T//B, B*Ey=:=T. When either X or Y is instantiated, instantiate the other variable. by Neng-Fa Zhou

  8. Propagators for aX=bY+c • Interval consistency 'aX in bY+c_interval'(A,X,B,Y,C),var(X),var(Y), {bound(Y)} => 'aX in bY+c_reduce_domain'(A,X,B,Y,C). 'aX in bY+c_interval'(A,X,B,Y,C) => true. Whenever the bound of Y’s domain is updated, reduce X’s domain to achieve interval consistency. by Neng-Fa Zhou

  9. Propagators for aX=bY+c • Arc consistency 'aX in bY+c_arc'(A,X,B,Y,C),var(X),var(Y), {dom(Y,Ey)} => T is B*Ey+C, Ex is T//A, (A*Ex=:=T -> exclude(X,Ex);true). 'aX in bY+c_arc'(A,X,B,Y,C) => true. Whenever an element Ey is excluded from Y’s domain, exclude Ey’s counterpart Ex from X’s domain. by Neng-Fa Zhou

  10. Propagator for A1*X1+...+An*Xn+C = 0 'A1*X1+...+An*Xn+C=0'(C,A1,A2,...,An,X1,X2,..,Xn), n_vars_gt(n,2), {ins(X1),bound(X1),...,ins(Xn),bound(Xn)} => reduce domains of X1,..,Xn to achieve ic. 'A1*X1+...+An*Xn+C=0'(C,A1,A2,...,An,X1,X2,..,Xn) => nary_to_binary(NewC,B1,B2,Y1,Y2), call_binary_propagator(NewC,B1,Y1,B2,Y2). When the constraint has more than 2 variables, achieve interval consistency. When the constraint is binary archive arc consistency. by Neng-Fa Zhou

  11. Performance EvaluationCLP(FD) BP: 6.4, Eclipse (EP) 5.5 #46, Sicstus (SP) 3.10, Gnu-Prolog (GP) 1.2.16) by Neng-Fa Zhou

  12. Performance EvaluationCLP(SET) by Neng-Fa Zhou

  13. Papers • N.F. Zhou: Programming Finite-Domain Constraint Propagators in Action Rules, submitted to TPLP, 2004. • N.F. Zhou: Implementing Constraint Solvers in B-Prolog, IFIP World Congress, Intelligent Information Processing, pp.249-260, 2002. • N.F. Zhou: A High-Level Intermediate Language and the Algorithms for Compiling Finite-Domain Constraints, Proc. Joint International Conference and Symposium on Logic Programming, pp.70-84, 1998. • N.F. Zhouand J.Schimpf: Implementation of Propagation Rules for Set Constraints Revisited, unpublished manuscript, 2002. by Neng-Fa Zhou

More Related