{"id":2284,"date":"2022-04-16T19:06:23","date_gmt":"2022-04-16T19:06:23","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=2284"},"modified":"2022-04-16T19:06:23","modified_gmt":"2022-04-16T19:06:23","slug":"knowledge-base-for-wumpus-world","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/04\/16\/knowledge-base-for-wumpus-world\/","title":{"rendered":"Knowledge-base for Wumpus world"},"content":{"rendered":"\n<p>As in the previous topic we have learned about the wumpus world and how a knowledge-based agent evolves the world. Now in this topic, we will create a knowledge base for the wumpus world, and will derive some proves for the Wumpus-world using propositional logic.<\/p>\n\n\n\n<p>The agent starts visiting from first square [1, 1], and we already know that this room is safe for the agent. To build a knowledge base for wumpus world, we will use some rules and atomic propositions. We need symbol [i, j] for each location in the wumpus world, where i is for the location of rows, and j for column location.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Atomic proposition variable for Wumpus world:<\/h3>\n\n\n\n<ul><li>Let&nbsp;<strong>P<sub>i,j<\/sub><\/strong>&nbsp;be true if there is a Pit in the room [i, j].<\/li><li>Let&nbsp;<strong>B<sub>i,j<\/sub><\/strong>&nbsp;be true if agent perceives breeze in [i, j], (dead or alive).<\/li><li>Let&nbsp;<strong>W<sub>i,j<\/sub><\/strong>&nbsp;be true if there is wumpus in the square[i, j].<\/li><li>Let&nbsp;<strong>S<sub>i,j<\/sub><\/strong>&nbsp;be true if agent perceives stench in the square [i, j].<\/li><li>Let&nbsp;<strong>V<sub>i,j<\/sub><\/strong>&nbsp;be true if that square[i, j] is visited.<\/li><li>Let&nbsp;<strong>G<sub>i,j<\/sub><\/strong>&nbsp;be true if there is gold (and glitter) in the square [i, j].<\/li><li>Let&nbsp;<strong>OK<sub>i,j<\/sub><\/strong>&nbsp;be true if the room is safe.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Note: For a 4 * 4 square board, there will be 7*4*4= 122 propositional variables.<\/h4>\n\n\n\n<h3 class=\"wp-block-heading\">Some Propositional Rules for the wumpus world:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world2.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Note: lack of variables gives us similar rules for each cell.<\/h4>\n\n\n\n<h3 class=\"wp-block-heading\">Representation of Knowledgebase for Wumpus world:<\/h3>\n\n\n\n<p>Following is the Simple KB for wumpus world when an agent moves from room [1, 1], to room [2,1]:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world3.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n\n\n\n<p>Here in the first row, we have mentioned propositional variables for room[1,1], which is showing that room does not have wumpus(\u00ac W<sub>11<\/sub>), no stench (<strong>\u00acS<sub>11<\/sub><\/strong>), no Pit(<strong>\u00acP<sub>11<\/sub><\/strong>), no breeze(<strong>\u00acB<sub>11<\/sub><\/strong>), no gold (<strong>\u00acG<sub>11<\/sub><\/strong>), visited (<strong>V<sub>11<\/sub><\/strong>), and the room is Safe(<strong>OK<sub>11<\/sub><\/strong>).<\/p>\n\n\n\n<p>In the second row, we have mentioned propositional variables for room [1,2], which is showing that there is no wumpus, stench and breeze are unknown as an agent has not visited room [1,2], no Pit, not visited yet, and the room is safe.<\/p>\n\n\n\n<p>In the third row we have mentioned propositional variable for room[2,1], which is showing that there is no wumpus(\u00ac W21), no stench (<strong>\u00acS<sub>21<\/sub><\/strong>), no Pit (<strong>\u00acP<sub>21<\/sub><\/strong>), Perceives breeze(<strong>B<sub>21<\/sub><\/strong>), no glitter(<strong>\u00acG<sub>21<\/sub><\/strong>), visited (<strong>V<sub>21<\/sub><\/strong>), and room is safe (<strong>OK<sub>21<\/sub><\/strong>).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prove that Wumpus is in the room (1, 3)<\/h2>\n\n\n\n<p>We can prove that wumpus is in the room (1, 3) using propositional rules which we have derived for the wumpus world and using inference rule.<\/p>\n\n\n\n<ul><li><strong>Apply Modus Ponens with \u00acS11 and R1:<\/strong><\/li><\/ul>\n\n\n\n<p>We will firstly apply MP rule with R1 which is \u00acS<sub>11<\/sub>&nbsp;\u2192 \u00ac W<sub>11<\/sub>&nbsp;^ \u00ac W<sub>12<\/sub>&nbsp;^ \u00ac W<sub>21<\/sub>, and&nbsp;<strong>\u00acS<sub>11<\/sub><\/strong>&nbsp;which will give the output \u00ac W<sub>11<\/sub>&nbsp;^ W<sub>12<\/sub>&nbsp;^ W<sub>12<\/sub>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world4.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n\n\n\n<ul><li><strong>Apply And-Elimination Rule:<\/strong><\/li><\/ul>\n\n\n\n<p>After applying And-elimination rule to \u00ac W<sub>11<\/sub>&nbsp;\u2227 \u00ac W<sub>12<\/sub>&nbsp;\u2227 \u00ac W<sub>21<\/sub>, we will get three statements:<br><strong>\u00ac W<sub>11<\/sub>, \u00ac W<sub>12<\/sub>, and \u00acW<sub>21<\/sub><\/strong>.<\/p>\n\n\n\n<ul><li><strong>Apply Modus Ponens to \u00acS<sub>21<\/sub>, and R2:<\/strong><\/li><\/ul>\n\n\n\n<p>Now we will apply Modus Ponens to \u00acS<sub>21<\/sub>&nbsp;and R2 which is \u00acS<sub>21<\/sub>&nbsp;\u2192 \u00ac W<sub>21<\/sub>&nbsp;\u2227\u00ac W<sub>22<\/sub>&nbsp;\u2227 \u00ac W<sub>31<\/sub>, which will give the Output as&nbsp;<strong>\u00ac W<sub>21<\/sub>&nbsp;\u2227 \u00ac W<sub>22<\/sub>&nbsp;\u2227\u00ac W<sub>31<\/sub><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world5.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n\n\n\n<ul><li><strong>Apply And -Elimination rule:<\/strong><\/li><\/ul>\n\n\n\n<p>Now again apply And-elimination rule to&nbsp;<strong>\u00ac W<sub>21<\/sub>&nbsp;\u2227 \u00ac W<sub>22<\/sub>&nbsp;\u2227\u00ac W<sub>31<\/sub><\/strong>, We will get three statements:<br><strong>\u00ac W<sub>21<\/sub>, \u00ac W<sub>22<\/sub>, and \u00ac W<sub>31<\/sub><\/strong>.<\/p>\n\n\n\n<ul><li><strong>Apply MP to S<sub>12<\/sub>&nbsp;and R4:<\/strong><\/li><\/ul>\n\n\n\n<p>Apply Modus Ponens to&nbsp;<strong>S<sub>12<\/sub><\/strong>&nbsp;and&nbsp;<strong>R<sub>4<\/sub><\/strong>&nbsp;which is&nbsp;<strong>S<sub>12<\/sub>&nbsp;\u2192 W<sub>13<\/sub>&nbsp;\u2228. W<sub>12<\/sub>&nbsp;\u2228. W<sub>22<\/sub>&nbsp;\u2228.W<sub>11<\/sub><\/strong>, we will get the output as&nbsp;<strong>W<sub>13<\/sub>\u2228 W<sub>12<\/sub>&nbsp;\u2228 W<sub>22<\/sub>&nbsp;\u2228.W<sub>11<\/sub><\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world6.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n\n\n\n<ul><li><strong>Apply Unit resolution on W<sub>13<\/sub>&nbsp;\u2228 W<sub>12<\/sub>&nbsp;\u2228 W<sub>22<\/sub>&nbsp;\u2228W<sub>11<\/sub>&nbsp;and \u00ac W<sub>11<\/sub>&nbsp;:<\/strong><\/li><\/ul>\n\n\n\n<p>After applying Unit resolution formula on W<sub>13<\/sub>&nbsp;\u2228 W<sub>12<\/sub>&nbsp;\u2228 W<sub>22<\/sub>&nbsp;\u2228W<sub>11<\/sub>&nbsp;and \u00ac W<sub>11<\/sub>&nbsp;we will get W<sub>13<\/sub>&nbsp;\u2228 W<sub>12<\/sub>&nbsp;\u2228 W<sub>22<\/sub>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world7.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n\n\n\n<ul><li><strong>Apply Unit resolution on W<sub>13<\/sub>&nbsp;\u2228 W<sub>12<\/sub>&nbsp;\u2228 W<sub>22<\/sub>&nbsp;and \u00ac W<sub>22<\/sub>&nbsp;:<\/strong><\/li><\/ul>\n\n\n\n<p>After applying Unit resolution on&nbsp;<strong>W<sub>13<\/sub>&nbsp;\u2228 W<sub>12<\/sub>&nbsp;\u2228 W<sub>22<\/sub><\/strong>, and&nbsp;<strong>\u00acW<sub>22<\/sub><\/strong>, we will get&nbsp;<strong>W<sub>13<\/sub>&nbsp;\u2228 W<sub>12<\/sub><\/strong>&nbsp;as output.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world8.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n\n\n\n<ul><li><strong>Apply Unit Resolution on W<sub>13<\/sub>&nbsp;\u2228 W<sub>12<\/sub>&nbsp;and \u00ac W<sub>12<\/sub>&nbsp;:<\/strong><\/li><\/ul>\n\n\n\n<p>After Applying Unit resolution on&nbsp;<strong>W<sub>13<\/sub>&nbsp;\u2228 W<sub>12<\/sub>&nbsp;and \u00ac W<sub>12<\/sub><\/strong>, we will get&nbsp;<strong>W<sub>13<\/sub><\/strong>&nbsp;as an output, hence it is proved that the Wumpus is in the room [1, 3].<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-knowledge-base-for-wumpus-world9.png\" alt=\"Knowledge-base for Wumpus world\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>As in the previous topic we have learned about the wumpus world and how a knowledge-based agent evolves the world. Now in this topic, we will create a knowledge base for the wumpus world, and will derive some proves for the Wumpus-world using propositional logic. The agent starts visiting from first square [1, 1], and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[885],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/2284"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=2284"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/2284\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=2284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=2284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=2284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}