Commute Pattern Analyzer 通勤模式分析工具

写在前面 Notice

1. 这是一个完全免费的工具。
This is a completely free tool.

2. 我不是专业码农,因此不能保证功能不出现问题。如果你在使用中发现任何bug,请和我联系,除了用户电脑本身的问题以外,绝大多数的问题都可以得到及时解决。
It is hard to get rid of all bugs, and I cannot make guarantee for the functionality of the tool. If you find any bug when using it, please contact with me. I promise that most of the problems (expect those caused only by your computer) could be solved in time.

3. 本工具基于Matlab 2015a GUI开发,因此,你的电脑中可能需要安装Matlab Runtime 2015a,具体请看此页
This tool is developed based on Matlab 2015a GUI, thus you might need to install Matlab Runtime 2015a in advance. You can refer to this page.

下载 Download

CommutePatternAnalyzer

功能介绍 Introduction of Functionality

本文所称的通勤模式即小区之间的通勤交通分布,其主要功能是在根据小区之间的交通成本,以及每个小区的总居住人口&总就业岗位,求得小区之间的不同类型的通勤交通分布。事实上,对于非通勤类的其他类型出行,亦可以类似地分析。
The so-called commute pattern refers to the trip distribution matrix among zones. The main function of this tool is to calculate different kinds of trip distribution matrices given traffic cost and total population & jobs of zones. In fact, non-commuting trip patterns could also be analyzed in the similar way.

一方面,用户可以利用经典的重力模型求得基于重力模型的通勤交通分布矩阵。这里的重力模型不同于城市地理学常用的哈夫(Huff)模型。哈夫模型是单约束重力模型,只保证从每个小区出发的总出行量等于该小区的总人口数,而不能保证到达每个小区的总交通量等于该小区的总就业数,该模型相对简单,ArcGIS已经提供了工具。本工具采用的重力模型是双约束重力模型,在总人口与总就业上都保证约束条件的成立。重力模型中的阻抗函数采用倒幂函数f(cost) = cost-b,其中的b被称为扩散参数,需要指定。如果用户能够提供一个观察到的实际交通分布矩阵,那么本工具可以完成对b的估计。
First, users could employ classical gravity model to generate a commute-trip distribution matrix. The gravity model of this tool is different from Huff model, which is commonly used in urban geography. Huff model is a singly-constrained gravity model: the sum of trips leaving from a zone equals the total population of that zone, while the sum of trips arriving at a zone does not necessarily equals the total jobs of that zone. Huff model is relatively simple, and already available in ArcGIS. On the other side, the gravity model in this tool is a doubly-constrained one, which make constraints on both total population and jobs. The impedance function of the gravity model is the inverse function f(cost) = cost-b,where b is commonly referred as dispersion parameter, which needs to be set. If users could import an observed trip distribution matrix, this tool could help to estimate the value of b.

另一方面,用户也可以利用线性规划求得一个理论最优的通勤交通分布矩阵。这种交通模式可以保证所有人的平均通勤成本最低。
Users could also adopt linear program method to generate a theoretically optimal commute-trip distribution matrix, which minimizes the average traffic cost of all commuters.

基于重力模型的通勤分布可以被视为具有现实意义的预期结果,而最优通勤分布则是一种理想情况,本工具会分别计算它们的人均通勤成本。如果有实际的通勤分布矩阵,那么用户可以比较不同通勤分布模式之间的人均通勤成本,评估潜在的过剩通勤。
The trip distribution based on gravity matrix could be viewed as expected result with practical meanings, while the optimal trip distribution is an ideal situation. This tool would calculate average traffic cost of all commuters of different trip distribution patterns, and if the users provide observed trip distribution matrix, they are able to make comparisons among average traffic costs of different commute patterns, and evaluate possible redundant commutes.

视频示例 Video Demo

算法 Algorithms

设小区i与小区j之间的交通成本为dij,小区i的总人口数为Pi,小区j的总就业数为Ajb为成本扩散参数。
Supposing the traffic cost between zone i and zone j is dij, the total population of zone i is Pi, the total jobs of zone j is Aj, and the dispersion parameter is b.

若某个通勤模式下,从小区i到小区j的通勤者人数为Tij,则所有通勤者的人均交通成本c可以通过下式计算。
Supposing the number of commuters from zone i to zone j is Tij, the average traffic cost of all commuters (c) could be easily calculated as follows.

c = ijTijdij / ∑ijTij

根据双约束重力模型,从小区i到小区j的通勤者人数Tij可根据下式计算。
According to doubly-constrained gravity model, the count of commuters Tij from zone i to zone j could be calculated as follows.

Tij = ai * Pi * bj * Aj * f(dij)
jTij = Pi , ∑iTij = Aj
f(dij) =  (dij)-b (b>0)

aibj分别为行i和列j的平衡系数。因于二者之间相互依赖,难以直接求解,因此通过给定b的初值,然后计算a,然后再计算b,再计算a的迭代方式求解,见下式。
aand bare balance coefficients of row i and column j respectively. Since they are mutually dependent on each other, it is difficult to directly solve them, and an iterative method would be applied as follows.

ai  = 1 / kbkAkf(dik)
bj = 1 / ∑kakPkf(dkj)

在用实际通勤分布矩阵标定重力模型中所使用的参数b时,经典方法是使得预测的人均交通成本与实际的人均交通成本最接近。对此,可采用下式所示的迭代法。式中的c*为实际人均交通成本,c(k)为第k次迭代时的预测人均交通成本,b(k)为第k次迭代时对b的估计值。
When calibrating parameter b of gravity model using observed commute trip distribution, the classical way is to minimize difference between gravity-model-predicted average traffic cost and observed average traffic cost. Following iterative method could be applied to solve this problem, where c* refers to observed average traffic cost, c(k) refers to gravity-model-predicted average traffic cost at iteration k, and b(k) refers to the value of b at iteration k.

Iteration 1: b(1) = 1 / c*
Iteration 2: b(2) = b(1)c(1) / c*
Iteration 3 and afterwards: b(k) = ((c(k-1) – c*)b(k-2) – (c(k-2) – c*)b(k-1)) / (c(k-1) – c(k-2))

除了上述经典方法以外,本工具也可以通过遗传算法求解。使用遗传算法时,既可以同样采用人均交通成本作为逼近目标,也可以将目标定设定使预测的通勤分布矩阵与实际尽可能相似。需要注意的是,遗传算法通常需要更长的求解时间。
In addition to this classical method, this tool also provides genetic algorithm (GA) option. GA could either set the closest average traffic cost as the object, or attempt to generate a closest predicted commute trip matrix as the observed matrix. Please note that GA would generally require more solving time.

对于最优通勤模式问题,可以通过下列线性规划问题求解。
As to optimal trip distribution problem, a linear program model is employed, as follows.

min: c = ijTijdij / ∑ijTij
Subject to: ∑jTij = Pi , ∑iTij = Aj

 

 

This Post Has 4 Comments

  1. 大牛,非常厉害,感谢了!

    1. 谢谢,不敢当

  2. 想请教一下,如果需要在更高版本的matlab上运行这个程序,有解决办法吗

    1. 请问是哪个版本?我现在也有在用更高版本的Matlab,如果正好版本一致的话,我可以打包一个新版本的。不过,建议去载安装一个matlab 8.5版本的runtime,具体方法请参见http://wangc.net/install-matlab-runtime/

回复 wangcan 取消回复

Close Menu
ICP备案号:沪ICP备20010289号-1