Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Etienne Bacher: Where should my family meet? #7

Open
utterances-bot opened this issue Oct 30, 2023 · 1 comment
Open

Etienne Bacher: Where should my family meet? #7

utterances-bot opened this issue Oct 30, 2023 · 1 comment

Comments

@utterances-bot
Copy link

Etienne Bacher: Where should my family meet?

https://www.etiennebacher.com/posts/2023-01-14-where-should-my-family-meet/

Copy link
Owner

Comment by Alex Dowad via email:

"You ended off the post by asking readers for suggestions on how to make your code pick locations on land and avoid those on water. I've not read any literature on constrained optimization, but here are a few suggestions just from the top of my head:

  • Perhaps you could write your own implementation of Nelder-Mead, but allow it to accept a lambda which can be called to determine if a certain point on the plane is "admissible" or not. Adjust the algorithm so it can only choose a transformation which sends the worst point to an "admissible" point. If none of the five transformations used by N-M generate an admissible point, then terminate.
  • Invent some transform of the earth's landmass which maps it onto a square plane, perform N-M in that transformed space, then apply the inverse transform to the optimum point to get the actual location on the earth's surface. I thought of two possible transforms off the top of my head:
    • Out of the 0-2π range of possible longitudes, take all longitudes which intersect with some landmass. Map those to the x-coordinates 0-1. Then for each such longitude, take all latitude intervals for which it intersects with landmass, and map those intervals only to the y-coordinates 0-1 (scaling their size as needed to fit a 0-1 range). My concern here is that the resulting function of (x,y) will have a very jagged, non-continuous surface, and optimization algorithms like N-M work best on relatively smooth surfaces.
    • Map all possible longitudes to x-coordinates and latitudes to y-coordinates. Then take every point in the (x,y) plane which maps to an ocean point, and instead, map it to the closest land point. Effectively, you are taking all the seacoast points and massively stretching them out to fill in the oceans. The resulting mappings of ocean points to land points would be similar in spirit to a Voronoi diagram. Aside from being discontinuous, this function of (x,y) has another problem... large areas will be "flat", and N-M is useless when the triangle gets onto a flat surface.
    • Even with the caveats I have mentioned above, I guess that it might still be possible to get the results you want with either of the above schemes"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants