
Q-1. Consider the Farmer-Wolf-Goat-Cabbage Problem described below:
Farmer-Wolf-Goat-Cabbage Problem
There is a farmer with a wolf, a goat and a cabbage. The farmer has to cross a river with all three things. A small boat is available to cross the river, but farmer can carry only one thing with him at a time on the boat. In the absence of farmer, the goat will eat the cabbage and wolf will eat the goat. How can the farmer cross the river with all 3 things?
State Space Formulation of the Problem
State of the problem can be represented by a 4-tuple where elements of the tuple represent positions of farmer, wolf, goat and cabbage respectively. The position of boat is always same as the position of farmer because only farmer can drive the boat.
Initial state: (L, L, L, L)
Operators:
1. Move farmer and wolf to the opposite side of river if goat and cabbage are not left alone.
2. Move farmer and goat to the opposite side of river.
3. Move farmer and cabbage to the opposite side of river if wolf and goat are not left alone.
4. Move farmer alone to the opposite side of river if wolf and goat or goat and cabbage are not left alone.
Goal state: (R, R, R, R)
Write a Python program that uses breadth-first search

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

- Q.3. This problem is known as the Three prisoners problem. Three prisoners, A, B and C, are in separate cells and sentenced to death. The governor has selected one of them at random to be pardoned. The warden knows which one is pardoned, but is not allowed to tell. Prisoner A begs the warden to let him know the identity of one of the others who is going to be executed. If B is to be pardoned, give me C's name. If C is to be pardoned, give me B's name. And if I'm to be pardoned, ip a coin to decide whether to name B or C. The warden tells A that B is to be executed. Then, Prisoner A secretly tells C the news. Prisoner A says that he is pleased because his probability of surviving has gone up from 1/3 to 1/2, as it is now between him and C. Prisoner C says that he is pleased because A still has a chance of 1/3 to be the pardoned one, but his chance has gone up to 2/3. Is the statement of Prisoner A correct? Is the statement of Prisoner C correct? 2arrow_forwardFor a given mathematical model, which gives merely a representation of the real situation, there exists an optimum solution. O Yes/No/True/Falsearrow_forwardIn the desert there is a jail. After rebellion the single guard has been immobilized. He watched helplessly how prisoners left one by one with different speed in different directions. Later he free himself and took a motobike with extra seat. Now he can follow footprints and pick up one prisoner at a time and bring them back to jail. Each prisoner moves with constant individual speed v_i and left the jail at time t_i. In which order the guard should bring the prisoners back in order to minimize the time?arrow_forward
- We use machine learning to solve problems if they satisfy three conditions. What are these conditions?arrow_forwarduse java programming language to explain if needed, please be clear, take your time, thanksarrow_forwardInference question in discrete mathematics. Use the example solution in the picture to solve this inference question. Given the premises: If the steak is well done, it’s overcooked. If the steak is overcooked, the fire alarm will go off. Either the batteries have been changed or the fire alarm will not go off. The batteries have only been changed if the ladder is in the room. The ladder is not in the room. Conclude that the steak is not well done. These premises don’t make sense in the real world. Why? How can you change the premises so that they make sense in the real world? (They don’t have to end up perfectly correct, but they need to avoid the obvious problems you uncover in part B.)arrow_forward
- Consider the doctor-patient problem. There is a Doctor's clinic which has one Doctor, one patient chair, and n chairs for waiting for patients if there are any to sit on the chair. If there is no patient, then the Doctor sleeps in his own chair. When a patient arrives, he has to wake up the Doctor. If there are many patients and the Doctor is treating a patient, then the remaining patients either wait if there are empty chairs in the waiting room or they leave if no chairs are empty. Write a solution (Algorithm / Pseudocode) using semaphores.arrow_forwardPrinciples of Artificial Intelligence Consider the following story of the play Macbeth, by William Shakespeare: The characters are Macbeth, Lady-Macbeth, Duncan and Macduff. Macbeth is an evil noble. Lady-Macbeth is a greedy ambitious woman. Duncan is a king. Macduff is a loyal noble. Macbeth is weak because Macbeth married Lady-Macbeth and because Lady-Macbeth is greedy. Lady-Macbeth persuades Macbeth to want to be king. Macbeth murders Duncan using a knife because Macbeth wants to be king and because Macbeth is evil. Lady-Macbeth kills Lady-Macbeth. Macduff is angry because Macbeth murdered Duncan and because Macduff is loyal to Duncan. Macduff kills Macbeth. Construct a semantic network representing the above story. Show the chain of reasoning leading to Macduff killing Macbeth.arrow_forward4. Consider the Railway Reservation System. There are a number of trains and each train stops in one or more stations. Each train has a predetermined number of seats available in each of classes (First class, First AC, Second AC, Third AC, Sleeper and so on). The fare between two stations is determined by the class of travel and the distance. Passenger can enquire about the availability of seats between any two stations and for any class. The Railway Reservation System should be able to handle the queries and perform the necessary reservation/ cancellation operations. Draw a class diagram for the case study.arrow_forward
- We can implement requests to the waiter as either a queue of requests or as a periodic retry of a request. With a queue, requests are handled in the order they are received. Th e problem with using the queue is that we may not always be able to service the philosopher whose request is at the head of the queue (due to the unavailability of resources). Describe a scenario with 5 philosophers where a queue is provided, but service is not granted even though there are forks available for another philosopher (whose request is deeper in the queue) to eat.If we implement requests to the waiter by periodically repeating our request until the resources become available, will this solve the problem described in the above Exercise? Explain.arrow_forwardProblem 7: Use Wang's algorithm to answer whether or not Mary will go to the party, given that: If Bob goes to the party, then Anna goes (B → A). If Mary goes to the party, then Bob goes (M → B). Anna will not go to the party (not A). Show all the steps clearly stating the rule applied at each step.arrow_forwardSuppose that a manufacturing company builds n different types of robots, sayrobots 1, 2, . . . , n. These robots are made from a common set of m types of materials, saymaterials 1, 2, . . . , m. The company has only a limited supply of materials for each year,the amount of materials 1, 2, . . . , m are limited by the numbers b1, b2, . . . , bm, respectively.Building robot i requires an aij amount from material j. For example, building robot 1requires a11 from material 1, a12 from material 2, etc. Suppose the profit made by sellingrobot i is pi. Write an integer linear program for maximizing the annual profit for thecompanyarrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





