Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

Can anyone help me with Blind Search in C#? I am basically a beginner in programming and I can't find good examples. I understand what BFS/DFS/UCS/etc does but I don't know HOW to do it. I found this: http://www.codeproject.com/KB/recipes/UninformedSrchStrategies.aspx but I can't make it work...

OpenStudy (anonymous):

well let me tell u that a great example, but what u dont get? all of them are searching algorithm in implicit graphs. The main two algorthm here are DFS and BFS. The first one use a stack, so the first succesor in its the last out, so it search in a deep way. The second one us an queue, so the first succesor in its the first out, it search in a expanded way, u can see it it goes one depth level to another and so on. UCS its an especial case of BFS where you use a prority queue and the cost of each states is an unique constant, so this two statements make the algorithm able to find optimal solutions. Same with the Iterative Deepening Search, wich make use of Depth Limited Search (a DFS with a limited depth), it will first try with a certain distance, and make it bigger until it find a solution searching in a depth and if there isnt the solution now make bigger the limit and try a dfs and so on. Post why it doesnt work, i dont know C#, but its much like Java and C++, wich i know, maybe i o r some1 else can help u.

OpenStudy (anonymous):

For example, in the Water Jugs problem, how do I generate successors? When I try googling, they just tell me to generate the nodes but not mention how to do it...

OpenStudy (anonymous):

if u tell me or give me an statement of the problem, i googled it and there was a variety and no good info, ill help u

OpenStudy (anonymous):

Here's what I'm trying to solve: There are three water jugs with different capacities (the user will enter the capacities he wants for each jug), and a reservoir with unlimited water. And then the user will define how many liters of water he wants. The water jugs are not calibrated. So if the user says jugA = 5L, jugB = 8L, and jugC = 15L, and he wants to measure 6 liters of water, the program should search for a way to measure 6 liters using the 3 water jugs. For example, fill jugB with water, pour jugB to jug C (jugC now has 8/15 liters). fill jugB with water again, and pour jugB to jugC again (so now jug C is full and jugB has only 1 liter of water). fill jugA and pour jugA to jugB (and now jugB has 6 liters). Google tells me to use a queue or a stack, but I just don't know how to do that...

OpenStudy (anonymous):

ok i get it, well i think the succesors will be pass water from to another and fill a jug. For example: first u will have 3 sucesors: fill a, fill b and fill c then fill a will have: pass to b, pass to c, fill b and fill c fill b: pass to a, pass to c, fill a and fill c and so on U want to search in that implicit graph where the finishing states are when one of the jars have the liters u want. A general search method its: Frontier q; q.inset(So); //So are the initial states in ur case will be those 3 while(!q.empty()) { State s = q.extract(); if(s is goal) return that u found it and how by going from father to father; for(s' succesors of s) // here u generate the succs q.insert(s'); } return false; Frotier can be a queue, stack or any other stucture. If its a queue the its a bfs, a stack a dfs, its just different ways to search in a graph as i already told u. In this problem u will have duplicates (u will insert the same node several times), there are different ways to manage that, for example one its to save wich one u have already done so u dont repeat them. i recommend u rading a little more, and getting how the problems of searching are, then read the algorithms undestand them and implement ones for specifics problems like this

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!