Outline for 4/9 Recap Constraint Satisfaction Techniques

Slides:



Advertisements
Similar presentations
Big Ideas in Cmput366. Search Blind Search State space representation Iterative deepening Heuristic Search A*, f(n)=g(n)+h(n), admissible heuristics Local.
Advertisements

Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Constraint Satisfaction CSE 473 University of Washington.
Knowledge Representation I (Propositional Logic) CSE 473.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Logic in AI CSE 573. © Daniel S. Weld 2 Logistics Monday? Reading Ch 8 Ch 9 thru p 278 Section 10.3 Projects Due 11/10 Teams and project plan due by this.
Knowledge Representation II (Inference in Propositional Logic) CSE 473.
Knowledge Representation II (Inference in Propositional Logic) CSE 473 Continued…
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Logic - Part 2 CSE 573. © Daniel S. Weld 2 Reading Already assigned R&N ch 5, 7, 8, 11 thru 11.2 For next time R&N 9.1, 9.2, 11.4 [optional 11.5]
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
Logic in AI CSE 573. © Daniel S. Weld 2 Logistics Monday? Reading Ch 8 Ch 9 thru p 278 Section 10.3 Projects Due 11/10 Teams and project plan due by this.
S P Vimal, Department of CSIS, BITS, Pilani
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
CS6133 Software Specification and Verification
Chapter 5 Constraint Satisfaction Problems
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
© Daniel S. Weld 1 Logistics Problem Set 2 Due Wed A few KR problems Robocode 1.Form teams of 2 people 2.Write design document.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
Constraint Satisfaction CSE 473 University of Washington.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Inference in Propositional Logic (and Intro to SAT) CSE 473.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
EA C461 Artificial Intelligence
Logic: TD as search, Datalog (variables)
Inference in Propositional Logic (and Intro to SAT)
Knowledge Representation and Reasoning
EA C461 – Artificial Intelligence Logical Agent
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
The Propositional Calculus
Constraint Satisfaction
Logics for Data and Knowledge Representation
Constraint Satisfaction
First-Order Logic and Inductive Logic Programming
Logical Inference: Through Proof to Truth
Logics for Data and Knowledge Representation
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Logic Use mathematical deduction to derive new knowledge.
Logics for Data and Knowledge Representation
Artificial Intelligence
Artificial Intelligence: Agents and Propositional Logic.
CS 416 Artificial Intelligence
Back to “Serious” Topics…
Logic: Domain Modeling /Proofs + Computer Science cpsc322, Lecture 22
Logics for Data and Knowledge Representation
Knowledge Representation I (Propositional Logic)
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Constraint Satisfaction Problems
Presentation transcript:

Outline for 4/9 Recap Constraint Satisfaction Techniques Backjumping (BJ) Conflict-Directed Backjumping (CBJ) Forward checking (FC) Dynamic variable ordering heuristics Preprocessing Strategies Combinatorial Optimization Knowledge Representation I Propositional Logic: Syntax Propositional Logic: Semantics Propositional Logic: Inference Compilation to SAT

Unifying View of AI Knowledge Representation Search Expressiveness Reasoning (Tractability) Search Space being searched Algorithms & performance

Specifying a search problem? What are states (nodes in graph)? What are the operators (arcs between nodes)? Initial state? Goal test? [Cost?, Heuristics?, Constraints?] 1 2 3 4 5 6 E.g., Eight Puzzle 7 8

Towers of Hanoi What are states (nodes in graph)? What are the operators (arcs between nodes)? Initial state? Goal test? a b c

Planning What is Search Space? What is Initial State? What is Goal? What are states? What are arcs? What is Initial State? What is Goal? Path Cost? Heuristic? a c b PickUp(Block) PutDown(Block) a b c

Search Summary Time Space Complete? Opt? Brute force DFS b^d d N N BFS b^d b^d Y Y Iterative deepening b^d bd Y Y Iterative broadening b^d Heuristic Best first b^d b^d N N Beam b^d b+L N N Hill climbing b^d b N N Simulated annealing b^d b N N Limited discrepancy b^d bd Y/N Y/N Optimizing A* b^d b^d Y Y IDA* b^d b Y Y SMA* b^d [b-max] Y Y

Constraint Satisfaction Chronological Backtracking (BT) Backjumping (BJ) Conflict-Directed Backjumping (CBJ) Forward checking (FC) Dynamic variable ordering heuristics Preprocessing Strategies

Chinese Constraint Network Must be Hot&Sour Soup No Peanuts Chicken Dish Appetizer Total Cost < $30 No Peanuts Pork Dish Vegetable Seafood Rice Not Both Spicy Not Chow Mein

CSPs in the real world Scheduling Space Shuttle Repair Transportation Planning Computer Configuration Diagnosis Etc...

