# Modeling the Trip Distributions of Tourists Based on Trip Chain and Entropy-Maximizing Theory
## 4 The Trip Distribution Forecasting Model Based on Trip Chains
### Trip Distribution Forecasting Model
#### 4.2.2 Model Building  
This paper uses the Entropy-Maximizing theory to build a trip distribution model. According to the Entropy-Maximizing theory, the maximum value of \(P(S_{mH})\) is trip chain probability distribution. Specifically, when entropy reaches its maximum value, the \(P(S_{mH})\) of a trip chain reaches the maximum. Therefore, the trip distribution forecasting model can be transformed into an optimal objective programming problem, as shown in Equation (4):  
\[ \begin{array}{l}\max P(S_{mH})=\frac{S!}{\prod\
olimits_{m=1}^{M}\prod \
olimits_{H\in H^{m}}S_{mH}!}\prod\limits_{m=1}^{M}\prod\limits_{H\in H^{n}}( P_{mH})^{S_{mH}}\\ st.\left\{\begin{array}{l}O_{m}=\sum\limits_{H\in H^{n}}S_{mH},\ m=\{1,2, \ldots,M\}\\ D_{n}=\sum\limits_{j=1}^{M}\sum\limits_{m=1}^{M}\sum\limits_{H\in H^{n}}|_{m=j} S_{mH},\ n=\{1,2,\ldots,N\}\\ d=\sum\limits_{m=1}^{M}\sum\limits_{H\in H^{n}}S_{mH}\times d_{mH}\end{array} \right.\end{array}  \tag{4}\]  
Then, we take logarithms of the objective function and use the Stirling approximation formula, i.e., \(\ln x!=x\ln x-x\), to transform the objective function into Equation (5):  
\[ \begin{array}{l}lnP(S_{mH})=\ln S!-\sum\limits_{m=1}^{M}\sum\limits_{H\in H ^{n}}S_{mH}+\sum\limits_{m=1}^{M}\sum\limits_{H\in H^{n}}S_{mH}\ln P_{mH}\\ =\ln S!-\sum\limits_{m=1}^{M}\sum\limits_{H\in H^{n}|m=j}(S_{mH}lnS_{mH}-S_{mH })+\sum\limits_{m=1}^{M}\sum\limits_{H\in H^{n}|m=j}S_{mH}lnP_{mH}\end{array}  \tag{5}\]  
Focusing on the abovementioned optimization problem, we build the Lagrangian formula and insert the constraint conditions into it. The result is shown in Equation (6). \[ \begin{array}{l}L(S_{mH},\alpha,\beta,\gamma)=\ln S!-\sum\limits_{m=1}^{M} \sum\limits_{H\in H^{n}}(S_{mH}lnS_{mH}-S_{mH})\\ +\sum\limits_{m=1}^{M}\sum\limits_{H\in H^{n}}S_{mH}lnP_{mH}+\sum\limits_{m=1}^ {M}\alpha_{m}\bigg{(}O_{m}-\sum\limits_{H\in H^{n}}S_{mH}\bigg{)}\\ +\sum\limits_{n=1}^{N}\beta_{n}\bigg{(}D_{n}-\sum\limits_{j=1}^{M}\sum\limits_ {m=1}^{M}\sum\limits_{H\in H^{n}|m=j}S_{mH}\bigg{)}\\ +\gamma\bigg{(}d-\sum\limits_{m=1}^{M}\sum\limits_{H\in H^{n}}S_{mH}d_{mH} \bigg{)}\end{array}  \tag{6}\]where \(\alpha\), \(\beta\), and \(\gamma\) are Lagrangian operators. Further, we take partial derivatives of \(S_{mH}\), \(\alpha\), \(\beta\), and \(\gamma\), respectively, and set them to zero, then we get Equation (7):  
\[\left\{ \begin{array}{l}\frac{\partial L}{\partial\alpha_{mH}}=-\ln S_{mH}+ \ln P_{mH}-\alpha_{m}-\varphi\beta_{n}-\gamma d_{mH}=0\\ \frac{\partial L}{\partial\alpha}=O_{m}-\sum\limits_{H\in H^{n}}S_{mH}=0\\ \frac{\partial L}{\partial\beta}=\sum\limits_{j=1}^{I}\sum\limits_{m=1}^{I} \sum\limits_{H\in H^{n}|n=n_{j}}S_{mH}=0\\ \frac{\partial L}{\partial\gamma}=d-\sum\limits_{m=1}^{M}\sum\limits_{H\in H ^{n}}S_{mH}d_{mH}=0\end{array} \right. \tag{7}\]  
where \(\varphi\) is the length of a trip chain. Thus, the result of \(S_{mH}\) is:  
\[S_{mH}=P_{mH}\exp(-\alpha_{m}-\varphi\beta_{n}-\gamma d_{mH}) \tag{8}\]  
Besides, the constraints of the amount of trip production and attraction can be represented as Equation (9):  
\[\left\{ \begin{array}{l}O_{m}=\exp(-\alpha_{m})\sum\limits_{H\in H^{n}}P_{mH} \exp(-\varphi\beta_{n}-\gamma d_{mH})\\ D_{n}=\exp(-\beta_{n})\sum\limits_{j=1}^{I}\sum\limits_{m=1}^{M}\sum\limits_{H \in H^{n}|n=n_{j}}P_{mH}\exp[-\alpha_{m}-(\varphi-1)\beta_{n}-\gamma d_{mH}] \end{array} \right. \tag{9}\]  
To simplify the representation of the model, we define that:  
\[\left\{ \begin{array}{l}R_{m}=\frac{\exp(-\alpha_{m})}{\Omega_{m}}\\ T_{n}=\frac{\exp(-\beta_{n})}{D_{n}}\end{array} \right. \tag{10}\]  
Thus, \(S_{mH}\) can be represented as Equation (11):  
\[S_{mH}=R_{m}O_{m}\left(\prod\limits_{n=1}^{\varphi}T_{n}D_{n}\right)P_{mH}exp (-\gamma d_{mH}) \tag{11}\]  
Then, parameter \(R_{m}\) and \(T_{n}\) can be represented as Equation (12):  
\[\left\{