ASSIGN In this assignment you will use the given code to solve the Map Coloring, and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
ASSIGN In this assignment you will use the given code to solve the Map Coloring, and the n-Queens problems as discussed in the lectures. Please see the lecture slides and the Chapter-6 of the textbook for details on encoding and solving CSPs. To understand the assignment task and the installation of required libraries, please read the following sections carefully: 1) Overview of the CSP Solver Library For this assignment, we will be using a library called simpleai that is available at: https://github.com/simpleai-team/simpleai You can read the documentation on the CSP solver built into the library from this link: satisfaction_problems.html https://simpleai.readthedocs.io/en/latest/constraint Also, you have been given a python code file called backtracking.py that shows how to use the CSP solver of the library with a complete example. Please study the code and the example carefully to understand how to encode a problem as a CSP in this solver. You should also execute this code to make sure that all the library requirements are correctly installed on your system so that you can work on your assignment. The next section gives details on how to install and run this file at your PC. 2) Installation of simpleai Library 1. Make sure that Python is installed on your PC. For installation details for Windows, please follow the steps given in the following link: o https://www.liquidweb.com/kb/how-to-install-python-on-windows/ o If you use any Linux distro, then note that Python is installed by default on all Linux distros. For confirmation, see above link on how to verify python installation. 2. Make sure that pip is installed. For installation instructions for Windows, please see and follow steps given at: o https://www.liquidweb.com/kb/install-pip-windows/ o In Linux, you can invoke pip at the python prompt. See above link for details. 3. To install the simpleai library, open Command Prompt (Windows) or Terminal (Linux), and type: python This will start the Python prompt. At this prompt, type: pip install simpleai This will install the simpleai library and all prerequisites on your PC. 3) How to Use the simplear Library You have been given a file called backtracking.py. Study the code carefully as this code demonstrates how to call the backtracking search algorithm that uses the AC-3 algorithm for arc consistency and the MRV (Most Constrained Variable) and LCV (Least Constraining Value) heuristics to solve a given CSP problem. A simple example is already given to you that shows how to solve a three variable CSP problem. Please see the code for the details. Note carefully how variables, domain, and the constraints are defined in the problem. Also, note that constraints need to be defined as explicit constraints. In the example, three different constraints are defined that are to be applied on the three variables. To make sure that you have installed everything correctly, you should run and see the output of this code. 4) How to Write your Code Solution? As mentioned above, you will need to define explicit constraints in this library for solving your problems. Also note that to write the assignment solution, you will edit this code file and write your assignment solution. The lines of the code that you should not change are: a) The top two import statements. b) The last three lines that demonstrate how to call the backtracking search with all heuristics to solve the problem and print the CSP solution. 5) What Problems to Solve for this Assignment? You will need to solve two problems using the above code and the simpleai library: Map Coloring problem and the n-Queens problem. For a review of the formulation of these CSP problems, please see Chapter-6 and the lecture slides. a) Map Coloring Problem [15 Points] NT For the given map at the right, we need to assign a color to each variable so that no two neighboring variables have the same color. We have a total of seven variables, and the domain having {RED, GREEN, BLUE} values. WA NSW) b) n-Queens Problem [15 Points] For this problem, solve the n-Queens problem using n = 5. In this problem you would need to place a Queen in each row of a 5 x 5 table so that no two Queens attack each other. SA T ASSIGN In this assignment you will use the given code to solve the Map Coloring, and the n-Queens problems as discussed in the lectures. Please see the lecture slides and the Chapter-6 of the textbook for details on encoding and solving CSPs. To understand the assignment task and the installation of required libraries, please read the following sections carefully: 1) Overview of the CSP Solver Library For this assignment, we will be using a library called simpleai that is available at: https://github.com/simpleai-team/simpleai You can read the documentation on the CSP solver built into the library from this link: satisfaction_problems.html https://simpleai.readthedocs.io/en/latest/constraint Also, you have been given a python code file called backtracking.py that shows how to use the CSP solver of the library with a complete example. Please study the code and the example carefully to understand how to encode a problem as a CSP in this solver. You should also execute this code to make sure that all the library requirements are correctly installed on your system so that you can work on your assignment. The next section gives details on how to install and run this file at your PC. 2) Installation of simpleai Library 1. Make sure that Python is installed on your PC. For installation details for Windows, please follow the steps given in the following link: o https://www.liquidweb.com/kb/how-to-install-python-on-windows/ o If you use any Linux distro, then note that Python is installed by default on all Linux distros. For confirmation, see above link on how to verify python installation. 2. Make sure that pip is installed. For installation instructions for Windows, please see and follow steps given at: o https://www.liquidweb.com/kb/install-pip-windows/ o In Linux, you can invoke pip at the python prompt. See above link for details. 3. To install the simpleai library, open Command Prompt (Windows) or Terminal (Linux), and type: python This will start the Python prompt. At this prompt, type: pip install simpleai This will install the simpleai library and all prerequisites on your PC. 3) How to Use the simplear Library You have been given a file called backtracking.py. Study the code carefully as this code demonstrates how to call the backtracking search algorithm that uses the AC-3 algorithm for arc consistency and the MRV (Most Constrained Variable) and LCV (Least Constraining Value) heuristics to solve a given CSP problem. A simple example is already given to you that shows how to solve a three variable CSP problem. Please see the code for the details. Note carefully how variables, domain, and the constraints are defined in the problem. Also, note that constraints need to be defined as explicit constraints. In the example, three different constraints are defined that are to be applied on the three variables. To make sure that you have installed everything correctly, you should run and see the output of this code. 4) How to Write your Code Solution? As mentioned above, you will need to define explicit constraints in this library for solving your problems. Also note that to write the assignment solution, you will edit this code file and write your assignment solution. The lines of the code that you should not change are: a) The top two import statements. b) The last three lines that demonstrate how to call the backtracking search with all heuristics to solve the problem and print the CSP solution. 5) What Problems to Solve for this Assignment? You will need to solve two problems using the above code and the simpleai library: Map Coloring problem and the n-Queens problem. For a review of the formulation of these CSP problems, please see Chapter-6 and the lecture slides. a) Map Coloring Problem [15 Points] NT For the given map at the right, we need to assign a color to each variable so that no two neighboring variables have the same color. We have a total of seven variables, and the domain having {RED, GREEN, BLUE} values. WA NSW) b) n-Queens Problem [15 Points] For this problem, solve the n-Queens problem using n = 5. In this problem you would need to place a Queen in each row of a 5 x 5 table so that no two Queens attack each other. SA T
Expert Answer:
Answer rating: 100% (QA)
NT solution WA a Map colooring problem csp variables WA NT Q NS... View the full answer
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
2017 Subaru Legacy Sedan 4 cyl 4 Door Sedan with 136,300 miles. The customer complaint is that when they put their Right Directional on it has a steady clicking/blinking sound coming from their...
-
Use turtle graphics to create an interactive forest drawing application. Start by creating a module utilities.py which should contain four drawing functions as listed below. draw_triangle(centre_x,...
-
Writing and Presenting a Research Report As Brown, Suter, and Churchill (2014) indicate in the Basic Marketing Research textbook, a marketing researcher will almost always be expected to develop a...
-
Is the answer correct? The graph of a y = f(x) is shown. 6 + 5 14 m ~ 1 -6 -5 -4 -3 2 -1 -1 -2 -3 A w -4 -5- -6+ 1 2 3 4 The domain of f(x) is x = [-3,3] The domain of g(x) = notation) S 6 f(x) is a ...
-
Let x = sodium and y = sugar for the breakfast cereal data in the Cereal data file on the text CD and in Table 2.3 in Chapter 2. a. Construct a scatterplot. Do any points satisfy the two criteria for...
-
A-1 Rentals' balance sheet data at May 31, 2009, and June 30, 2009, follow. Requirements Following are three situations about investments and withdrawals by the owner of the business during June. For...
-
How can computers be used to assist in the litigation process?
-
A gas-turbine power plant operates on the simple Brayton cycle between the pressure limits of 100 and 1200 kPa. The working fluid is air, which enters the compressor at 30°C at a rate of 150...
-
Question 6 (7 points) Three people are standing on a plane (the flat surface kind). The first person is standing at the origin. The second person is standing at an elevation of 3m higher, 6m [E] and...
-
Katsura Corporation incurred pre-operating costs: Investigatory expenses of $17,000 New employee training $25,000 Advertising $10,000 Land and building for use as a retail store when opened...
-
The problem situation of this training unit will allow you to develop the sub-competencies of mathematical reasoning, investment decisions and critical thinking. The case considers an investment...
-
The membrane in Example 9.1 is replaced with another of the same thickness, but with a permeability of 300 barrer for solute A. Calculate the transmembrane flux of solute A if the film coefficients...
-
When developing a marketing strategy using new digital media, a marketer must be aware of the strengths and weaknesses of these new media. Digital media are relatively new to the field of marketing...
-
Let \(\widehat{A}\) be a double-centered distance matrix. Prove or disprove the following statements: 1. If \(B\) is the matrix obtained by double-centering \(\widehat{A}\), then \(B=\widehat{A}\)....
-
Melanie Mielke Construction Corporation is considering the appropriate accounting for two unrelated events during the year. The first event related to the effects of a labor strike that resulted in a...
-
Work safety regulations require that the side walls of ditches and trenches be supported by various devices to protect workers from collapse. Trench Coat manufactures and sells a spray on concrete...
-
Part A A loudspeaker of mass 19.0 kg is suspended a distance of h = 1.40 m below the ceiling by two cables that make equal angles with the ceiling. Each cable has a length of 1 = 3.30 m. (Figure 1)...
-
Which of the following is NOT a magnetic dipole when viewed from far away? a) A permanent bar magnet. b) Several circular loops of wire closely stacked together with the same current running in each...
-
For water, H vaporization is 40.656 kJmol 1 , and the normal boiling point is 373.12 K. Calculate the boiling point for water on the top of Mt. Everest of (elevation 8848 m), where the normal...
-
Is a whale likely to get the bends when it dives deep into the ocean and resurfaces? Answer this question by considering the likelihood of a diver getting the bends if he or she dives and resurfaces...
-
The partial molar volumes of water and ethanol in a solution with xH 2 O = 0.45 at 25C are 17.0 and 57.5 cm 3 mol 1 , respectively. Calculate the volume change upon mixing sufficient ethanol with...
-
Argue whether you agree or not that a representation letter is a critical part of an audit engagement. Consider in your argument that the letter itself can only serve as minimal evidence because it...
-
For each of the following scenarios, indicate whether earnings quality is likely to be high, moderate, or low. Based on your assessment, how might an auditor adjust the nature or extent of audit...
-
Many auditors rely on a disclosure checklist when evaluating presentation and disclosure assertions. Describe the benefits of using a checklist to help in performing this evaluation. In addition,...
Study smarter with the SolutionInn App