Binary Constraint Network Set of n variables: x1 … xn Value domains for each variable: D1 … Dn Set of binary constraints (also known as relations) Rij  Di  Dj Specifies which values of xi are consistent w/ those of xj Partial assignment of values with a tuple of pairs {...(x,a)…} means variable x gets value a... Consistent if all constraints satisfied on all vars in tuple Tuple = full solution if consistent & all vars included Tuple {(xi, ai) … (xj, aj)} consistent w/ a set of vars {xm … xn} iff  am … an such that this tuple is consistent: {(xi, ai) … (xj, aj), (xm, am) … (xn, an)} }

N Queens Variables = board columns Domain values = rows Rij = {(ai, aj) : (ai  aj)  (|i-j|  |ai-aj|) e.g. R12 = {(1,3), (1,4), (2,4), (3,1), (4,1), (4,2)} {(x1, 2), (x2, 4), (x3, 1)} consistent with (x4) Shorthand: “{2, 4, 1} consistent with x4” Q Q Q

CSP as a search problem? What are states (nodes in graph)? What are the operators (arcs between nodes)? Initial state? Goal test? Q Q Q

Chronological Backtracking (BT) (e.g., depth first search) 1 Q Q 2 6 Q Q Q Q Q 4 Consistency check performed in the order in which vars were instantiated If c-check fails, try next value of current var If no more values, backtrack to most recent var Q 3 Q Q 5 Q

Backjumping (BJ) Similar to BT, but more efficient when no consistent instantiation can be found for the current var Instead of backtracking to most recent var… BJ reverts to deepest var which was checked against the current var Q Q Q BJ Discovers (2, 5, 3, 6) inconsistent with x6 No sense trying other values of x5 Q Q

Conflict-Directed Backjumping (CBJ) More sophisticated backjumping behavior Each variable has conflict set CS Set of vars that failed consistency checks w/ current val Update this set on every failed c-check When no more values to try for xi Backtrack to deepest var, xh, in CS(xi) And update CS(xh) := CS(xh)  CS(xi)-{xh} Q CBJ Discovers (2, 5, 3) inconsistent with {x5, x6 } Q Q

BT vs. BJ vs. CBJ {

Forward Checking (FC) Perform Consistency Check Forward Whenever assign var a value Prune inconsistent values from As-yet unvisited variables Backtrack if domain of any var ever collapses FC only visits consistent nodes but not all such nodes skips (2, 5, 3, 4) which CBJ visits But FC can’t detect that (2, 5, 3) inconsistent with {x5, x6 } Q Q Q Q Q

Number of Nodes Explored BT=BM More BJ=BMJ=BMJ2 FC CBJ=BM-CBJ=BM-CBJ2 Fewer FC-CBJ

Number of Consistency Checks BT BJ FC BM CBJ BMJ FC-CBJ BMJ2 BM-CBJ BM-CBJ2

Dynamic variable ordering In the N-queens examples we assumed First x1 then x2 then ... But this order not required Any order ok with respect to completeness A good order leads to huge speedup A good heuristic: Choose variable w/ minimum remaining values This is easy if one is doing FC

Add Some DVO Numbers

Preprocessing Strategies Even FC-CBJ is O(b^d) time worst case Sometimes useful to spend polynomial time preprocessing to achieve local consistency before doing exponential search Arc consistency Consider all pairs of vars Can any values be eliminated from a domain ala FC Propagate O(d^2) time where d= number of vars

Combinatorial Optimization Nonlinear Programs Convex Programs Local optimality  global optimality Kuhn Tucker conditions for optimality Linear Programs Simplex aAlgorithm Flow and Matching Integer Programming

Today’s Outline Recap Constraint Satisfaction Techniques Backjumping (BJ) Conflict-Directed Backjumping (CBJ) Forward checking (FC) Dynamic variable ordering heuristics Preprocessing Strategies Combinatorial Optimization Knowledge Representation I Propositional Logic: Syntax Propositional Logic: Semantics Propositional Logic: Inference Compilation to SAT

In the Knowledge Lies the Power Ed Feigenbaum Stanford University If the patient has a bacterial skin infection, and specific organisms are not seen in the patient’s blood test, Then there is evidence that the organism causing the infection is Staphylococcus

Some KR Languages Propositional Logic Predicate Calculus Frame Systems Rules with Certainty Factors Bayesian Belief Networks Influence Diagrams Semantic Networks Concept Description Languages Nonmonotonic Logic

In Fact… All popular knowledge representation systems are equivalent to (or a subset of) Logic (Propositional Logic or Predicate Calculus) Probability Theory

AI = Knowledge Representation & Reasoning Syntax Semantics Inference Procedure Algorithm Sound? Complete? Complexity Knowledge Engineering

What is logic? Study of proof and justification (Aristotle 400BC) All human beings are mortal; All Greeks are human beings; Therefore, all Greeks are mortal. Profound idea: logic can be formalized (Frege 1879) Statements are true or false by virtue of their form (“shape”) not their content (what they mean)

Propositional Logic Syntax Semantics Inference Complexity Atomic sentences: P, Q, … Connectives:  , , ,  Semantics Truth Tables Inference Modus Ponens Resolution DPLL GSAT Complexity

First Order Logic vs Prop. Logic Ontology Objects, properties, relations vs.Facts Syntax Sentences have more structure: terms Variables & Quantification ,  Semantics Much more complicated, but who cares Inference Much more complicated

Semantics Syntax: a description of the legal arrangements of symbols (Def “sentences”) Semantics: what the arrangement of symbols means in the world Inference Sentences Facts Representation Semantics Semantics World

Propositional Logic: SEMANTICS Multiple interpretations Assignment to each variable either T or F Assignment of T or F to each connective via defns P T F Q P  Q P  Q P  Q  P T F F T T F T F Note: (P  Q) equivalent to  P  Q

} Notation     = Implication (syntactic symbol) Inference Entailment Sound  implies = Complete = implies 

Definitions valid = tautology = always true satisfiable = sometimes true unsatisfiable = never true 1) smoke  smoke 2) smoke  fire 3) (smoke  fire)  (smoke  fire) 4) smoke  fire  fire smoke  smoke valid  smoke  fire satisfiable  ( smoke  fire)  (smoke  fire) (smoke  fire)   smoke  fire valid valid

