LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[Maze solving Algorithm] Random search

Hi everyone, 

 

I'm trying to create a random search way for the robot to find its way out to the destination point which is coloured as red. 

I have worked days and nights, but still cannot get it solved. 

Please give me some guideline. 

 

Attached herewith my current progress. 

 

Many thanks. 

 

 

0 Kudos
Message 1 of 11
(5,345 Views)

You will need to setup the main VI to be recursive (to call itself).  I think this is how it should go:

 

Your main VI should be a case structure...

If moving left fails, move straight ahead.

If moving straight ahead fails, move right.

If moving right fails, move back to where you were.

Everytime you move to a new square, run this main VI.  You will need to have a pass/fail boolean that gets passed into the main VI.

 

This isn't a very detailed algorithm but maybe it will get you headed in the right direction.

 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 11
(5,312 Views)

There is a maze solving example that ships with LabVIEW. It is used to illustrate queues. Assuming you're in LabVIEW 2012 (judging from the save version of your VIs), you can get it here:

 

[LabVIEW 2012]\examples\general\queue.llb\Queue Stack - Solve Maze.vi

 

This example is also available in LabVIEW 2013, but at a different location:

 

[LabVIEW 2013]\examples\Synchronization\Queue\Queue Stack Maze Solver.vi

0 Kudos
Message 3 of 11
(5,297 Views)

Hi Darren, 

 

I able to solve the maze previously by using the queue function. What I'm planning to do is to change to another algorithm which is random search. I plan to use random search this method to reach the goal point. Is there guildeline on this? 

 

 

0 Kudos
Message 4 of 11
(5,265 Views)

@Christinalau wrote:

 

Is there guildeline on this?


The example I mentioned is the only LabVIEW maze solver I've seen.

0 Kudos
Message 5 of 11
(5,254 Views)

Hi Darren, 

 

got any way to make it as a random search?? 

0 Kudos
Message 6 of 11
(5,245 Views)

@Christinalau wrote:

got any way to make it as a random search?? 


As a first step, you should formulate your problems slightly better. Where does the robot start? What is the meaning of "out of the maze"? (For example of it starts a 0,0 in your maze, taking a step up or to the left would be "out", right? Problem solved! :D).

 

Then you should use a few more colors. I would recommend to use the first colors as "forbidden", thus you get it automatically if you step out of bounds, because it is the default value. Assign the other colors accordingly. Sort the colors in a useful order (forbidden, visited, dead end, new, out, etc.), the simply check the four values and go to the field with the highest score and update the color. Pick a random file among all highest values, etc.

 

Your code to format the time is pure Rube Goldberg, way too complicated! All you need is a numeric indicator set to time display. No string manipulation needed. You also don't need a shift register. Here's how you could keep track of elased time and format the numeric indicator.:

 

0 Kudos
Message 7 of 11
(5,238 Views)

Hi altenbach, 

 

The robot starts at (0,0). Yup, if the robot moves up or turn to the left, it is out of the maze. 

I've set few colours. If you click on the "run" inside the "Maze1.vi", you can see that. 

 

0 - white (path)

1 - black (lost)

3 - grey (wall)

4 -  green (possible path to reach the goal point)

5 - final destination

 

"next step.vi" is the vi which does the calculation part. Now, I want to do a random search which means when the robot starts moving, it will randomly choose the four direction (North, South, East, West) to go. If it meets dead end, it will backtrack and randomly choose another direction to go until it reaches the goal point. Can give me some clear instruction regarding to this?

 

Many thanks. 

0 Kudos
Message 8 of 11
(5,215 Views)

I remember having a version of exactly this problem when I was in school.  When is YOUR homework due?

0 Kudos
Message 9 of 11
(5,193 Views)

Hi Intaris,

 

This sounds a great news to me. It is due by this coming week. Can you send me the version of yours as a reference? 

 

Many thanks. 

0 Kudos
Message 10 of 11
(5,186 Views)