最短路径分析算法in PgRouting
来源:互联网 发布:显示器自动校准软件 编辑:程序博客网 时间:2024/04/29 23:29
wangsh 2011-11-18
PgRouting是开源路径分析算法库,其主要功能包含:
基于Dijkstra算法的最短路径(未使用启发式算法);
基于A star算法最短路径:使用启发式算法求解大数据量路径算法;
基于Shooting-Star算法的最短路径:使用启发式算法接球转向限制;
旅行商算法(TSP):使用遗传算法求解(最多求解40个点);
计算驾车距离(Isolines)(没有找到相关代码)。
编译pgrouting(参考5)
我分析相关代码,并贴出核心部分:pgrouting最短路径核心算法基于bgl实现:
dijkstra.c:
static int compute_shortest_path(char* sql, int start_vertex, int end_vertex, bool directed, bool has_reverse_cost, path_element_t **path, int *path_count)
{
//此处省略代码n行
ret = boost_dijkstra(edges, total_tuples, start_vertex, end_vertex,
directed, has_reverse_cost,
path, path_count, &err_msg);
//此处省略代码n行
}
astar.c:
static int compute_shortest_path_astar(char* sql, int source_vertex_id, int target_vertex_id, bool directed, bool has_reverse_cost, path_element_t **path, int *path_count)
{
//此处省略代码n行
// calling C++ A* function
ret = boost_astar(edges, total_tuples, source_vertex_id-v_min_id, target_vertex_id-v_min_id, directed, has_reverse_cost, path, path_count, &err_msg);
//此处省略代码n行
}
shooting_star.c
static int compute_shortest_path_shooting_star(char* sql, int source_edge_id, int target_edge_id, bool directed, bool has_reverse_cost, path_element_t **path, int *path_count)
{
//此处省略代码n行
ret = boost_shooting_star(edges, total_tuples, source_edge_id, target_edge_id, directed, has_reverse_cost, path, path_count, &err_msg, e_max_id);
//此处省略代码n行
}
tsp.c:
static int solve_tsp(char* sql, char* p_ids,
int source, path_element_t* path)
{
//此处省略代码n行
//使用gaul库解决最多40个网络节点旅行商问题
ret = find_tsp_solution(total_tuples, DISTANCE, ids,
source, &fit, err_msg);
//此处省略代码n行
}
pgrouting是依赖bgl完成路径分析的,这也许就是bgl的强大之处,也许是到了深入学习bgl的时候了。
参考资料
1. PgRouting: http://www.pgrouting.org/
2. PgRouting文档介绍 http://www.davidgis.fr/documentation/pgrouting-1.02/
3. 使用pgRouting进行路径分析 http://blog.csdn.net/warrenwyf/article/details/5703360
4. OSGEO pgrouting http://download.osgeo.org/pgrouting/
5. Windows编译 http://www.pgrouting.org/docs/howto/build_on_windows.html
6. 运用pgrouting求解最短路径 http://2007.foss4g.org/presentations/view.php?abstract_id=84
7. PostLBS http://en.giswiki.net/wiki/PostLBS
8. 测试数据地址:http://wiki.openstreetmap.org/wiki/Planet.osm
- 最短路径分析算法in PgRouting
- pgrouting最短路径
- 使用pgrouting和geotools实现最短路径,服务区分析
- 最短路径分析算法in QGIS
- pgrouting路径分析(任意两点之间的最短路径)
- 最短路径分析算法in OpenGraphRouter初探
- 使用pgrouting求任意两点的最短路径
- 最短路径Floyd算法分析
- 最短路径--Dijkstra算法原理分析
- 最短路径算法对比分析
- 最短路径算法对比分析
- Dijkstra(迪杰斯特拉)最短路径算法分析
- 最短路径算法对比分析
- pgrouting路径分析(站点与GRID中心点最短距离)
- 最短路径算法
- 最短路径算法
- 最短路径算法
- 最短路径算法
- 重大突破!最完美的U盘解决方案—U+,GRUB.MBR双引导多菜单,强强联合提兼...
- 王晓东 算法3-7 数字三角形
- python对版本号进行排序
- Xml中SelectSingleNode方法中的xpath用法 .
- C6中session传递判断简单例子
- 最短路径分析算法in PgRouting
- oracle 字符集基本知识以及正确设置
- 用户激活和找回密码发送邮件
- Tomcat 下配置ClickOnce程序使其兼容IE6
- 生活中积累的词汇
- 表链接方式
- 读书笔记之《Linux内核设计与实现》- 第二次阅读
- 2011年Esri用户大会技术亮点总结之五:ArcGIS私有云
- Chickon:最雷人的策略游戏之一