David and Jimmy,
Thanks for replying. I think I have an algorithm in j to find all the areas
(and to sort them), my main question is how to eliminate the infinite areas
algorithmically. Having thought a little more about the use of convex hull
identification to identify *some* of the infinite areas, I'm wondering if
an iteration of finding convex hulls of on reduced vertex sets would be
practical and productive. For example, with my data set, 4 vertices defined
the initial convex hull. I'm wondering if removing all or one of those
vertices and resolving the distance areas, done repeatedly, would
eventually yield a solution. But I can't imagine the ending condition or
the correct vertices to remove at each step.
Separately, if others would like to see my algorithm to find the areas, I
can post it.
The algorithm I used for find convex hulls was taken from the jwiki and
shown below.
counterclockwise =: ({. , }. /: 12 o. }. - {.) @ /:~
crossproduct =: 11"_ o. [: (* +)/ }. - {.
removeinner =: #~ 1, 0 > 3 crossproduct\ ], 1:
hull =: [: removeinner^:_ counterclockwise
+. hull j./"1 data6
1 1
8 3
8 9
1 6
Thanks,
On Sat, Dec 8, 2018 at 10:34 AM Brian Schott <[email protected]> wrote:
> I had quite a time doing day6 because after I computed all of the
> distances for all the areas for each given vertex, I could not eliminate
> the infinite vertices mathematically. For the 6-vertex the removal of
> infinite vertices was simply a matter of finding the convex hull using
> transitive closure, and then removing those vertices. But in the real data
> set, that was not enough. From reading a comment on reddit.com (link
> below) I gathered that one way to have found the set of all infinite areas
> would have been to give the total area a large border so that the infinite
> areas seemed infinite because of their disproportionately large area.
>
> https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/
>
> But I did not try that because I discovered how to use viewmat to see the
> 50+ areas and to use j's Amend on the array of minimum distances to
> superimpose selective vertices as dots on the viewmat. Then I could see
> (most of the areas -- not all of them because the color differentials were
> not very contrasty for my color-defective eyes) the areas and visually
> chase down the largest area.
>
> The viewmat approach mesmerized me a little, to be honest, but I am
> wondering if another more mathematical approach could be used? I would be
> happy to share my existing code, if that would be a better place to start.
> But perhaps my description of my and your approach would be adequate.
>
>
> Thanks,
>
> --
> (B=) <-----my sig
> Brian Schott
>
--
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm