23
© 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

© 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

Embed Size (px)

Citation preview

Page 1: © 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

© Daniel S. Weld 1

Logistics

Problem Set 2Due WedA few KR problemsRobocode

1. Form teams of 2 people2. Write design document

Page 2: © 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

© Daniel S. Weld 2

Paper Commentary

• Most important ideas• Biggest flaws• Open research questions

Page 3: © 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

© Daniel S. Weld 3

573 Topics

Agency

Problem Spaces

SearchKnowledge

Representation

Planning

Perception

NLPMulti-agent

Robotics

Uncertainty

MDPs SupervisedLearning

Reinforcement

Learning

Page 4: © 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

© Daniel S. Weld 4

Knowledge Representation

• Expressiveness• Tractability

Page 5: © 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

© Daniel S. Weld 5

Outline for Today

• Review propositional logic• Inference in propositional logic• A sampling of first-order logic• Representing events, action & change

Page 6: © 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

© Daniel S. Weld 6

Semantics• Syntax: a description of the legal

arrangements of symbols   (Def “sentences”)

• Semantics: what the arrangement of symbols means in the world

Sentences

FactsFacts

Sentences

Representation

World

Semantics

Semantics

Inference

Page 7: © 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

© Daniel S. Weld 7

Propositional Logic• Syntax

  Atomic sentences: P, Q, …  Connectives: , , ,

• Semantics  Truth Tables

• Inference  Modus Ponens  Resolution  DPLL  WalkSAT

• Complexity

Page 8: © 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

© Daniel S. Weld 8

Prop. Logic: Knowledge Engr

1. Choose Vocabulary

1) One of the women is a biology major2) Lisa is not next to Dave in the ranking3) Dave is immediately ahead of Jim4) Jim is immediately ahead of a bio major 5) Mary or Lisa is ranked first

Universe: Lisa, Dave, Jim, MaryLD = “Lisa is immediately ahead of Dave”D = “Dave is a Bio Major”

2. Choose initial sentences (wffs)

L M LD DL…

Page 9: © 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

© Daniel S. Weld 9

Reasoning Tasks• Model finding

KB = background knowledgeS = description of problemShow (KB S) is satisfiableA kind of constraint satisfaction

• DeductionS = question

Prove that KB |= STwo approaches:

1.Rules to derive new formulas from old (inference)

2.Show (KB S) is unsatisfiable

Page 10: © 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

© Daniel S. Weld 10

Propositional Logic: Inference

A mechanical process for computing new sentences

1. Backward & Forward Chaining Based on rule of modus ponens

If know P1, …, Pn & know (P1 ... Pn )=> QThen can conclude Q

2. Resolution (Proof by Contradiction)3. WalkSAT4. Davis Putnam

Page 11: © 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

© Daniel S. Weld 11

Special Syntactic Forms

•General Form:((q r) s)) (s t)

•Conjunction Normal Form (CNF)( q r s ) ( s t)Set notation: { ( q, r, s ), ( s, t) }empty clause () = false

•Binary clauses: 1 or 2 literals per clause( q r) ( s t)

•Horn clauses: 0 or 1 positive literal per clause( q r s ) ( s t)(qr) s (st) false

Page 12: © 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

© Daniel S. Weld 12

Inference

Resolution{ (p ), ( p ) } |-R ( )

Correctness

If S1 |-R S2 then S1 |= S2 Refutation Completeness:

If S is unsatisfiable then S |-R ()

Page 13: © 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

© Daniel S. Weld 13

If the unicorn is mythical, then it is immortal, but if it is not mythical, it is a mammal. If the unicorn is either immortal or a mammal, then it is horned.

Prove: the unicorn is horned.

M = mythicalI = immortalA = mammalH = horned

Resolution

( A H)

(M A)

( H) (I H)

( M)

( M I)(I)(A)

(M)

()

Page 14: © 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

© Daniel S. Weld 14

Structure in Clauses

• Pure Literals  A symbol that always appears with same sign  {{a b c}{c d e}{a b e}{d b}{e a c}}

• Unit Literals  A literal that appears in a singleton clause  {{b c}{c}{a b e}{d b}{e a c}}

  Might as well set it true! And simplify  {{a b c} {a b e} {e a c}}

  Might as well set it true! And simplify  {{b} {a b e}{d b}}    {{d}}

Page 15: © 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

© Daniel S. Weld 15

DPLLDavis Putnam Loveland Logmann

•Model finding: Search (what kind?) over space of partial truth assignments

DPLL( wff ): If a pure literal P, return DPLL(wff extended by P) For each unit clause (Y), simplify wff: Remove clauses containing Y

Shorten clauses contain Y If no clause left, return true (satisfiable) If empty clause, return false Choose a variable X & choose a value (0/1) If DPLL(wff extended by X ) return true else return DPLL(wff, X)

Page 16: © 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

© Daniel S. Weld 16

DPLL•Developed 1962 – still the best complete algorithm for propositional reasoning

•State of the art solvers use:  Smart variable choice heuristics  “Clause learning” – at backtrack points, determine

minimum set of choices that caused inconsistency, add new clause• Limited resolution (Agarwal, Kautz, Beame 2002)

  Randomized tie breaking & restarts•Chaff – fastest complete SAT solver

  Created by 2 Princeton undergrads, for a summer project!

  Superscaler processor verification  AI planning - Blackbox

Page 17: © 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

© Daniel S. Weld 17

Horn Theories•Recall the special case of Horn clauses:

{ ( q r s ), ( s t) }{ ((qr) s ), ((st) false) }

•Many problems naturally take the form of such if/then rules

  If (fever) AND (vomiting) then FLU

•Unit propagation is refutation complete for Horn theories

  Good implementation – linear time!

Page 18: © 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

© Daniel S. Weld 18

WalkSat•Local search over space of complete truth assignments

  With probability P: flip any variable in any unsatisfied clause

  With probability (1-P): flip best variable in any unsat clause• Like fixed-temperature simulated annealing

•SAT encodings of N-Queens, scheduling•Best algorithm for random K-SAT

  Best DPLL: 700 variables  Walksat: 100,000 variables

Page 19: © 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

© Daniel S. Weld 19

Random 3-SAT

• Random 3-SAT  sample uniformly from

space of all possible 3-clauses

  n variables, l clauses

• Which are the hard instances?  around l/n = 4.3

Page 20: © 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

© Daniel S. Weld 20

Random 3-SAT

• Varying problem size, n

• Complexity peak appears to be largely invariant of algorithm  backtracking algorithms like

Davis-Putnam  local search procedures like

GSAT

• What’s so special about 4.3?

Page 21: © 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

© Daniel S. Weld 21

Random 3-SAT

• Complexity peak coincides with solubility transition

  l/n < 4.3 problems under-constrained and SAT

  l/n > 4.3 problems over-constrained and UNSAT

  l/n=4.3, problems on “knife-edge” between SAT and UNSAT

Page 22: © 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

© Daniel S. Weld 22

Real-World Phase Transition Phenomena

• Many NP-hard problem distributions show phase transitions -  job shop scheduling problems  TSP instances from TSPLib  exam timetables @ Edinburgh  Boolean circuit synthesis   Latin squares (alias sports scheduling)

• Hot research topic: predicting hardness of a given instance, & using hardness to control search strategy (Horvitz, Kautz, Ruan 2001-3)

Page 23: © 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

© Daniel S. Weld 23

Summary

• Expressiveness

  NPC in general  Completeness / speed tradeoff  Horn clauses, binary clauses

• Tractability

  Expressive but awkward  No notion of objects, properties, or relations  Number of propositions is fixed