{"id":472,"date":"2024-02-18T09:45:06","date_gmt":"2024-02-18T14:45:06","guid":{"rendered":"https:\/\/www.notexponential.com\/notes\/?page_id=472"},"modified":"2024-02-18T09:45:34","modified_gmt":"2024-02-18T14:45:34","slug":"project-2-csp-graph-coloring","status":"publish","type":"page","link":"https:\/\/www.notexponential.com\/notes\/artificial-intelligence\/projects\/project-2-constraint-satisfaction-problems-csp\/project-2-csp-graph-coloring\/","title":{"rendered":"Project 2 &#8211; CSP &#8211; Graph Coloring"},"content":{"rendered":"\n<p>You are given a graph in the form of a text file, that you are supposed to color.\u00a0 The proper vertex coloring is such that each vertex is assigned a color and no two adjacent vertices are assigned the same color.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a><\/a><a>Input Format<\/a><\/h2>\n\n\n\n<p># Everything that starts with # is a comment<\/p>\n\n\n\n<p># First non comment line is of form Colors = n<\/p>\n\n\n\n<p>Colors = 3<\/p>\n\n\n\n<p># Here comes the graph<\/p>\n\n\n\n<p>1,3<\/p>\n\n\n\n<p>2,18<\/p>\n\n\n\n<p>3,19<\/p>\n\n\n\n<p>2,19<\/p>\n\n\n\n<p># The \u201cgraph\u201d presented above has 5 vertices: \u201c1\u201d, \u201c2\u201d, \u201c3\u201d, \u201c18\u201d and \u201c19\u201d, and 4 edges.<\/p>\n\n\n\n<p># Only the edges are provided in terms of first vertex and second vertex<\/p>\n\n\n\n<p># Edges are undirected: 1 is adjacent to 3, and 3 is adjacent to 1.<\/p>\n\n\n\n<p># In some graphs, the edge may be included twice (1,3) as well as (3,1) \u2013 just ignore the second one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example Inputs<\/h2>\n\n\n\n<p>Some example problems can be found at:<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/amrinderarora\/ai\/tree\/master\/src\/main\/resources\/csp\/coloring\">https:\/\/github.com\/amrinderarora\/ai\/tree\/master\/src\/main\/resources\/csp\/coloring<\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Algorithm<\/h1>\n\n\n\n<p>Write a CSP algorithm to solve this problem.&nbsp; The CSP algorithm should have the following components:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Search algorithm to solve the CSP<\/li>\n\n\n\n<li>Heuristics (min remaining values, least constraining value, tie breaking rules)<\/li>\n\n\n\n<li>Constraint propagation using AC3.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>You are given a graph in the form of a text file, that you are supposed to color.\u00a0 The proper vertex coloring is such that each vertex is assigned a color and no two adjacent vertices are assigned the same color. Input Format # Everything that starts with # is a comment # First non [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":469,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-472","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/pages\/472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/comments?post=472"}],"version-history":[{"count":1,"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/pages\/472\/revisions"}],"predecessor-version":[{"id":474,"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/pages\/472\/revisions\/474"}],"up":[{"embeddable":true,"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/pages\/469"}],"wp:attachment":[{"href":"https:\/\/www.notexponential.com\/notes\/wp-json\/wp\/v2\/media?parent=472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}