python - How to create an automated vehicle routing simulation? -
i want create vehicle routing optimization program. have multiple vehicles travelling , delivering items finding shortest path b. @ first output results. may later create visual representation of program.
it has been suggested me find easiest in python.
i have task, seems daunting. not best programmer yet, not beginner either, @ maths , quick learner.
any advice on how break down task helpful. should use python? python modules particularly suited task?
psuedo code a* algorithm http://en.wikipedia.org/wiki/a*_search_algorithm
function a*(start,goal) closedset := empty set // set of nodes evaluated. openset := {start} // set of tentative nodes evaluated, containing start node came_from := empty map // map of navigated nodes. g_score[start] := 0 // cost start along best known path. // estimated total cost start goal through y. f_score[start] := g_score[start] + heuristic_cost_estimate(start, goal) while openset not empty current := node in openset having lowest f_score[] value if current = goal return reconstruct_path(came_from, goal) remove current openset add current closedset each neighbor in neighbor_nodes(current) if neighbor in closedset continue tentative_g_score := g_score[current] + dist_between(current,neighbor) if neighbor not in openset or tentative_g_score < g_score[neighbor] came_from[neighbor] := current g_score[neighbor] := tentative_g_score f_score[neighbor] := g_score[neighbor] + heuristic_cost_estimate(neighbor, goal) if neighbor not in openset add neighbor openset return failure function reconstruct_path(came_from,current) total_path := [current] while current in came_from: current := came_from[current] total_path.append(current) return total_path this common , pratical way find shortest path. scans surrounding area until start point , check point met , stops @ barriers
and depending on how hefty program python not best because of slower execution speeds compared other languages. if looking simplicity python best friend.
Comments
Post a Comment