Transcript Document
INC 551 Artificial Intelligence Lecture 5 Logical Agents Deliberative Agent Agent Action Make Decision Environment World Model Sense, Perceive World Model State-Action Model Logic Model • If A happen, B will happen Action • There is C and D in E Action • Some of G is in H State1 State2 State3 • X is above Y • Y is above Z Early Thought on AI (1975) • Human cognition comes from a symbol system. • A physical symbol system [such as a digital computer, for example] has the necessary and sufficient means for intelligent actions • Intelligent comes from processing of symbols. Wumpus World Wumpus World Characteristic Observable?? Wumpus World Characteristic Observable = no (only local perception) Deterministic?? Wumpus World Characteristic Observable = no (only local perception) Deterministic = yes (no chance involve) Static?? Wumpus World Characteristic Observable = no (only local perception) Deterministic = yes (no chance involve) Static = yes (Wumpus and pits do not move) Discrete?? Wumpus World Characteristic Observable = no (only local perception) Deterministic = yes (no chance involve) Static = yes (Wumpus and pits do not move) Discrete = yes Inference Example Other Techniques Logic Logic คือ formal language ของ information แสดงว่ าต้ องมี conclusion จากมัน Semantics คือ ความหมายของประโยคว่ า true or false x2 y x2 เป็ น logic ไม่ เป็ น logic Entailment Entailment ใช้ สัญลักษณ์ ╞ คล้ ายกับการเป็ น subset Entailment เป็ นเครื่องมือทีใ่ ช้ ในการ inference เช่ น KB = ผู้ชายมี 2 มือ α = คนมี 2 มือ Entailment in Wumpus World สมมติฐานเกีย่ วกับหลุม ของ 3 ช่ อง มีได้ 8 แบบ สรุปว่า [1,2] safe สรุ ปอะไรไม่ ได้ Propositional Logic เป็ น syntax ในการแทน Knowledge Base NOT, AND, OR, IF-THEN, IF-AND-ONLY-IF Truth Table Logic Equivalence Wumpus World in Logic Syntax Inference Rules Modus Ponens: If p is TRUE and p→q is TRUE Then q is TRUE And Elimination: If p^q is TRUE Then p is TRUE and q is TRUE Inference Algorithms • Forward Chaining • Backward Chaining จะใช้ กบั KB ทีอ่ ยู่ในรูป Horn form (conjunction of symbols) => symbol ( A B C) D Forward Chaining And/or Graph อยากทราบว่ า Q จริงหรือไม่ เริ่มจาก symbol ทีท่ ราบค่ า ก่ อน (A,B) แล้ วดูว่าได้ knowledge อะไรใหม่ ไปเรื่อยๆ ได้ L ซ้ามาไม่ เป็ นไร Backward Chaining จะเริ่มจาก goal ทีต่ ้ องการรู้คอื Q แล้ วหาว่ าอะไรเป็ น requirement ทีจ่ ะทาให้ ทราบค่ าของมันไปเรื่อยๆ โดย • Avoid repeat node (ทาสิ่ งทีร่ ู้แล้ ว) • Avoid loop (กลับมาสู่ node ทีย่ งั ไม่ รู้) กลับมาที่ P ใหม่ ดังนั้นต้ องตัดทางนีท้ งิ้ Requirement ทีจ่ ะทาให้ รู้ ค่า Q ครบ เริ่ม forward กลับ Conclusion Forward Chaining เป็ น data-driven เปลือง, อาจไม่ เกีย่ วกับ goal Backward Chaining เป็ น goal-driven ไม่ ซับซ้ อน, เร็ว ข้อด้อยของ Propositional Logic Propositional Logic แม้ จะใกล้ เคียงกับภาษามนุษย์ แต่ กไ็ ม่ สามารถ ใช้ แทน logic ของกลุ่มวัตถุได้ ง่ายๆ เช่ น “Squares adjacent to pits are breezy” B1,1 ( P1, 2 P2,1 ) ทาทุก square = เปลือง First-order Logic Comparison for Different Types of Logic First-Order Logic Components Return true,false Return constant Atomic Sentences Atomic Sentences คือ ประโยค ทีไ่ ม่ สามารถแยกเป็ น 2 ส่ วนได้ จะมีโครงสร้ างประกอบด้ วย term (object), predicate (ความสั มพันธ์ ) และ function Complex Sentences Complex Sentence ประกอบด้ วย Atomic Sentences และ logical operation Universal Quantification All “Everyone in this room is cool” x In( x, Room708) Cool( x) In( Poj, Room708) Cool( Poj) In(Wichai, Room708) Cool(Wichai) In( Sathit, Room708) Cool( Sathit) x In( x, Room708) Cool( x) Everyone is in Room708 and everyone is cool. Existential Quantification Some (at least 1) “Someone in this room fart” x In( x, Room708) Fart( x) In( Poj, Room708) Fart( Poj) In(Wichai, Room708) Fart(Wichai) In( Sathit, Room708) Fart( Sathit) x In( x, Room708) Fart( x) Someone is in Room708 and fart or someone is not in Room708. Quantifier Properties Inference in First-Order Logic จะทาการเปลีย่ นเป็ น format ของ propositional logic และจะใช้ หลักการเดียวกับ propositional logic แต่ จะมี เทอม quantifier เพิม่ ขึน้ มา Universal Instantiation (UI) แทนค่าตัวแปรด้ วย constant ที่มีอยู่ทุกตัว Example Existential Instantiation (EI) Inference Problem มี 4 predicates กับ 4 horn form Forward Chaining มี 4 predicates ซึ่งเราทราบว่ า true or false Backward Chaining เริ่มจากสิ่ งทีต่ ้ องการทราบ มี condition 4 อย่ าง และจะได้ ว่า x แทนด้ วย Colonel West แทนค่ า x จะทราบค่ าว่ า true or false จึงหยุด expand ต่ อ แทนค่ า y จะทราบค่ าว่ า true or false จึงหยุด expand ต่ อ