Skip to content

Commit

Permalink
Merge pull request #67 from datakind/fix_resequence
Browse files Browse the repository at this point in the history
Fix a resequence bug that happens in routes of one location
  • Loading branch information
Zebreu authored Jun 2, 2024
2 parents c7ec807 + e581954 commit ac2fad0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dkroutingtool/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RUN apt-get update
RUN apt-get -y install git g++ cmake libboost-dev libboost-filesystem-dev libboost-thread-dev libboost-system-dev libboost-regex-dev libstxxl-dev libxml2-dev libsparsehash-dev libbz2-dev zlib1g-dev libzip-dev libgomp1 lua5.2 liblua5.2-dev libluabind-dev pkg-config libgdal-dev libboost-program-options-dev libboost-iostreams-dev libboost-test-dev libtbb-dev libexpat1-dev wget

#RUN git clone -b 5.21 --single-branch https://github.com/Project-OSRM/osrm-backend.git
# Archive of the lines above, temporary until we modernize the routing tool
# Archive of the lines above, temporary until we modernize the routing tool, might also use
#RUN wget https://github.com/Project-OSRM/osrm-backend/archive/refs/tags/v5.24.0.tar.gz && tar -xvf v5.24.0.tar.gz && mv /osrm-backend-5.24.0 /osrm-backend
COPY osrm-backend.tar.gz .
RUN tar -zxvf osrm-backend.tar.gz

Expand Down
7 changes: 5 additions & 2 deletions dkroutingtool/src/py/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

resequencing = True
resequencing_step_size = 0.0002 # Arbitrary and small, in the scale of long/lat degrees
#resequencing_step_size = 0.00001

clustering_agglomeration = True #Uses naive thresholding agglomeration unless sprawling is enabled
agg_threshold_radius = 5 #Units in seconds of travel
Expand Down Expand Up @@ -979,8 +980,10 @@ def resequence(node_data, data, routing, routes_all, original_routes, vehicle_pr
for row in rows:
reordered_nodes.append(row)

new_route_df = pd.DataFrame(reordered_nodes)
new_route_df.columns = route_df.columns


new_route_df = pd.DataFrame(reordered_nodes, columns=route_df.columns)
# Turn off resequence if something's weird, this is less tested
ordered_nodes[route_key] = new_route_df


Expand Down

0 comments on commit ac2fad0

Please sign in to comment.