Prop. Logic: Knowledge Engr 1) Lisa is not next to Dave in the ranking 2) Jim is immediately ahead of a bio major 3) Dave is immediately ahead of Jim 4) One of the women is a biology major 5) Mary or Lisa is ranked first Choose Vocabulary Universe: Lisa, Dave, Jim, Mary LiaD = “Lisa is immediately ahead of Dave” BioD = “Dave is a Bio Major” Choose initial sentences (wffs) 1) LiaD  DiaL 2) (JiaD  BioD)  (JiaM  BioM)  ... ...

Propositional Logic: Inference Backward Chaining (Goal Reduction) Based on rule of modus ponens If know P1 ...  Pn and know (P1 ...  Pn )=> Q Then can conclude Q Resolution (Proof by Contradiction) GSAT Davis Putnam

Horn Clauses If every sentence in KB is of the form: A  B  C  ...  F  Z equivalently A  B  C  ...  F  Z Then Modus Ponens is Polynomial time, and Complete! Hence, Prolog Implementation Clause means a big disjunction

Resolution A  B  C, C  D  E A  C  D  E Refutation Complete Given an unsatisfiable KB in CNF, Resolution will eventually deduce the empty clause Proof by Contradiction To show  = Q Show   {Q} is unsatisfiable!

Normal Forms CNF = Conjunctive Normal Form Conjunction of disjuncts (each disjunct = “clause”) (P  Q)  R (P  Q)  R (P  Q)  R P  Q  R (P  Q)  R (P  R)  (Q  R)

Terminology Literal u or u, where u is a variable Clause disjunction of literals Formula, , conjunction of clauses (u) take  and set all instances of u true; simplify e.g. =((P, Q)(R, Q)) then (Q)=P Pure literal var appearing in a formula either as a negative literal or a positive literal (but not both) Unit clause clause with only one literal

Davis Putnam (DPLL) [1962] Procedure DPLL (CNF formula: ) If  is empty, return yes. If there is an empty clase in  return no. If there is a pure literal u in  return DPLL((u)). If there is a unit clause {u} in  return DPLL((u)). Else Select a variable v mentioned in . If DPLL((v))=yes, then return yes. return DPLL((v)).

GSAT [1992] Procedure GSAT (CNF formula: , max-restarts, max-climbs) For I := I o max-restarts do A := randomly generated truth assignment for j := 1 to max-climbs do if A satisfies  then return yes A := random choice of one of best successors to A ;; successor means only 1 var val changes from A ;; best means making the most clauses true

FOL Definitions Constants: a,b, dog33. Variables: X, Y. Name a specific object. Variables: X, Y. Refer to an object without naming it. Functions: father-of Mapping from objects to objects. Terms: father-of(father-of(dog33)) Refer to objects Atomic Sentences: in(father-of(dog33), food6) Can be true or false Correspond to propositional symbols P, Q

Propositional. Logic vs First Order Objects, Properties, Relations Ontology Syntax Semantics Inference Facts (P, Q) Atomic sentences Connectives Truth Tables Efficient SAT algorithms Variables & quantification Sentences have structure: terms father-of(mother-of(X))) Interpretations (Much more complicated) Unification Forward, Backward chaining Prolog, theorem proving