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

Per-layer cost coefficients #78

Closed
wants to merge 20 commits into from

Conversation

0x0539
Copy link

@0x0539 0x0539 commented Nov 3, 2024

Adds support for per-layer cost coefficients.

For the heuristic, I used min-layer-cost as this should be both admissible and backwards-compatible, though I'm sure better heuristics are possible.

I need this functionality for my own use, though I see it's a commonly-requested feature, e.g. #35, vleue/vleue_navigator#66, and vleue/vleue_navigator#46

I saw in the docs that layer.scale can be used as a cost-coefficient, but I found it hard to work with, due to some unwanted interaction with mesh scaling and obstacle scaling. This cost coefficient should be more straightforward to use.

@0x0539 0x0539 changed the title Per-layer cost coefficient Per-layer cost coefficients Nov 3, 2024
@0x0539
Copy link
Author

0x0539 commented Nov 16, 2024

Actually, it doesn't work. I've identified a few problems:

  1. "Polygons should not be reentrant" is no longer valid. Imagine that starting point and ending point are both in the same high-cost polygon, but the surrounding region is low-cost.

  2. Locating the target polygon during a search should not terminate the search. Imagine that your target is in the far end of a high-cost central region that you have to walk around.

  3. Finding the turning point before the goal no longer seems to work properly. Not sure why, honestly.

  4. Heuristic may no longer be valid. This has an easy solution but, when I tried it, it didn't magically fix everything.

I'm going to close this PR. I will open a new one if I'm able to find a solution.

@0x0539 0x0539 closed this Nov 16, 2024
@mockersf
Copy link
Member

mockersf commented Nov 24, 2024

the scale field of the layer should be usable to define cost per layer

at the moment the "best" place where it's documented is this test: https://github.com/vleue/polyanya/blob/d1102969b3bb98af303f94c8eec64baa7ab926f6/src/stitching.rs#L899C8-L899C34

Could you give more info about the issues you had?

@0x0539
Copy link
Author

0x0539 commented Nov 25, 2024

Yeah I saw the comment but when I tried scale it had a bunch of undesirable side-effects like increasing the size of the layer. It might be good to have an example of traversal cost, seeing as it's a fairly often requested feature. Maybe then I could see what I did wrong.

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

Successfully merging this pull request may close these issues.

2 participants