diff --git a/Submissions/002839203_Anuraag_Bathula/002839203_Anuraag_Bathula_Assignment-4.ipynb b/Submissions/002839203_Anuraag_Bathula/002839203_Anuraag_Bathula_Assignment-4.ipynb new file mode 100644 index 0000000..a8ade14 --- /dev/null +++ b/Submissions/002839203_Anuraag_Bathula/002839203_Anuraag_Bathula_Assignment-4.ipynb @@ -0,0 +1,527 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Assignment 4" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " Q1 \n", + " A library has just been constructed and its shelves need to be filled with books in time for the opening date 5 days later. There are many teams all ready to work on unboxing the books from cartons and arranging them on library shelves, but only one carton can be unpacked to a shelf in a day, as the process is prone to mixups when multiple cartons are open at the same time. There are n cartons in total, each with its own allocated shelf where all its books are to be unpacked and arranged. Is it possible to complete the preparation of the library by unpacking and arranging all books to their respective shelves in time for the opening day? What complexity class does this problem belong to? \n", + "\n", + "Solution: \n", + "To prove that this problem is NP complete, we must prove both of the following- \n", + "1) The problem is in NP\n", + "2) the problem is NP-Hard\n", + "\n", + "To prove that the problem is in NP, we need to come up with a polynomial time verifier for this problem. \n", + "\n", + "Given a solution to the problem, we need verify that the carton unpacking schedule is completeable in 5 days and that none of the shelves are filled by multiple cartons in the same day \n", + "let solution take the form- \n", + "[[ci,cj...cn] \n", + "[ca,cb...cd] \n", + "[ce,cf...ch] \n", + "[co,cp...cr] \n", + "[cx,cy...cz]] \n", + "where each row represents the cartons to be unpacked on that day and \n", + "{c1:s1,c2:s1,c3:s3....ci:sj} \n", + "which indicates the shelves the cartons need to be unpacked to. \n", + "\n", + "Below is the pseudocode for a polynomial time verifier- \n", + "\n", + "```python\n", + "arr = 2 dimensional array containing schedule arranged by days as shown above\n", + "map = mapping of each carton to its shelf as shown above\n", + "#checking to see if the total time period of schedule is more than 5 days\n", + "if len(arr) > 5:\n", + " return false\n", + "#checking to see if every carton has been accounted for in schedule\n", + "x = {}\n", + "for i in arr:\n", + " for j in arr[i]:\n", + " x.add(arr[i][j])\n", + "if set != map.keys():\n", + " return false\n", + "#checking to see if any shelves have multiple cartons being unpacked to them on the same day\n", + "for i in arr:\n", + " for j in arr[i]:\n", + " target_shelf = map.get(arr[i][j])\n", + " for k in arr[i]:\n", + " if k != j:\n", + " if map.get(arr[i][k] == target_shelf):\n", + " return false\n", + "return true\n", + "```\n", + "\n", + "This verifier takes polynomial time to check if carton unpacking schedule is completeable in 5 days and that none of the shelves are filled by multiple cartons in the same day \n", + "Since there exists a polynomial time verifier, this problem is in NP \n", + "\n", + "To prove the problem is NP-Hard, we need to identify an existing NP-complete problem and reduce the given library scheduling problem to the chosen problem in polynomial time \n", + "chosen existing NP-complete problem <=p given library scheduling \n", + "\n", + "Selection: \n", + "This problem is a scheduling conflict type problem so we can use coloring problem as a reduction target. We can select the 5-coloring problem as a reduction target because there are maximum 5 days in the schedule and shelf conflicts can be modeled as adjacent nodes in the graph, in a 5-coloring problem. If we are able to color this constructed graph in 5 colors then this schedule is valid in 5 days. Hence we choose the 5 coloring problem as the existing NP complete problem for reduction \n", + "\n", + "n-coloring problem states- given a graph, can it be colored by a maximum of n colors? Here, coloring means that no two vertices sharing the same edge can have the same color.\n", + "\n", + "Reduction: \n", + "Given an instance of the library scheduling problem, we can construct an instance of the 5 coloring problem. \n", + "Graph construction: \n", + "We add n nodes in the graph, each representing a carton that needs to be unpacked \n", + "We go through each carton and add an edge between that carton and every other carton that is to be unpacked to the same shelf. ie, each carton destined for a shelf has edges to every other carton destined for that same shelf \n", + "we now have an instance of the 5 coloring problem that, if solved, will give us the answer to whether each carton can be allocated to its shelf in the library in time for its opening day 5 days from now\n", + "\n", + "A coloring problem makes sure that no vertices which are sharing edges are colored the same, and we use this property to make sure no cartons which are destined to the same shelves are unpacked on the same day \n", + "Here different colors represent the different days that the carton can be unpacked. Since we have a maximum of 5 days to finish unpacking every carton, a graph with a maximum of 5 colors is suitable \n", + "\n", + "This reduction takes polynomial time \n", + "\n", + "As we proved both 1) and 2), we can state the library scheduling problem is NP-complete" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " Q2 \n", + " You are a botanist managing an arboretum and you find out that the trees that have been planted in the arboretum growing very slowly as they are too cramped. You want to figure out the most efficient way to get rid of x trees such that every other tree in the arboretum gets extra space to grow better. What complexity class does this problem belong to?\n", + "\n", + "Solution: \n", + "\n", + "Definition: Given a graph G = (V, E), a set of vertices D which is a subset of V is a dominating set if every vertex v is either in D or adjacent to atleast one member of D. In a Dominating Set problem, the aim is to find a dominating set of size of at most d. \n", + "\n", + "We can model the forest of n trees as a graph with edges between each pair of two trees that are adjacent to each other. To proceed further with this modeling, the d trees which need to be cleared so that the rest of the forest finds space to grow, is similar to that of a dominating set, in which every vertex is adjacent to a vertex in set of the dominating set, or is a part of the dominating set \n", + "Hence, Arboretum Clearing =p Dominating Set \n", + "\n", + "Since, Arboretum Clearing and Dominating Set can be said to be equivalent to each other, proving Dominating-Set as NP-Complete would also prove Arboretum Clearing to be NP-Complete \n", + "\n", + "To prove that this problem is NP complete, we must prove both of the following- \n", + "1) The problem is in NP\n", + "2) the problem is NP-Hard\n", + "\n", + "To prove that the problem is in NP, we need to come up with a polynomial time verifier for this problem. \n", + "\n", + "Say the given solution to this problem is X which is a set of nodes which is adjacent to every other node in the set S \n", + "Below is the pseudocode for a polynomial time verifier- \n", + "\n", + "```python\n", + "let S = set of all nodes\n", + "let X = given dominating set\n", + "let Z = empty set {}\n", + "for v in X:\n", + " Z.add(v)\n", + " for neighbor of v:\n", + " Z.add(neighbor)\n", + "if Z == S:\n", + " return true\n", + "else:\n", + " return false\n", + "```\n", + "\n", + "This verifier takes polynomial time to check if the given solution X is indeed the dominating set of S \n", + "Since there exists a polynomial time verifier, this problem is in NP \n", + "\n", + "To prove the problem is NP-Hard, we need to identify an existing NP-complete problem and reduce the given Dominating-set problem to the chosen problem in polynomial time \n", + "\n", + "Selection: \n", + "This problem is a graph edge optimization type problem so we can use vertex cover problem as a reduction target. \n", + "\n", + "Vertex cover problem states- given a graph, is there a set of vertices of at most size d that includes atleast one endpoint of each edge of the graph \n", + "\n", + "Reduction: \n", + "Given an instance of the vertex cover problem, we can construct an instance of dominating set problem. \n", + "\n", + "Graph construction: \n", + "Given an instance of vertex cover, with graph G = (V, E) and parameter d, construct a new graph G' \n", + "Add all vertices and edges of G to G’ \n", + "For each edge e = (u, v) in E, add a node we to V, and add edges (u, we) and (v, we) to E’\n", + "\n", + "To prove that there is a vertex cover of size d in G if and only if there is a dominating set of size d in G, we will do the following \n", + "Consider any node v in V. We must show that either v is in S or there is some adjacent node which is\n", + "in S. There are two possibilities \n", + "Possibility a-> v is an original node from V. As there are no isolated vertices in G, there is some edge (u, v) in E \n", + "Since S is a feasible vertex cover, one of u and v must be in S. Thus, either v is a part of S, or an adjacent node is in S \n", + "Possibility b-> v = we is a new node added to V, where e is in E. By the previous argument, if e = (i, j), then either i is in S or j is in S. But edges (i, we) and (j, we) are both in E, so we is adjacent to some node in S \n", + "Hence, S is a dominating set in G of size d \n", + "\n", + "Assume we have a dominating set S in G of size d \n", + "If there are any nodes we in S, with e = (u, v), we can replace we by either u or v, and we will still have a dominating set \n", + "If u and v are both in S, then we we can be replaced by any vertex to maintain the set of size d, so, set S consists only of vertices in V \n", + "\n", + "To prove that this set S is a vertex cover for G, we do the follwing- \n", + "Consider any edge e = (u, v) in E \n", + "Since S is a dominating set in G, either we is in S, or some node adjacent to we is in S \n", + "But we constructed S from vertices in V, so some node adjacent to we must be in S \n", + "But u and v are the only nodes adjacent to we in G, so one of them must be in S \n", + "Thus, every edge e in E is adjacent to some node in S, so it is a feasible vertex cover \n", + "\n", + "This reduction takes polynomial time \n", + "\n", + "As we proved both 1) and 2), we can state the Dominating Set problem is NP-complete\n", + "As Arboretum Clearing =p Dominating Set, it is also proven that Arboretum Clearing is also NP-Complete" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " Q3 \n", + " In a certain country, a set of internet service providers (ISPs) provide internet services for the cities. However, it is not necessary that each ISP provides services for each city. A foreign investor who wants to expand into the country's market wants to buy up a few ISPs in such a way that they don't serve any cities in common, to make the most cost efficient investment possible. Given a set of cities and ISPs that serve those cities, is there a subset of atleast k ISPs that do not serve any common cities between each other? What complexity class does this problem belong to?\n", + " \n", + " |City/ISP| ISP A | ISP B | ISP C| \n", + " |--------|--------|--------|-------|\n", + " |City A | yes| yes| no|\n", + " |City B | no| yes| no|\n", + " |City C | yes| no| yes|\n", + "\n", + "Solution: \n", + "This problem is NP-Complete\n", + "To prove that this problem is NP complete, we must prove both of the following- \n", + "1) The problem is in NP\n", + "2) the problem is NP-Hard\n", + "\n", + "To prove that the problem is in NP, we need to come up with a polynomial time verifier for this problem. \n", + "Given a solution to the optimal ISP investment problem, we need verify that the given set of ISPs have no cities in common. \n", + "Assume that the input is given in the form of a 2D array where arr[i][j] is a boolean value depicting whether the city is served by the ISP, and a set S of ISPs is provided which the investor should buy \n", + "Below is the pseudocode for a polynomial time verifier- \n", + "```python\n", + "\n", + "for i in arr:\n", + " count = 0\n", + " for j in arr[i]:\n", + " if S.get(j):\n", + " if arr[i][j] == yes:\n", + " count = count + 1\n", + " if count > 1:\n", + " return false\n", + "return true\n", + "```\n", + "\n", + "This verifier takes polynomial time to check if a certain partition is a valid optimal ISP investment \n", + "Since there exists a polynomial time verifier, this problem is in NP\n", + "\n", + "To prove the problem is NP-Hard, we need to identify an existing NP-complete problem and reduce the optimal ISP investment problem to the chosen problem in polynomial time \n", + "chosen existing NP-complete problem <=p optimal ISP investment problem \n", + "\n", + "Selection: \n", + "This problem is a exclusivity optimization type problem, similar to that of independent set problem. Hence we choose the independent set problem as the existing NP complete problem for reduction \n", + "\n", + "Independent set problem states that, given a set of nodes in a graph, can you tell whether or not a subset of nodes exists in the graph of size k that does not share edges among its members \n", + "\n", + "Reduction: \n", + "Given an instance of the optimal ISP investment problem , we can construct an instance of the Independent set Problem. \n", + "Graph construction: \n", + "Given the set of ISPs and cities, we create a graph with nodes representing the ISPs. \n", + "We draw edges from different nodes if they have a city that they both serve. \n", + "Finally we ask if this graph has a independent set of nodes of size k\n", + "\n", + "We claim that this holds if and only if arr has an non clashing subset of ISPs of size k. If there is a optimal investment, of size k, then the corresponding set of nodes has the property that no two are incident to the same edge so it is an independent set of size k \n", + "\n", + "If there is an independent set of size k, then the corresponding set of ISPs has the property that no two serve the same city, so it is an optimal investment. \n", + "This is a reduction to the independent set problem which is known to be NP complete, and the reduction takes polynomial time\n", + "\n", + "Example: \n", + "Let arr be the table shown in the question\n", + "ISPs B and C do not serve any cities in common\n", + "Reduction -> Building a graph-\n", + "```\n", + " ISP A \n", + " / \\ \n", + " ISP B ISP C \n", + "``` \n", + "this reduction takes polynomial time \n", + "We can see from this example that the independent set of size 2 contains ISP B and ISP C \n", + "Hence, reduction is accurate and it solves the problem of optimal ISP investment \n", + "\n", + "As we proved both 1) and 2), we can state the optimal ISP investment problem is NP-complete\n" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n" + ] + } + ], + "source": [ + "#Verifier to check if given optimal ISP investment is correct\n", + "\n", + "arr = [[True,True,False],[False,True,False],[True,False,True]]\n", + "# |City/ISP| ISP A | ISP B | ISP C| \n", + "# |--------|--------|--------|-------|\n", + "# |City A | yes| yes| no|\n", + "# |City B | no| yes| no|\n", + "# |City C | yes| no| yes|\n", + "\n", + "#proposed solution in index form\n", + "S = {1,2}\n", + "k = 2\n", + "\n", + "for i in range(len(arr)):\n", + " count = 0\n", + " for j in range(len(arr[i])):\n", + " if j in S:\n", + " if arr[i][j] == True:\n", + " count = count + 1\n", + " if count > 1:\n", + " print(False)\n", + "if k <= len(S):\n", + " print(True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " Q4 \n", + " There is a wildlife sanctuary that consists of a set of water holes surrounded by an impenetrable forest of trees, and the water holes are connected to each other by paths through the sanctuary. The park ranger in charge wants to set up cameras at the water holes to keep track of the animals traveling along the paths between the water holes. Can you provide an algorithm that can select the set of water holes to set up cameras at so as to be able to track every single path in the wildlife sanctuary? What complexity class does this problem belong to? \n", + "\n", + "Solution: \n", + "To prove that this problem is NP complete, we must prove both of the following- \n", + "1) The problem is in NP\n", + "2) the problem is NP-Hard\n", + "\n", + "To prove that the problem is in NP, we need to come up with a polynomial time verifier for this problem. \n", + "Given a solution to the optimal wildlife tracking problem, we need verify that if we setup cameras at every waterhole in the set of waterholes provided, we can keep track of every single path in the sanctuary. \n", + "Let us assume the solution is given in the following format- \n", + "2D adjacency matrix (adj) that contains all the paths between waterholes as a boolean true/false value, ie, adj[i][j] = true or adj[j][i] = true means that there is a path between i and j \n", + "we are also given an array of indices (arr) representing water holes containing the solution to the optimal wildlife tracking problems \n", + "Below is the pseudocode for a polynomial time verifier- \n", + "```python\n", + "for x in arr:\n", + " for i in adj[x]:\n", + " adj[x][i] = 0\n", + " adj[i][x] = 0\n", + "for i in adj:\n", + " for j in adj[i]:\n", + " if adj[i][j] != 0:\n", + " return false\n", + "return true\n", + "```\n", + "\n", + "This verifier takes polynomial time to check if a certain partition is a valid optimal wildlife tracking \n", + "Since there exists a polynomial time verifier, this problem is in NP\n", + "\n", + "To prove the problem is NP-Hard, we need to identify an existing NP-complete problem and reduce the optimal wildlife tracking problem to the chosen problem in polynomial time \n", + "chosen existing NP-complete problem <=p optimal wildlife tracking problem \n", + "\n", + "Selection: \n", + "This problem is similar to the vertex cover problem as both of them seek to optimize the number of nodes which together are connected to every vertex in a graph. Hence we choose the vertex cover problem as the existing NP complete problem for reduction \n", + "\n", + "The vertex cover problem states- given a graph, is there a set of vertices of at most size d that includes atleast one endpoint of each edge of the graph \n", + "\n", + "Reduction: \n", + "Given an instance of the optimal wildlife tracking problem with a representation of water holes and paths in a wildlife sanctuary, we can construct a vertex cover problem as shown below \n", + "Graph construction: \n", + "Given the input of the optimal wildlife tracking problem, create a graph based on the instructions below \n", + "Create nodes in the graph G for every water hole in the original problem \n", + "If there was a path between two water holes, add an edge between the two nodes representing those water holes \n", + "We have transformed the wildlife sanctuary with paths and water holes into a graph problem, where we need to choose the smallest set of nodes, such that each edge in the graph is covered \n", + "This is now a vertex cover problem, as choosing the smallest set of vertices that include atleast one endpoint of every edge in the graph, is nothing but a vertex cover problem. \n", + "we now have an instance of the vertex cover problem that, if solved, will give us the smallest set of water holes to setup cameras at, so as to keep track of every path in the wildlife sanctuary \n", + "\n", + "As we proved both 1) and 2), we can state the optimal wildlife tracking problem is NP-complete\n" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n", + "True\n" + ] + } + ], + "source": [ + "#verifier to see if given solution is an optimal wildlife tracking problem\n", + "\n", + "adj = [[False,True,False,False],[True,False,True,False],[False,True,False,True],[False,True,True,False]]\n", + "\n", + "# A-------B\n", + "# |\n", + "# |\n", + "# D-------C\n", + "\n", + "#proposed solution to verify (in indices form)-\n", + "arr = [0,3]\n", + "\n", + "def func(adj,arr):\n", + " for x in arr:\n", + " for i in range(len(adj[x])):\n", + " adj[x][i] = False\n", + " adj[i][x] = False\n", + " for i in range(len(adj)):\n", + " for j in range(len(adj[i])):\n", + " if adj[i][j] != False:\n", + " return(False)\n", + " return(True)\n", + "\n", + "print(func(adj,arr))\n", + "\n", + "#proposed solution to verify (in indices form)-\n", + "arr2 = [1,2]\n", + "print(func(adj,arr2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " Q5 \n", + " The Even Set Partition Problem states: \n", + " Given a set of positive integers, is it possible to partition the set into two subsets such that sum of the elements in each subset is equal? \n", + " Prove that this problem is NP-Complete \n", + "\n", + "Solution: \n", + "To prove that this problem is NP complete, we must prove both of the following- \n", + "1) The problem is in NP\n", + "2) the problem is NP-Hard\n", + "\n", + "To prove that the problem is in NP, we need to come up with a polynomial time verifier for this problem. \n", + "Given a solution to the even set partition problem, we need verify that the original set was partionable into two even sets by checking if the sums of each of the given sets are equal to half of the total sum of the original set. \n", + "Below is the pseudocode for a polynomial time verifier- \n", + "```python\n", + "let original set S = {x1,x2...xi}\n", + "total_sum = 0\n", + "for xi in set S:\n", + " total_sum += xi\n", + "let set A = {y1,y2...yj} be a subset of set S\n", + "let set B = {z1,z2...zk} be the other subset of set S\n", + "to verify that the above are both valid subsets-\n", + "let set X = {}\n", + "add all elements of set A into X\n", + "add all elements of set B into X\n", + "if set X != set S:\n", + " return false as this is not a valid even partition\n", + "A_sum = 0\n", + "for yj in set A:\n", + " A_sum += yj\n", + "if A_sum != total_sum/2:\n", + " return false\n", + "B_sum = 0\n", + "for zk in set B:\n", + " B_sum += zk\n", + "if B_sum != total_sum/2:\n", + " return false\n", + "return true\n", + "```\n", + "\n", + "This verifier takes polynomial time to check if a certain partition is a valid even set partition \n", + "Since there exists a polynomial time verifier, this problem is in NP\n", + "\n", + "To prove the problem is NP-Hard, we need to identify an existing NP-complete problem and reduce the even set partition problem to the chosen problem in polynomial time \n", + "chosen existing NP-complete problem <=p even set partition problem \n", + "\n", + "Selection: \n", + "This problem is similar to the subset sum problem as both of them perform mathematical sum operations on a set of numbers. Hence we choose the subset sum problem as the existing NP complete problem for reduction \n", + "\n", + "Subset sum problem states that, given a set of integers, can you tell whether or not a subset from the list of integers can sum to a target value?\n", + "\n", + "Reduction: \n", + "Given an instance of the even set partition problem with a set of positive integers {x1,x2...xn}, we can construct an instance of the Subset Sum Problem. \n", + "Set construction: \n", + "let set S be the input of the even set partition problem \n", + "let sum be the sum of all elements in the set S \n", + "let the target for the subset sum problem be sum/2 \n", + "we now have an instance of the subset sum problem that, if solved, will give us the answer to whether the set S has two sets which partition it evenly \n", + "\n", + "S can be partitioned into two subsets with equal sums if and only if there exists a subset of \n", + "S with a sum equal to sum/2 \n", + "If there exists a subset of S with a sum of (total sum of set)/2, then the remaining elements will have the sum of (total sum of set - sum of subset), which is equivalent to (total sum of set/2) \n", + "hence both the subsets are equal in value, hence the set can be divided into two evenly partitioned subsets each with the same sum \n", + "Example: \n", + "Let S = {1,2,3,4}\n", + "the sum of all elements in this set is 1+2+3+4 = 10 \n", + "Reduction -> Is there a subset of S with the sum 10/2 = 5? \n", + "this reduction takes polynomial time \n", + "We can see from this example that the subset is {1,4} or {2,3} \n", + "Hence, the remaining elements in this set are either {2,3} or {1,4}, both of which are equal partitions of the original set S \n", + "\n", + "As we proved both 1) and 2), we can state the even set partition problem is NP-complete\n" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total sum of set S1=[1,2,3,4] is 10\n", + "True\n" + ] + } + ], + "source": [ + "#verifier to check if provided solution is a valid even set partition\n", + "S1 = [1,2,3,4]\n", + "A1 = [1,4]\n", + "B1 = [2,3]\n", + "\n", + "#checking whether A1 and B1 together equal S1\n", + "C1 = A1 + B1\n", + "C1.sort()\n", + "D1 = S1\n", + "D1.sort()\n", + "if C1 != D1:\n", + " print(False)\n", + "\n", + "total_sum = 0\n", + "for i in S1:\n", + " total_sum += i\n", + "print(\"Total sum of set S1=[1,2,3,4] is \",total_sum)\n", + "\n", + "A_sum = 0\n", + "for i in A1:\n", + " A_sum += i\n", + "if A_sum != total_sum/2:\n", + " print(False)\n", + "B_sum = 0\n", + "for i in B1:\n", + " B_sum += i\n", + "if B_sum != total_sum/2:\n", + " print(False)\n", + "print(True)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/Submissions/002839203_Anuraag_Bathula/002839203_Anuraag_Bathula_Assignment-4.readme b/Submissions/002839203_Anuraag_Bathula/002839203_Anuraag_Bathula_Assignment-4.readme new file mode 100644 index 0000000..194e739 --- /dev/null +++ b/Submissions/002839203_Anuraag_Bathula/002839203_Anuraag_Bathula_Assignment-4.readme @@ -0,0 +1,18 @@ +Assignment-4 summary + +Contrary to my original expectations, ChatGPT was quite prone to generating nonsensical solutions to NP-Completeness type problems. +I generated about 40 different questions and solutions using various patterns of prompts but none of them resulted in a coherent question and answer combination. +Very frequently, it generated exactly the same premise as that input that I gave it, even when expressly instructed to generate a new premise. +Regenerating ChatGPT answers only resulted in the answers getting more and more out of touch and unhinged. + +However, generating just questions was not nearly as bad, and some were even quite creative. +Although most of them needed some modifications to make them less unambiguous, I took inspiration from some of the premises that it generated. +Interestingly enough, almost all of the times that it generated interesting and reasonably sensible premises were when I didn't explicitly provide a premise to begin with. + +The assignment helped me learn a lot about transformations, and I was exposed to many incredibly clever examples of seemingly unrelated problems reducing to each other. +I also learned from this assignment that knapsack type questions are not actually polynomial, but pseudopolynomial, which I wasn't aware of before. + +I also learned a lot about set and graph theory, and the various terms, I would previously need to look up to understand are much clearer now, such as cliques and covers. +Also, the complexity or hardness of a problem being more or less than another was a concept I was struggling with, but after studying the set of problems and reductions, I can see the patterns of complexity and what it means to be harder than something else. + +This also gives me perspective on the current state of the world and why technology is taking the route that it is. Deterministic unsolvability of many real world problems explains a lot about why things are the way they are with cryptography, pathfinding, etc. \ No newline at end of file