0

While trying to use a wavefront algorithm, I came across a scenario that I haven’t been able to easily solve. I populate an array with a wavefront algorithm and using a Moore neighborhood, how do I decide which way to travel given that several of the neighbors are the exact same.

Moore Neighborhood

My local neighborhood has the values of 4,4,5,5,5,4,5,6. The local minima is 4, but I have 3 of them in this case. How do I make a decision based if there are several local minima to move to. Right now I am making a random decision if there are equal values, but I feel there’s a better way to decide.

Paths to destination

All paths to the destination have the same number of steps (5 steps), but each path taken is different. I am also assuming that the local minima is chosen for the pathway.

My question is, given an equal number of steps (in wavefront) is there a way other than randomization or order of the comparators are written in to make a decision on which way to move from one block to another?

Just a notation, 99 indicates a barrier.

The problem with just pure local minima or comparator order is a failure case pictured below.

Failure

I’m not looking for an Astar solution to this question, but I feel in this case, I would be faced with the exact same decision problems as all paths are equal.

Thanks

EDIT: I had incorrectly generated the numbers, embarrassing.

Here's a correct generation of the wavefront

corrected Wavefront

When correctly generated, it shows there is only 1 path

Only 1 path showing in Moore

Even when the barrier is a little more complex

Still Shortest pathway

Note: in all the images (corrected) the pathway is generated using Van Neumann neighborhood, while the movement is via Moore neighborhood.

However, if using Van Neumann neighborhood generation and Van Neumann navigation, the problem pops up again.

enter image description here

enter image description here

Andy Dansby
  • 15
  • 2
  • 9
  • How did you get `4 4 5` in row 4 of your last picture? (I assume that was just copy+pasted from the previous one). If you have to paths which have the same length and no other critera, you can choose one at random. – chtz Apr 02 '18 at 10:14
  • You are absolutely correct on my pics, I calculated the wavefront by hand and placed on a spreadsheet to view the array. My calculation is off. I have since actually created a function to calculate automatically for me. After the numbers are correctly generated, the problem goes away. The choice however resurfaces again using Van Neumann generation and navigation. – Andy Dansby Apr 05 '18 at 10:05

0 Answers0