# The Environmental Impact of Inland Empty Container Movements Within Two-Depot Systems
## 4. ABM Formulation
### Mathematical Model for Empty Container Movements  
To provide a clearer representation of the NetLogo model within the movement of empty containers within two depot-systems, a mathematical formulation is introduced in this section. First, in Table 4 the decision variables representing the truck movements, container deliveries, and storage states are defined to capture the operational dynamics of the system. Then, the objective function to minimize total CO2 emissions from truck movements between the depots over the time horizon is formulated, followed by constraints that ensure the operational feasibility of the solution.  
**Objective Function**:  
\[\text{Minimize}\ Z=\sum_{k\in K}\sum_{t\in T}\sum_{(i,j)\in A}\left(e_{\text{ loaded}}\times d_{ij}\times x_{ijkt}+e_{\text{empty}}\times d_{ij}\times y_{ijkt}\right) \tag{1}\]  
**Constraints**:  
Truck Flow Conservation: For each truck \(t\in T\), node \(i\in N\), and time period \(k\in K\), ensure that a truck entering a node must leave it (or remain idle):  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameters** & **Description** \\ \hline \(d_{ij}\) & Distance between nodes \(i\) and \(j\), where \((i,j)\in A\) (km) \\ \hline \(e_{\text{loaded}}\) & CO2 emission factor for a loaded truck (kg CO2/km), set to 0.157 kg/km as per the NetLogo model \\  & (0.157/1000 \(\ast\) 15 per tick, adjusted for distance) \\ \hline \(e_{\text{empty}}\) & CO2 emission factor for an empty truck (kg CO2/km), set to 2 \(\times e_{\text{loaded}}\) as per the NetLogo model (empty truck emit double due to inefficiencies) \\ \hline \(D_{ik}\) & Demand for empty containers at customer node \(i\in C\) during time period \(k\in K\) (containers/period), derived from demand – frequency in the NetLogo model (randomly set between 1 and max – _frequency_ days. \\ \hline \(S_{i}\) & Storage capacity at depot (containers) \(i\in\{\)RSGT, OHT\(\}\) set to 1000 containers in the NetLogo model \\  & (\(storage-capacity\)) \\ \hline \(M_{t}\) & Availability of truck. \(t\in T\), binary (1 if available, 0 otherwise). \\ \hline \(V\) & Total number of trucks, set to \(num-containers\) in the NetLogo model \\ \hline \(H\) & Time horizon (e.g., 5 simulated years), equivalent to \(sim-days\) in the NetLogo model \\ \hline \hline \end{tabular}
\end{table}
Table 3: Parameters.  
\[\sum_{j:(j,j)\in A}(x_{jikt}+y_{jikt})=\sum_{j:(i,j)\in A}(x_{ijkt}+y_{ijkt}),\ \forall i\in N,t\in T,k\in K \tag{2}\]  
Truck Availability: Each truck can only travel one route at a time:  
\[\sum_{(i,j)\in A}(x_{ijkt}+y_{ijkt})\leq M_{t},\ \forall t\in T,k\in K \tag{3}\]  
Customer Demand Satisfaction: The number of containers delivered to customer \(i\in C\) in time period \(k\in K\) plus unmet demand must meet or exceed the demand:  
\[\sum_{t\in T}f_{ik}+w_{ik}\geq D_{ik},\ \forall i\in C,k\in K \tag{4}\]  
Container Delivery: Containers delivered to customers come from loaded trucks arriving at the customer node:  
\[f_{iik}\leq\sum_{j:(j,i)\in A}x_{ijkt},\ \forall i\in C,t\in T,k\in K \tag{5}\]  
Depot Storage Balance: For each depot \(i\in\{\)RSGT, OHT\(\}\), the number of stored containers is updated based on incoming and outgoing containers:  
\[s_{ik}=s_{i,k-1}+\sum_{t\in T}\sum_{j:(j,i)\in A}x_{jikt}-\sum_{t\in T}\sum_{ j:(i,j)\in A}x_{ijkt},\ \forall i\in\{\)RSGT, OHT\(\},k\in K \tag{6}\]  
Depot Capacity: Storage at depots cannot exceed capacity:  
\[s_{ik}\leq S_{i},\ \forall i\in\{\)RSGT,OHT\(\},k\in K \tag{7}\]  
Port as Container Source: Containers originate from the port (JIP) when trucks leave with loaded containers:  
\[\sum_{t\in T}\sum_{j:(\text{JIP},j)\in A}x_{\text{JIP},jik}\leq\text{Port Supply},\ \forall k\in K \tag{8}\]  
Non-negativity and binary constraints:  
\[x_{ijkt},\ y_{ijkt}\in\{0,1\},\ s_{ik},\ w_{ik},\ f_{iik}\geq 0 \tag{9}\]