Question: Using python, solve this problem: There are two jugs of water with maximum capacity of four and three liters, respectively. The task is to fill

Using python, solve this problem:
 Using python, solve this problem: There are two jugs of water

There are two jugs of water with maximum capacity of four and three liters, respectively. The task is to fill the 4-liter capacity jug with two liters of water. There is no other way of measuring water except by the size of the jug, i.e., one can either fill the jug with water pump to its brim, make it empty, or pour water from one jug to another one. This problem can be modeled as a state search problem. A state is represented by a tuple (A, B), where A is the amount of water in the 4-liter jug and B is amount of water in the 3 -liter jug. The three possible actions can be performed which are fill, empty, and pour. In the previous lab, we provided the complete search space. You had to implement BFS to solve the problem and generate the optimal solution. For this lab, you need to implement Hill-Climbing to solve the problem. 1. Think about a heuristics function to guide the hill-climbing. Clearly provide this function and how to evaluate it. 2. Write a Python program to implement Hill-Climbing and use the program to generate a solution from a given start state. (The input start state would be given in a file named week3labin.txt consisting of one line with two numbers separated by a space where the first number represents the amount of water in the first jug and the second number represents the amount of water in the second jug). Extra credit: make your code modular. 3. Does your program provide an optimal solution? Explain your answer to this part

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!