# Dynamic Demand-Responsive Feeder Bus Network Design for a Short Headway Trunk Line
## 3 Methodology
### Mathematical Formulation  
The problem consists of three main parameters: \(S\) as the number of train stations, \(K\) as the number of available feeder buses at the station \(s\), and \(I^{s}\) as the number of passengers in station \(s\). In this model, \((i,j)\) represents passengers around the train stations who can be alighted/boarded to/from stations where \(i\
eq j=\{1,2,\ldots,I^{s}\}\). Each station of \(s\) has the total number of \(TV_{s}\) available at the beginning. The generated routes by the algorithm can be defined as \(d_{ij}^{s}\) which is the direct distance between passengers \(i\) and \(j\) of station \(s\) and also \(d_{i0}^{s}\) that represents the direct distance between passenger \(i\) and station \(s\). \(RT_{i}^{s}\) is defined as the requested time of passenger \(i\) at station \(s\). The speed of vehicles is defined by the speed parameter and capacity by the parameter of \(C\). The following is the mathematical formulation. The parameter \(\hat{C}_{T}\) represents the time value of passengers per hour, and \(C_{O}\) represents the unit operating cost of vehicles per kilometer. Objective Function:  
\[z=\min\sum_{s}\sum_{i=1}^{I^{s}}C_{T}\cdot WT_{i}^{s}+\sum_{k=1}^{K}C_{O}\cdot TotalD _{k} \tag{1}\]  
Variables:  
\[v_{k}^{s}= \begin{cases}1&\text{vehicle $k$ is used in station $s$}\\ 0&\text{otherwise}\end{cases} \]  
\[y_{ik}^{s}= \begin{cases}1&\text{passenger $i$ in station $s$ is served with vehicle $k$}\\ 0&\text{otherwise}\end{cases} \]  
\[\alpha_{ijk}^{s}= \begin{cases}1&\text{passenger $j$ is served right after passenger $i$ with vehicle $k$ (station $s$)}\\ 0&\text{otherwise}\end{cases} \]  
\[D_{ik}^{s}=\text{distance traveled up to passenger $i$ at station $s$ by vehicle $k$}\]  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]  
\[AT_{i}^{s}=\text{pick up time of passenger $i$ in station $s$}\]  
\[CT_{i}^{s}=\text{arrival time of passenger $i$ to station $s$}\]  
\[WT_{i}^{s}=\text{in vehicle travel time of passenger $i$ of station $s$}\]  
\[UC_{i}^{s}=\text{used capacity of vehicle after picking up passenger $i$ of station $s$}\]  
\[\text{RV}_{ss^{\prime}}=\text{number of relocated vehicles from station $s$ to $s$}\]  
\[n_{ik}^{s}=\text{passenger $i$ of station $s$ is served with vehicle $k$ in the $n_{ik}^{s}\ trip\ from station\]  
\[TV_{s}=\text{the total number of vehicles available at station $s$ at the begininng}\]  
Constraints:  
\[\sum_{k=1}^{K}y_{ik}^{s}=1\quad i=1,\;2,\ldots,I^{s}\;;\;\forall s \tag{2}\]  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]0\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]1  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]2  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]3  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]4  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]5  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]6  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]7  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]8  
\[TotalD_{k}=\text{total distance traveled by vehicle $k$}\]9  
\[AT_{i}^{s}=\sum_{k=1}^{K}\frac{D_{ik}^{s}}{speed}\ \it is considered as a used vehicle. Constraint (4) ensures that each vehicle starts and ends its trip from/to a station. Equation (5) makes sure that the total number of used vehicles does not exceed the total number of available vehicles. Equations (6) and (7) define each vehicle's path. Equations (8) and (9) make sure that each passenger is assigned to a path. (Also, zero is the index used for depot.) Equations (10)-(12) calculate the total traveled distance up to passenger \(i\). When having relocated vehicles, Equation (12) calculates the distance to the first passenger based on the relocated vehicle's station. Equation (13) defines the arrival time of vehicles to passengers where _speed_ defines the vehicle's speed.