{"id":1766,"date":"2017-10-08T22:35:30","date_gmt":"2017-10-08T11:35:30","guid":{"rendered":"http:\/\/casestudyhelp.com\/sample-questions\/?p=1766"},"modified":"2018-01-19T18:25:39","modified_gmt":"2018-01-19T07:25:39","slug":"programming-assignment-on-comp4418-2017-assignment-2","status":"publish","type":"post","link":"https:\/\/casestudyhelp.com\/sample-questions\/programming-assignment-on-comp4418-2017-assignment-2\/","title":{"rendered":"Programming Assignment on COMP4418,  2017 \u2013 Assignment 2"},"content":{"rendered":"<p><strong>Due: 14:59:59pm 04 October (Week 10)<\/strong><\/p>\n<p><strong>Late penalty: 10 marks per day<\/strong><\/p>\n<p><strong>Worth: 15 %<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>This assignment consists of five questions.<\/p>\n<p><strong>1-[20 Marks] <\/strong>(Answer Set Programming)<\/p>\n<p>A <em>clique <\/em>of a graph is a set of vertices <em>C <\/em>that are all adjacent to each other. That is, for a graph with vertices <em>V <\/em>and undirected edges <em>E <\/em><em>\u2286 <\/em><em>{{<\/em><em>x, <\/em><em>y<\/em><em>}<\/em> <em>| <\/em><em>x, y <\/em><em>\u2208 <\/em><em>V <\/em><em>}<\/em>, a clique is a set <em>C <\/em><em>\u2286 <\/em><em>V <\/em>such that for all <em>x <\/em><em>\u2208 <\/em><em>C <\/em>and <em>y <\/em><em>\u2208 <\/em><em>C<\/em><em>\u00a0<\/em>, if <em>x <\/em>= <em>y<\/em>, then <em>{<\/em><em>x, <\/em><em>y<\/em><em>}<\/em><em>\u00a0<\/em><em>\u2208 <\/em><em>E<\/em>. A <em>k-clique <\/em>is a clique of size <em>k<\/em>, that is, <em>|<\/em><em>C<\/em><em>\u00a0<\/em><em>| <\/em>= <em>k<\/em>.<\/p>\n<p>(a) Write an ASP program that decides the <em>k<\/em>-Clique problem:<\/p>\n<p>Input: \u00a0A graph with vertices <em>V <\/em>and edges <em>E <\/em><em>\u2286 <\/em><em>V <\/em><em>\u00d7 <\/em><em>V <\/em>, and a natural number <em>k <\/em><em>\u2265 <\/em>0.<\/p>\n<p>Problem: decide if there is a <em>k<\/em>-clique.<\/p>\n<p>Assume the input parameters \u00a0<em>V <\/em>, <em>E<\/em>, <em>k <\/em>are encoded in ASP in the form of a unary predicate v, a binary predicate e, and a constant symbol k, respectively. Use a unary predicate c to represent the vertex cover <em>C <\/em>. Your program should have no more than two rules.<\/p>\n<p>(b) \u00a0Use an ASP solver1 to determine how many <em>k<\/em>-cliques the graph has for <em>k <\/em><em>\u2208 <\/em><em>{<\/em>3<em>,<\/em><em>\u00a0<\/em>4<em>, <\/em>5<em>, <\/em>6<em>}<\/em>.\u00a0 Hint: \u00a0the number of 2-cliques is 11.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/casestudyhelp.com\/sample-questions\/wp-content\/uploads\/2017\/10\/programing.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1769\" src=\"https:\/\/casestudyhelp.com\/sample-questions\/wp-content\/uploads\/2017\/10\/programing.png\" alt=\"programing\" width=\"296\" height=\"177\" \/><\/a><\/p>\n<ol start=\"2\">\n<li><strong>[20 Marks] <\/strong>(Answer Set Programming) Consider the following logic program <em>P <\/em>.<\/li>\n<\/ol>\n<p><em>a <\/em>:- not <em>b, <\/em>not <em>c. <\/em><\/p>\n<p><em>b <\/em>:- not <em>a, <\/em>not <em>c. <\/em><\/p>\n<p><em>c <\/em>:- not <em>a, <\/em>not <em>b. <\/em><\/p>\n<p><em>d <\/em>:- <em>a.<\/em><\/p>\n<p><em>d <\/em>:- <em>b. <\/em><em>d <\/em>:- <em>c.<\/em><\/p>\n<p>Determine stable models of this program. For every candidate interpretation <em>S<\/em>, specify the reduct\u00a0<em>P<\/em><em>\u00a0<\/em><em>S<\/em><em>\u00a0<\/em>. Give your solution in a table of exactly (!) the following form and order:<\/p>\n<p>&#8212;&#8212;&#8212;<\/p>\n<p>&nbsp;<\/p>\n<p>1\u00a0For instance, you can download the Clingo ASP solver from https:\/\/potassco.org\/ and run your program with\u00a0 clingo &#8211;const k=<em>k \u00a0<\/em>-n \u00a00 clique.lp or .\/clingo \u00a0&#8211;const k=<em>k \u00a0<\/em>-n \u00a00 clique.lp where <em>k <\/em><em>\u2208 <\/em>N is the size of the clique.<\/p>\n<p>&nbsp;<\/p>\n<table width=\"354\">\n<tbody>\n<tr>\n<td width=\"141\">Candidate S<\/td>\n<td width=\"113\">Reduct P S<\/td>\n<td width=\"100\">Stable model?<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\" width=\"141\">{a, b, c, d}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"113\">d :- a.\u00a0\u00a0\u00a0 d :- b.\u00a0\u00a0\u00a0 d :- c.<\/td>\n<td width=\"100\">\u2717<\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{a, b, c}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{a, b, d}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{a, c, d}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{b, c, d}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{a, b}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{a, c}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{a, d}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{b, c}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{b, d}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{c, d}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{a}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{b}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{c}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{d}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<tr>\n<td width=\"141\">{}<\/td>\n<td width=\"113\"><\/td>\n<td width=\"100\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol start=\"3\">\n<li><strong><br \/>\n[20 Marks] <\/strong>(Reasoning about Knowledge) Suppose all you know is the KB<\/li>\n<\/ol>\n<p><em>\u2200<\/em><em>\u00a0<\/em><em>x <\/em>(<em>P<\/em><em>\u00a0<\/em>(<em>x<\/em>) <em>\u2194 <\/em><em>x <\/em>= #\u00a01 <em>\u2228 <\/em><em>x <\/em>= #\u00a02) <em>\u2227 <\/em><em>\u2200<\/em><em>\u00a0<\/em><em>x <\/em>(<em>P<\/em><em>\u00a0<\/em>(<em>x<\/em>) <em>\u2194 \u00ac<\/em><em>Q<\/em>(<em>x<\/em>))<\/p>\n<p>(a) Determine the set of known instances of <em>P <\/em>(<em>x<\/em>) <em>\u2227 \u00a0<\/em><em>Q<\/em>(<em>y<\/em>), \u00a0that \u00a0is, all pairs of standard names<\/p>\n<p>(<em>n<\/em>1 <em>, <\/em><em>n<\/em>2 ) <em>\u2208 <\/em><em>{<\/em>#\u00a01<em>, <\/em>#\u00a02<em>, <\/em>#\u00a03<em>, . . <\/em><em>.<\/em><em>}<\/em><em>\u00a0<\/em><em>\u00d7 <\/em><em>{<\/em>#\u00a01<em>, <\/em>#\u00a02<em>, <\/em>#\u00a03<em>, . . <\/em><em>.<\/em><em>}<\/em><em>\u00a0\u00a0<\/em>such that <strong>O<\/strong>KB <em>|<\/em>=\u00a0<strong>K <\/strong>(<em>P<\/em><em>\u00a0<\/em>(<em>n<\/em>1 ) <em>\u2227 <\/em><em>Q<\/em>(<em>n<\/em>2 )).<\/p>\n<p>(b) \u00a0Determine RES[KB<em>, <\/em>(<em>P <\/em>(<em>x<\/em>) <em>\u2227 <\/em><em>\u00ac<\/em><em>Q<\/em>(<em>y<\/em>))].<\/p>\n<p>You may simplify the resulting formula to eliminate true and false.<\/p>\n<ol start=\"4\">\n<li><strong>[20 Marks] <\/strong>(Limited Belief ) Consider the knowledge base<\/li>\n<\/ol>\n<p>(<em>F <\/em><em>\u2192 <\/em><em>C<\/em><em>\u00a0<\/em>) <em>\u2227 <\/em>(<em>C <\/em><em>\u2194 \u00ac<\/em><em>U<\/em><em>\u00a0<\/em>).<\/p>\n<p>(a) Bring this knowledge \u00a0base into proper+\u00a0\u00a0form.<\/p>\n<p>Let KB denote the resulting proper+\u00a0\u00a0knowledge base.<\/p>\n<p>(b) \u00a0Determine the minimal <em>k <\/em><em>\u2265 <\/em>0 such that <strong>O<\/strong>KB <em>|<\/em><em>\u2248 <\/em><strong>K<\/strong><em>k <\/em>(<em>F <\/em><em>\u2228 <\/em><em>U <\/em><em>\u2228 <\/em><em>C<\/em> ) hold? (c) Determine the minimal <em>k <\/em><em>\u2265 <\/em>0 such that <strong>O<\/strong>KB <em>|<\/em><em>\u2248 \u00ac<\/em><strong>K<\/strong><em>k <\/em><em>\u00ac<\/em>(<em>\u00ac<\/em><em>F <\/em><em>\u2227 <\/em><em>\u00ac<\/em><em>U<\/em> ) hold?<\/p>\n<p><strong>[20 Marks] \u00a0<\/strong>(Reasoning about Action)<\/p>\n<p>Suppose we have a domestic service robot cleaning up our house. It has a box, and into that box it can put objects. The robot can also shake the box to test whether something is in it. \u00a0Finally it can move the box and its contents to other locations. We assume that in reality, the box does contain some object, but the robot does not know that. \u00a0This scenario is modelled by the following basic action theory:<\/p>\n<p>\u03a30 \u00a0= <em>{\u2203<\/em><em>\u00a0<\/em><em>x <\/em>InBox(<em>x<\/em>)<em>}<\/em><\/p>\n<p>\u03a3dyn = <em>{<\/em>DPoss(<em>a<\/em>)\u00a0<em>\u2194 <\/em>true<\/p>\n<p>DSF(<em>a<\/em>) <em>\u2194 <\/em>(<em>a <\/em>= shakeBox <em>\u2192 \u2203 <\/em><em>x <\/em>InBox(<em>x<\/em>))<\/p>\n<p>D[<em>a<\/em>]InBox(<em>x<\/em>) <em>\u2194 <\/em><em>a <\/em>= putInBox(<em>x<\/em>) <em>\u2228 <\/em>InBox(<em>x<\/em>)<\/p>\n<p>D[<em>a<\/em>]location(<em>x<\/em>) = <em>y <\/em><em>\u2194 <\/em>(<em>a <\/em>= moveBox(<em>y<\/em>) <em>\u2227 <\/em>InBox(<em>x<\/em>)) <em>\u2228 <\/em>(<em>\u2200<\/em><em>\u00a0<\/em><em>y<\/em><em>l<\/em><em>\u00a0<\/em><em>a <\/em>= moveBox(<em>y<\/em><em>l<\/em><em>\u00a0<\/em>) <em>\u2227 <\/em>location(<em>x<\/em>) = <em>y<\/em>)<em>}<\/em><\/p>\n<p>Prove or disprove the following projection problems using regression: (a) \u03a30 <em>\u2227 <\/em>\u03a3dyn <em>|<\/em>= <em>\u2200<\/em> <em>x <\/em>[putInBox(<em>x<\/em>)]InBox(<em>x<\/em>)<\/p>\n<p>(b) \u00a0\u03a30 <em>\u2227 <\/em>\u03a3dyn <em>|<\/em>=\u00a0<em>\u2200<\/em><em>\u00a0<\/em><em>y<\/em><em>\u00a0<\/em>[moveBox(<em>y<\/em>)]<em>\u2200<\/em><em>\u00a0<\/em><em>x <\/em>(InBox(<em>x<\/em>) \u00a0<em>\u2192 <\/em>location(<em>x<\/em>) = <em>y<\/em>)<\/p>\n<p>(c) \u03a30 <em>\u2227 <\/em>\u03a3dyn <em>\u2227 <\/em><strong>O<\/strong>\u03a3dyn <em>|<\/em>=\u00a0[shakeBox]<strong>K <\/strong><em>\u2203<\/em><em>\u00a0<\/em><em>x <\/em>InBox(<em>x<\/em>)<\/p>\n<p>(d) \u00a0\u03a30 <em>\u2227 <\/em>\u03a3dyn <em>\u2227 <\/em><strong>O<\/strong>\u03a3dyn <em>|<\/em>=\u00a0[shakeBox]<em>\u2203<\/em><em>\u00a0<\/em><em>x <\/em><strong>K <\/strong>InBox(<em>x<\/em>)<\/p>\n<p>&nbsp;<\/p>\n<p>You may abbreviate putInBox by <em>p<\/em>, moveBox by <em>m<\/em>, shakeBox by <em>s<\/em>, InBox by <em>I <\/em>, and location by <em>\u00a3<\/em><\/p>\n<p>for better readability.<\/p>\n<script type=\"text\/javascript\" charset=\"utf-8\" src=\"http:\/\/w.sharethis.com\/widget\/?wp=6.2.9\"><\/script>","protected":false},"excerpt":{"rendered":"<p>Due: 14:59:59pm 04 October (Week 10) Late penalty: 10 marks per day Worth: 15 % &nbsp; This assignment consists of five questions. 1-[20 Marks] (Answer Set Programming) A clique of a graph is a set of vertices C that are all adjacent to each other. That is, for a graph with vertices V and undirected [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[751],"tags":[753,752],"_links":{"self":[{"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/posts\/1766"}],"collection":[{"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/comments?post=1766"}],"version-history":[{"count":4,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/posts\/1766\/revisions"}],"predecessor-version":[{"id":2031,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/posts\/1766\/revisions\/2031"}],"wp:attachment":[{"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/media?parent=1766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/categories?post=1766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/tags?post=1766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}