Action Rules (AR) - PowerPoint PPT Presentation

About This Presentation
Title:

Action Rules (AR)

Description:

achieve interval consistency. When the constraint is binary. archive arc consistency. ... in B-Prolog, IFIP World Congress, Intelligent Information Processing, ... – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 14
Provided by: NengF1
Category:
Tags: action | interval | rules | world

less

Transcript and Presenter's Notes

Title: Action Rules (AR)


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

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)

3
Syntax and Semantics of AR
  • Syntax

Agent, Condition, Event gt 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
  • C fails if Action fails

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

5
Example 1An Echoing Agent
echo_agent(X), event(X,Message) gt
write(Message),nl.
6
Example 2freeze(X,G)
freeze(X,G), var(X), ins(X) gt
true. freeze(X,G) gt call(G).
7
Propagators for aXbYc
  • Forward checking

'aXbYc_forward'(A,X,B,Y,C),var(X),var(Y), ins(
X),ins(Y) gt true. 'aXbYc_forward'(A,X,B,Y,
C),var(X) gt T is BYC,Ex is T//A,
AExT. 'aXbYc_forward'(A,X,B,Y,C) gt
T is AX-C, Ey is T//B, BEyT.
When either X or Y is instantiated, instantiate
the other variable.
8
Propagators for aXbYc
  • Interval consistency

'aX in bYc_interval'(A,X,B,Y,C),var(X),var(Y),
bound(Y) gt 'aX in
bYc_reduce_domain'(A,X,B,Y,C). 'aX in
bYc_interval'(A,X,B,Y,C) gt true.
Whenever the bound of Ys domain is
updated, reduce Xs domain to achieve interval
consistency.
9
Propagators for aXbYc
  • Arc consistency

'aX in bYc_arc'(A,X,B,Y,C),var(X),var(Y), dom(
Y,Ey) gt T is BEyC,
Ex is T//A, (AExT -gt
exclude(X,Ex)true). 'aX in
bYc_arc'(A,X,B,Y,C) gt true.
Whenever an element Ey is excluded from Ys
domain, exclude Eys counterpart Ex from Xs
domain.
10
Propagator for A1X1...AnXnC 0
'A1X1...AnXnC0'(C,A1,A2,...,An,X1,X2,..,Xn)
, n_vars_gt(n,2), ins(X1),bound(X1),...,ins(Xn)
,bound(Xn) gt reduce domains of
X1,..,Xn to achieve ic. 'A1X1...AnXnC0'(
C,A1,A2,...,An,X1,X2,..,Xn) gt
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.
11
Performance EvaluationCLP(FD)
BP 6.4, Eclipse (EP) 5.5 46, Sicstus (SP) 3.10,
Gnu-Prolog (GP) 1.2.16)
12
Performance EvaluationCLP(SET)
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. Zhou and J.Schimpf Implementation of
    Propagation Rules for Set Constraints Revisited,
    unpublished manuscript, 2002.
Write a Comment
User Comments (0)
About PowerShow.com