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

Add methods for minimal path calculation making use of UBODT #248

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# folders
bin/
input/
output/
dist/
test/bin/
test/log/

# Doc files

docs/html

# Mac

**/.DS_Store

# Mac

**/.DS_Store

# Cmake

build/
cmake-build-debug/
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

# Projects
*.cbp
*.depend
*.layout
.kdev4/
*.kdev4
.idea/

# log file
*.log


# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su

# Binary files

*.bin
*.binary

# bash file to sync file
sync.sh


# Jupyternotebook
.ipynb_checkpoints
*/.ipynb_checkpoints/*
*.pyc

# Docker specifics
Dockerfile
.git
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ project(fmm)

set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "-O3 -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ RUN apt-get update && apt-get install -y \
make libbz2-dev libexpat1-dev swig python-dev
RUN add-apt-repository -y ppa:ubuntugis/ppa && apt-get -q update
RUN apt-get -y install gdal-bin libgdal-dev
RUN mkdir -p /fmm
COPY . /fmm
WORKDIR /fmm
RUN rm -rf build
RUN mkdir -p build && \
cd build && \
cmake .. && \
make install

RUN cd example/python && python fmm_test.py

EXPOSE 8080
CMD
1 change: 1 addition & 0 deletions python/fmm.i
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ using namespace FMM::CONFIG;
%template(UnsignedIntVector) std::vector<unsigned int>;
%template(DoubleVector) std::vector<double>;
%template(PyCandidateVector) std::vector<FMM::PYTHON::PyCandidate>;
%template(UnsignedIntVectorVector) std::vector<std::vector<unsigned int>>;
// %template(DoubleVVector) vector<vector<double> >;
// %template(DoubleVVVector) vector<vector<vector<double> > >;
// %template(IntSet) set<int>;
Expand Down
4 changes: 2 additions & 2 deletions src/mm/fmm/fmm_algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ std::string FastMapMatch::match_gps_file(
std::vector<Trajectory> trajectories =
reader.read_next_N_trajectories(buffer_trajectories_size);
int trajectories_fetched = trajectories.size();
#pragma omp parallel for
#pragma omp parallel for schedule (guided)
for (int i = 0; i < trajectories_fetched; ++i) {
Trajectory &trajectory = trajectories[i];
int points_in_tr = trajectory.geom.get_num_points();
Expand Down Expand Up @@ -264,7 +264,7 @@ double FastMapMatch::get_sp_dist(
// Transition on the same OD nodes
sp_dist = ca->edge->length - ca->offset + cb->offset;
} else {
Record *r = ubodt_->look_up(ca->edge->target, cb->edge->source);
Record *r = ubodt_->look_up_or_make(ca->edge->target, cb->edge->source);
// No sp path exist from O to D.
if (r == nullptr) return std::numeric_limits<double>::infinity();
// calculate original SP distance
Expand Down
2 changes: 1 addition & 1 deletion src/mm/fmm/fmm_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FMMApp {
config_(config),
network_(config_.network_config),
ng_(network_),
ubodt_(UBODT::read_ubodt_file(config_.ubodt_file)){};
ubodt_(UBODT::read_ubodt_file(config_.ubodt_file, ng_)){};
/**
* Run the fmm program
*/
Expand Down
4 changes: 0 additions & 4 deletions src/mm/fmm/fmm_app_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ bool FMMAppConfig::validate() const
if (!fmm_config.validate()) {
return false;
}
if (!UTIL::file_exists(ubodt_file)) {
SPDLOG_CRITICAL("UBODT file not exists {}", ubodt_file);
return false;
}
SPDLOG_DEBUG("Validating done");
return true;
};
Loading