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

Unable to use blocked and distance #41

Open
nalasark opened this issue Sep 9, 2023 · 1 comment
Open

Unable to use blocked and distance #41

nalasark opened this issue Sep 9, 2023 · 1 comment

Comments

@nalasark
Copy link

nalasark commented Sep 9, 2023

When I create a pathfinder that uses both blocked and distance, the blocked always gets ignored.
Am I doing something wrong?

graph.addLink("shopA","liftA",{weight:10, wheelchair: true});
graph.addLink("liftA","liftB",{weight:1, wheelchair: true});
graph.addLink("liftB","shopB",{weight:10, wheelchair: true});
graph.addLink("shopA","stairsA",{weight:5, wheelchair: true});
graph.addLink("stairsA","stairsB",{weight:1, wheelchair: false});
graph.addLink("stairsB","shopB",{weight:5, wheelchair: true});

let pathFinder_wc = ngraphPath.aStar(graph, {
    blocked(fromNode, toNode, link) {
        return !link.data.wheelchair;
    },
    distance(fromNode, toNode, link) {
        return link.data.weight;
    },
});

let path = pathFinder_wc.find("shopA","shopB");

path always returns the shortest regardless of stairsA -> stairsB is wheelchair false

@anvaka
Copy link
Owner

anvaka commented Sep 10, 2023

Can you please confirm version of the ngraph.path library? blocked was added just recently by @bemisguided and if you still have an older version - you might not have it.

If indeed you have the latest version - what happens when you set a breakpoint in the blocked callback?

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

No branches or pull requests

2 participants