How to solve monkey and banana problem using best-first search algorithm? Anyone having ideas? I know we have to choose a heuristic function 'h(n)' for performing distance related calculations. But can anyone elaborate this problem ? (algorithm and complexity analysis much appreciated)

Recommended Answers

All 6 Replies

The first step in solving that problem is to know what the problem is. I know of at least three different problems that mention a monkey and a banana. One involves a hanging banana, a monkey and a tool of some kind. One involves a banana behind a barrier and a requirement to create a tool from parts; and one is a joke.

By the way, I've watched video of an actual monkey solving the banana and stick problem... by climbing the stick and, before it falls over, grabbing the banana. Nature will always find some OTHER way...

shoot the monkey, then eat the banana.
Problem solved :)

shoot the monkey, then eat the banana.
Problem solved :)

No one knows the solution? I want detailed information about the complexity & heuristic function which we have to choose for the problem & not jokes!

commented: This is not a homework completion service. Perhaps you should demonstrate a little effort first. -3
commented: solution to what? -3

The first step in solving that problem is to know what the problem is. I know of at least three different problems that mention a monkey and a banana.

No one knows the solution? I want detailed information about the complexity & heuristic function which we have to choose for the problem & not jokes!

You need to read people's responses more carefully.

Nobody knows the solution because you haven't expressed a clear problem. You ask "How to solve monkey and banana problem"--we're asking you to clearly define the problem first. If you can't do that, any answer we give you won't be very helpful.

No one knows the solution? I want detailed information about the complexity & heuristic function which we have to choose for the problem & not jokes!

I gave you a solution to a problem involving a banana and a monkey (there's a monkey with a banana you want to eat and he doesn't want to give it to you). If it wasn't the problem you have with them, state the actual problem.

follow the algo

on(floor,monkey) .
on(floor,chair).
in(room,monkey).
in(room,chair).
in(room,banana).
at(calling,banana).

strong(monkey).
grasp(monkey).
climb(monkey,chair).

push(monkey,chair) :-
    strong(monkey).

under(banana,chair) :-
    push(monkey,chair).

canreach(banana,monkey) :-
    at(floor,banana);
    at(calling,banana),
    under(banana,chair),
    climb(monkey,chair).

canget(banana,monkey) :-
    canreach(banana,monkey),grasp(monkey).

save it
compile it
follow next step
canget(X,Y). press enter

the result is....
X = banana
Y = monkey

commented: Try looking at the dates of a thread before replying to something that's been dead for six years. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.