diff --git a/Pipline.md b/Pipline.md index 6e02c52..e5f1ae1 100644 --- a/Pipline.md +++ b/Pipline.md @@ -17,5 +17,34 @@ L --> M[Generate JSON] M --> N[Render in Leaflet] ``` -# DBSCAN Clustering +# Why C/C++ +What we're building here is a **GPS Trajectory Reconstruction and Stop-Detection Engine**, engines demand high performance code, it's a critical thing. We could've choose a different approach we could've decided to use Python and call Skitlearn library to use DBSCAN, then use OSRM as REST API service, or a different approach integrate DBSCAN into TrizDistribution using Java then use API calls for OSRM. + +The Python approach one seems good, we don't need to implement DBSCAN ourselves, well imagine install with your current project an entire additional python interpreter to call an entire library like Skitlearn just for a sake of one algorithm, it's too much resources for a simple thing. Also because we didn't implement the algorithm ourselves we lose control over the implementation, so if you want to implement T-DBSCAN, Adaptive eps or any variants, you will either need to use to ask Skitlearn to implement it for us or we will need to understand how Skitlearn is implemented and do it ourselves. + +The Java approach seems good, but Java is not fast of language also due to everything is an object in Java it will cause the engine to run in slower speeds and the existence of Garbage Collector will make us loose performance, also if we want further optimizations like SIMD Java is not going to help, also we want from our engine to be separated from the project so we use the engine in other projects. + +Using C/C++ will help us to ingrate OSRM easily as of it's built in C++, also our engine will take the form of an executable, which makes it portable. Using language like Java/Python will require the system to have JDK or JRE in case of Java, or Interpreter in case of Python, which unnecessary bloat. + +# DBSCAN Clustering (Stop Detection) + +Due to GPS drifts stops form clusters, this behavior can be used to detect when the truck stopped, and how long did it stop. +To extract this behavior a data clustering algorithm was used, unlike k-means DBSCAN does not require one to specify the number of clusters in the data a priori, also DBSCAN can find arbitrarily-shaped clusters and robust to outliers. Therefor DBSCAN was picked instead of other algorithms. + +### T-DBSCAN (Spatiotemporal Density Clustering) +Our implementation of DBSCAN is a bit different, what we implemented is T-DBSCAN where it clusters not just using x and y coordinates, but also adds the aspect of time. +Time is needed to separate trips, let me give you an example: + +let's say we passed by a place **A** at **08:00AM**, and then we passed by the same place at **01:00PM**, now we passed by the same place but in different time, if we don't include time this may form a cluster and indicate a stop even though we didn't stop at that location. + +By adding the time aspect the algorithm becomes spatiotemporal, and will fix the issue above. + +### Parameter +- MinPts: +- eps: +- delte_eps: + +### Optimization +The T-DBSCAN algorithm is optimized with KD-Tree, this will help find the nearest points faster, if further optimizations are needed then we should look into improving the **Cash Hits** and maybe change the algorithm to use **SIMD** and **Multi-Threading**. + # Map Matching \ No newline at end of file