diff --git a/src/a_star.jl b/src/a_star.jl index 8c4cd29..7a2bf3c 100644 --- a/src/a_star.jl +++ b/src/a_star.jl @@ -37,7 +37,7 @@ end s::Integer, t::Integer, distmx::AbstractMatrix{T}=LightGraphs.weights(g), - heuristic::Function = n -> zero(T)) where {T, U} + heuristic::Function = (u,v) -> zero(T)) where {T, U} High level function - implementation of A star search algorithm: (https://en.wikipedia.org/wiki/A*_search_algorithm). @@ -56,7 +56,7 @@ function a_star_algorithm(g::LightGraphs.AbstractGraph{U}, # the g s::Integer, # the start vertex t::Integer, # the end vertex distmx::AbstractMatrix{T}=LightGraphs.weights(g), - heuristic::Function = n -> zero(T)) where {T, U} + heuristic::Function = (u,v) -> zero(T)) where {T, U} checkbounds(distmx, Base.OneTo(nv(g)), Base.OneTo(nv(g))) frontier = DataStructures.PriorityQueue{Tuple{T, U},T}() frontier[(zero(T), U(s))] = zero(T) diff --git a/src/routing.jl b/src/routing.jl index 3e586a5..ebbd0e2 100644 --- a/src/routing.jl +++ b/src/routing.jl @@ -155,7 +155,7 @@ calculate_distance(m::OpenStreetMapX.MapData, weights::SparseArrays.SparseMatrix function find_route(m::OpenStreetMapX.MapData, node0::Int, node1::Int, weights::SparseArrays.SparseMatrixCSC{Float64,Int64}; - routing::Symbol = :astar, heuristic::Function = n -> zero(Float64), + routing::Symbol = :astar, heuristic::Function = (u,v) -> zero(Float64), get_distance::Bool = false, get_time::Bool = false) result = Any[] start_vertex = m.v[node0] @@ -206,7 +206,7 @@ end function find_route(m::OpenStreetMapX.MapData, node0::Int, node1::Int, node2::Int, weights::SparseArrays.SparseMatrixCSC{Float64,Int64}; - routing::Symbol = :astar, heuristic::Function = n -> zero(Float64), + routing::Symbol = :astar, heuristic::Function = (u,v) -> zero(Float64), get_distance::Bool = false, get_time::Bool = false) result = Any[] route1 = OpenStreetMapX.find_route(m, node0, node1, weights,