Sorry. I should've included actual data, rather than a random grid. Try
this:

g =: 10 10 $ (0 0 0 0 1 1 0 0 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 1 0 0 1
0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 1 0 0 1 1 0 1
0 1 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 0 1)

Are you sure it's taking a long time, and not failing? It's likely that the
path from (5,0) to (0,8) on a random grid will fail.

The graph search and hex grid search were hypothetical--i.e. I don't have
the path extension functions written. They were intended to be examples of
how aStar would be used in other contexts.

The issues you brought up are probably correct. Yesterday I noticed those
lines were buggy and fixed them. Updated code is here:
http://pastebin.com/RjQA69j6

 - Max

On Mon, Jul 9, 2012 at 11:46 AM, Raul Miller <rauldmil...@gmail.com> wrote:

> I'm running this right now...
>
>    g =: ? 10 10 $ 2
>    0 8 ((g gridExtendPath) aStar manhattanDistance) 5 0
>
> ... but it's taking a long time.
>
> And without a working example that I can repeat, I cannot easily
> investigate the numbers.
>
> Meanwhile
>    'Z' (graphExtendPath aStar 1:) 'A'
> doesn't work because graphExtendPath was not in the pastebin.
>
> Still, this is enough to start trying to understand the code.
>
> Unless there's something going on that I do not understand (or unless
> there's something that *should be* going on that I do not understand),
> you should probably replace
>
>   closed =: closed, last
> with
>   closed =: ~. closed, last
>
> ...but, that said, the expression where closed gets used:
>   if. +/ closed (*./^:_@:=)"_1 _ last do. continue. end.
> strikes me as odd.  If closed is not empty and if   1 < # ~. last
> then this statement does nothing (because two different values in last
> cannot be equal to any single value in closed).  Why so much work for
> edge cases?  But another possibility is that the rank of closed was
> supposed to be 2 instead of 1.
>
> Anyways, perhaps you can cook up an example where it terminates
> quickly?  That might make this easier to read.
>
> Thanks,
>
> --
> Raul
>
> On Mon, Jul 9, 2012 at 10:14 AM, Max Harms <raeli...@gmail.com> wrote:
> > g =: ? 10 10 $ 2
> > 0 8 ((g gridExtendPath) aStar manhattanDistance) 5 0
> >
> > Hypothetical Dijkstra's Search on an arbitrary graph:
> > 'Z' (graphExtendPath aStar 1:) 'A'
> >
> > Hypothetical A* for hex grid:
> > goal (hexGridExtendPath aStar euclideanDistance) start
> >
> >  - Max
> >
> > On Sun, Jul 8, 2012 at 11:02 PM, Raul Miller <rauldmil...@gmail.com>
> wrote:
> >
> >> On Sat, Jul 7, 2012 at 8:59 PM, Max Harms <raeli...@gmail.com> wrote:
> >> > Here's the functioning code if you're curious:
> >> http://pastebin.com/RjQA69j6
> >>
> >> I'm curious.
> >>
> >> How do you use this?  (What are some sample sentences.)
> >>
> >> [Especially when you are working with adverbs and conjunctions, but
> >> also even with verbs, examples help illustrate the relevant domains.]
> >>
> >> Thanks,
> >>
> >> --
> >> Raul
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to