



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A classic logic puzzle known as the water jugs problem. The problem involves three jugs with capacities of 16 liters, 7 liters, and 5 liters, and the goal is to find a sequence of actions (filling, emptying, and transferring water between jugs) that results in exactly a target amount of water (g liters) in one of the jugs. Detailed instructions for three questions related to this problem, including finding solutions for target values of 1 and 2 liters, discussing the possibility of achieving other target values, and implementing the problem as a search problem using various uninformed search algorithms. Intended for students enrolled in the cmpt 317 course on introduction to artificial intelligence at the university of saskatchewan in the winter 2024 semester.
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!
Department of Computer Science 176 Thorvaldson Building 110 Science Place, Saskatoon, SK, S7N 5C9, Canada Telephone: (306) 966-4886, Facsimile: (306) 966-
Winter 2024 Introduction to Artificial Intelligence
General Instructions
Department of Computer Science 176 Thorvaldson Building 110 Science Place, Saskatoon, SK, S7N 5C9, Canada Telephone: (306) 966-4886, Facsimile: (306) 966-
Winter 2024 Introduction to Artificial Intelligence
The Water Jugs problem
Consider the following form of a classic logic puzzle. You have three jugs, with capacities 16 liters, 7 liters and 5 liters, along with a water faucet with infinite water. You have some target value G, meaning that you want to end up in a situation where you have EXACTLY G liters of water in one of the jugs (it does not matter to you which one). Your possible actions consist of:
A solution to a Water Jugs problem consists of a sequence of actions taken from the above possibilities that results in exactly G liters in one of the jugs. Obviously, if G is either 16, 7, or 5, the solution is trivial: simply fill the matching jug from the faucet. For other values of G, it may not be so easy and may require a combination of fills, dumps, and transfers.
Department of Computer Science 176 Thorvaldson Building 110 Science Place, Saskatoon, SK, S7N 5C9, Canada Telephone: (306) 966-4886, Facsimile: (306) 966-
Winter 2024 Introduction to Artificial Intelligence
Purpose: To apply uninformed search algorithms
AIMA Chapter(s): 3.1-3.
For this question, your task is to impelement the Water Jugs problem as a search problem. You have been provided with several Python files. These include a generalized, object-oriented imple- mentations of the basic search algorithms below:
Each of the algorithms above can be run using either the Tree search or Graph search variants. The only file you need to CHANGE is WaterJugs.py. This file implements both the State and Problem classes that are used by the search algorithms. The provided version of WaterJugs.py contains only method headers. You need to implement these methods correctly to capture the specific dynamics of the Water Jugs problem, using your understanding of search problem encoding and of AIMA Chapter 3. When you are done, you can test your implementation by running see_solutions.py with the following arguments: python see_solutions. py 1 ids graph 10 If everything is working correctly, this should find a solution to the Water Jug problem for the target value of 1 liter. However, BEFORE you do this, it is crucial that you ensure your state and problem implementation is cor- rect. Testing via search is a BAD idea, as the search may examine thousands or even millions of nodes. A simple example of a test file is provided to give you some testing ideas. You don’t need to hand in this testing, but there is virtually no chance that your implementation will be correct if you don’t do it. Hint: By far the most common problem in implementing a search problem is "not copying things that need to be copied" when you create a new state. For example, recall that in Python, you can easily create a (shallow) copy of a list like so: new_list = [ x for x in old_list ] Some students are tempted to use built-in Python methods like .deepcopy, but this can be extraordinarily inefficient if called blindly. Making manual copies with list comprehensions and copying only what you need usually works out much better.
Be sure to include your name, NSID, student number, and course number at the top of all documents.
Department of Computer Science 176 Thorvaldson Building 110 Science Place, Saskatoon, SK, S7N 5C9, Canada Telephone: (306) 966-4886, Facsimile: (306) 966-
Winter 2024 Introduction to Artificial Intelligence
Purpose: To understand the differences between search algorithms
AIMA Chapter(s): 3.1-3.
This question assumes that you have a working State and Problem class for the Water Jugs problem. For this question, you will run several different provided search algorithms and summarize the results in table. Run all of the search algorithms shown in the table below to try to find the solution to a Water Jugs prob- lem with a target value of ONE LITER , using a time limit of 10 seconds. You can do this by running see_solutions.py with different command line parameters. A quick look at the code in the file should make it obvious how to do this.
BFS-T BFS-G DFS-T DFS-G IDS-T IDS-G
Time used (secs) Memory used (nodes)
Your table should be neat and readable (use tabs in plain text, or a table in Word, etc). Round or truncate the time values to 3 decimal points worth of precision (i.e. number of milliseconds). After collecting the data, answer the following questions.
Be sure to include your name, NSID, student number, and course number at the top of all documents.