200 likes | 352 Views
Programming with Constraints Jia-Huai You. Constraint programming languages - based on non-monotonic logic - Answer set programming (ASP) Knowledge Representation and Reasoning - Semantics, computation, application. Examples. 3-Colorability
E N D
Programming with ConstraintsJia-Huai You • Constraint programming languages - based on non-monotonic logic - Answer set programming (ASP) • Knowledge Representation and Reasoning - Semantics, computation, application
Examples 3-Colorability Given a graph (V, E), assign each vertex a color in (r, b, g) such that no two connected vertices have the same color. Hamiltonian Path A path in a graph that reaches each vertex exactly once
Examples Planning How do we express “Once a property holds, it remains to hold until an action causes it not to hold.”
Goal WANTED: an approach to modeling and solving AI problems (planning, puzzles, combinatorics, …) • Diverse domains • Constraints • Incomplete information • Frame problem
Solution • The programming paradigm based on the stable model/answer set semantics • Basic idea - Encode problem (specification + instance) as logic program rules - Solutions are stable models of the program
Stable Models • Logic program rules (normal rules) • Grounding: any true atom is derivable by a rule with true body • Minimal • Rules have declarative reading as constraints A B1,…, Bk, not C1, …, not Cm
ASP vs. Logic Programming • Logic Programming • Single intended model • Domain possibly infinite • Unification and lifting to nonground case • Extensive use of recursion • Can specify any recursively enumerable set • append([ ], X, X). • append([X|Y], Z, [X|M]) :- append(Y,Z,M).
ASP vs. Logic Programming • ASP based on stable models • Several stable models, each as a solution • Function free programs • Finite domains • Limited use of recursion • Not intended to have full computability
Example: 3-colorability Given a graph (V, E), assign each vertex a color in (r, b, g) such that no two connected vertices have the same color. clrd(V,r) vtx(V), not clrd(V,b), notclrd(V,g) clrd(V,g) vtx(V), notclrd(V,r), notclrd(V,b) clrd(V,b) vtx(V), notclrd(V,r), notclrd(V,g) clr(C), edge(V,U), clrd(V,C), clrd(U,C)
Stable Models vs. SAT • Rules with exceptions • Frame Axioms fly(X) bird(X), notab_bird(X) ab_bird(X) penguin(X) ab_bird(X) no_wings(X) on(X,Y,T2) nextState(T2,T1), on(X,Y,T1), notmoving(X,T1)
Why ASP? • Highly expressive • Compact representation • Efficient computation • Bases for building advanced KR systems
Example: Hamiltonian Path • A path in a graph that reaches each node exactly once • A challenge for SAT solvers as no compact SAT encoding (with linear number of atoms) is known • Easily represented by a disjunctive program • Given facts about arc(X,Y) node(X)
A disjunctive program for Hamiltonian path reached(X) start(X) reached(X) reached(Y), inPath(Y,X) inPath(X,Y) v outPath(X,Y) arc(X,Y) inPath(X,Y), inPath(X,Y1), Y <> Y1 inPath(X,Y), inPath(X1,Y), X <> X1 node(X), not reached(X)
A number of Systems have been built • smodels by Ilkka Niemela’s group at HUT • dlv by Nicola Leone et al. at TU Wien
Some Research Issues Fundamental questions: • Why ASP • Why not just propositional logic? • Is there a real need to resort to logic programming? No formal argument yet
Some Research Issues • Semantics • - Are there other suitable semantics for ASP? • - stable models don’t tolerant “paradoxes” shave(X,Y) not shave(Y,Y)
Some Research Issues • Language Extension • - Other useful constructs • - The complexity of the resulting language • - How to implement them • E.g. Cardinality constraints v {p1,…,pn} u Body
Some Research Issues • Computation • - Efficient implementation • - Top-down vs. bottom-up • - ASP vs. SAT vs. Other constraint solvers • Modeling and application - Programming methodologies
Some of my recent papers “Compiling defeasible networks to general logic programs,” Artificial Intelligence, 1999 “Unfolding partiality and disjunctions in stable model semantics,” KR 2000. “An abductive approach to disjunctive logic programs,” J. Logic Programming, 2000 “Loop checks for logic programs with functions” Theoretical Computer Science (to appear)
Some of my recent papers “Nonmonotonic reasoning as prioritized argumentation”, IEEE TKDE (to appear) “Rewrite systems for abduction”, forthcoming …