Help with MCP.goal_reached() in scikit-image

17 views
Skip to first unread message

Spencer Gardner

unread,
May 2, 2017, 12:28:13 PM5/2/17
to SciPy-user
The skimage.graph documentation states that the goal_reached method can be overloaded to introduce additional constraints on finding the minimum cost path. I'm having some trouble implementing this but I can't find any useful examples to follow online. I'm hoping someone can provide some guidance.

I need to implement a minimum cost path through an array of costs. The added twist is that I need to ensure the path does not exceed some maximum geometric distance (represented as a total number of cells). So I need my goal_reached() method to check whether the current path has exceeded the maximum number of cells and return 1 if true (which tells MCP to stop checking neighbors).

Is there a good example implementation somewhere that I can refer to for some guidance? Here's what I have so far.

graph = MCP(costSurfaceArray,fully_connected=False)

def goal_reached(index, cumcost):
   
'''not sure what to do here'''

graph
.goal_reached = goal_reached

Reply all
Reply to author
Forward
0 new messages