Fast map matching  0.1.0
fmm_algorithm.hpp
1 
10 #ifndef FMM_FMM_ALGORITHM_H_
11 #define FMM_FMM_ALGORITHM_H_
12 
13 #include "network/network.hpp"
14 #include "network/network_graph.hpp"
15 #include "mm/transition_graph.hpp"
16 #include "mm/fmm/ubodt.hpp"
17 #include "python/pyfmm.hpp"
18 
19 #include <string>
20 #include <boost/property_tree/ptree.hpp>
21 #include <boost/property_tree/xml_parser.hpp>
22 
23 #include "cxxopts/cxxopts.hpp"
24 
25 namespace FMM {
26 namespace MM{
39  FastMapMatchConfig(int k_arg = 8, double r_arg = 300, double gps_error = 50);
40  int k;
41  double radius;
42  double gps_error;
47  bool validate () const;
51  void print() const;
58  const boost::property_tree::ptree &xml_data);
65  const cxxopts::ParseResult &arg_data);
66 };
67 
73 class FastMapMatch {
74  public:
82  const NETWORK::NetworkGraph &graph,
83  std::shared_ptr<UBODT> ubodt)
84  : network_(network), graph_(graph), ubodt_(ubodt) {
85  };
93  const FastMapMatchConfig &config);
101  const std::string &wkt,const FastMapMatchConfig &config);
102  protected:
109  double get_sp_dist(const Candidate *ca,
110  const Candidate *cb);
117  void update_tg(TransitionGraph *tg,
118  const CORE::Trajectory &traj,
119  const FastMapMatchConfig &config);
127  void update_layer(int level, TGLayer *la_ptr, TGLayer *lb_ptr,
128  double eu_dist);
129  private:
130  const NETWORK::Network &network_;
131  const NETWORK::NetworkGraph &graph_;
132  std::shared_ptr<UBODT> ubodt_;
133 };
134 }
135 }
136 
137 #endif //FMM_FMM_ALGORITHM_H_
FMM::MM::TransitionGraph
Transition graph class in HMM.
Definition: transition_graph.hpp:54
FMM::MM::FastMapMatch
Fast map matching algorithm/model.
Definition: fmm_algorithm.hpp:73
FMM::MM::FastMapMatchConfig::FastMapMatchConfig
FastMapMatchConfig(int k_arg=8, double r_arg=300, double gps_error=50)
Constructor of FastMapMatch configuration.
Definition: fmm_algorithm.cpp:16
FMM::MM::FastMapMatch::get_sp_dist
double get_sp_dist(const Candidate *ca, const Candidate *cb)
Get shortest path distance between two candidates.
Definition: fmm_algorithm.cpp:125
FMM::MM::MatchResult
Map matched result representation.
Definition: mm_type.hpp:69
FMM::MM::FastMapMatchConfig::radius
double radius
Search radius.
Definition: fmm_algorithm.hpp:41
FMM::MM::FastMapMatchConfig::gps_error
double gps_error
GPS error.
Definition: fmm_algorithm.hpp:42
FMM::PYTHON::PyMatchResult
POD Match result type used in Python API.
Definition: pyfmm.hpp:39
FMM::MM::FastMapMatch::update_layer
void update_layer(int level, TGLayer *la_ptr, TGLayer *lb_ptr, double eu_dist)
Update probabilities between two layers a and b in the transition graph.
Definition: fmm_algorithm.cpp:156
FMM::MM::FastMapMatchConfig::load_from_xml
static FastMapMatchConfig load_from_xml(const boost::property_tree::ptree &xml_data)
Load configuration from xml data.
Definition: fmm_algorithm.cpp:26
FMM
Fast map matching.
Definition: geom_algorithm.hpp:17
FMM::CORE::Trajectory
Trajectory class
Definition: gps.hpp:26
FMM::NETWORK::Network
Road network class.
Definition: network.hpp:36
FMM::MM::FastMapMatchConfig::print
void print() const
Print information about this configuration.
Definition: fmm_algorithm.cpp:21
FMM::MM::Candidate
Candidate edge matched to a GPS point
Definition: mm_type.hpp:26
FMM::MM::FastMapMatchConfig::k
int k
Number of candidates.
Definition: fmm_algorithm.hpp:40
FMM::NETWORK::NetworkGraph
Graph class of the network.
Definition: network_graph.hpp:33
FMM::MM::FastMapMatch::FastMapMatch
FastMapMatch(const NETWORK::Network &network, const NETWORK::NetworkGraph &graph, std::shared_ptr< UBODT > ubodt)
Constructor of Fast map matching model.
Definition: fmm_algorithm.hpp:81
FMM::MM::FastMapMatch::match_wkt
PYTHON::PyMatchResult match_wkt(const std::string &wkt, const FastMapMatchConfig &config)
Match a wkt linestring to the road network.
Definition: fmm_algorithm.cpp:94
FMM::MM::FastMapMatch::match_traj
MatchResult match_traj(const CORE::Trajectory &traj, const FastMapMatchConfig &config)
Match a trajectory to the road network.
Definition: fmm_algorithm.cpp:51
FMM::MM::FastMapMatch::update_tg
void update_tg(TransitionGraph *tg, const CORE::Trajectory &traj, const FastMapMatchConfig &config)
Update probabilities in a transition graph.
Definition: fmm_algorithm.cpp:142
FMM::MM::FastMapMatchConfig::validate
bool validate() const
Check if the configuration is valid or not.
Definition: fmm_algorithm.cpp:42
FMM::MM::TGLayer
std::vector< TGNode > TGLayer
A layer of nodes in the transition graph.
Definition: transition_graph.hpp:42
FMM::MM::FastMapMatchConfig
Configuration class for fmm algorithm.
Definition: fmm_algorithm.hpp:30
FMM::MM::FastMapMatchConfig::load_from_arg
static FastMapMatchConfig load_from_arg(const cxxopts::ParseResult &arg_data)
Load configuration from argument data.
Definition: fmm_algorithm.cpp:34