# A Learnheuristic Algorithm for the Capacitated Dispersion Problem under Dynamic Conditions
## 4 Solution Approaches for the Dynamic Capacitated Dispersion Problem
### A Constructive Heuristic
Notice that \(\delta\in(0,1)\) is a tuning parameter, which depends on the heterogeneity of the facilities in terms of the capacity. In particular, in scenarios with heterogeneous facilities in terms of the capacity, \(\delta\) will be close to zero. On the contrary, \(\delta\) will be close to one in scenarios with homogeneous facilities in terms of the capacity. To choose the better \(\delta\) parameter, the deterministic form of the problem is taken. Then, the heuristic algorithm is performed for different \(\delta\) candidates (such as values ranging from 0.1 to 0.9). The \(\delta\) parameter that is ultimately chosen is the one that yields the best result. The parameter \(\alpha\) is another tuning parameter, and it can be selected in a similar way. To study the performance of the algorithm, a number of maximum iterations \(max\_iter\) is fixed, and the heuristic Algorithm 1 is performed for different environment conditions. In Algorithm 2, the procedure initiates by creating an empty solution set \(S\) and an empty set of objective function values \(of\_list\). It also initializes the white box, which is going to generate random predictions in the first iteration. Until the iteration limit is reach, a new set of context conditions is created, and the constructive heuristic algorithm (referenced in Algorithm 1) is repeatedly invoked to construct solution \(S\), and its performance in terms of the objective function value is recorded. Simultaneously, the white box object is subject to modifications ruled by the \(fit\_whitebox\) method, which is executed based on a probability function that is dependent on the iteration. As the iteration goes on, the chance of using the fit operation on the white box decreases. This behavior is encapsulated in Equation (11). \[ExponentialFunction:=P(t)=e^{\frac{\ln(0.01)\cdot dir}{\max\_iteration}} \tag{11}\]  
This cycle continues until the algorithm reaches the maximum iteration, thus culminating in the output of the refined solution set \(S\). ```
1:\(S\leftarrow\emptyset\)
2:\(edge\_list\gets sort(edge\_list)\)
3: Select an element \(i\) from \(edge\_list\)
4:\(S\gets S\cup Nodes(edge\_list(i))\)
5:\(capacity\gets black-box(Nodes(modified\_edge\_list(i)))\)
6:\(of\gets dist(edge\_list(i))\)
7:whilenot_feasible_solution(\(S\))do
8: Select an element \(i\) from \(node\_list\)
9:\(capacity\gets capacity+blackbox(node\_list(i))\)
10:\(S\gets S\cup node\_list(i)\)
11:\(of\gets Update\_f(S)\)
12:\(node\_list\gets Update(node\_list)\)
13:endwhile
14:return\(S\)
```  
**Algorithm 1** Constructive heuristic (\(edge\_list\), \(environment\_conditions\), \(whitebox\))```
1:\(S\leftarrow\emptyset\)
2:\(of\_list\leftarrow\emptyset\)
3:\(iter\gets 0\)
4:\(white-box\gets initialize()\)
5:while\(iter<max\_iter\)do
6:\(environment\_conditions\gets random\_environment\_conditions\)
7:\(S\leftarrow\mathit{Constructive\_heuristic}(edge\_list,environment\_ conditions,whitebox)\)
8:\(iter\gets iter+1\)
9:\(of\_list\gets of\_list\cup of(S)\)
10:\(whitebox\gets fit\_whitebox(iter,whitebox)\)
11:endwhile
12:return\(mean(of\_list)\)
```

**Algorithm 2** Algorithm performance evaluation

## 5 Numerical Experiments and Results

This section outlines the computational trials we conducted to evaluate the efficacy and performance of the previously discussed algorithms. ### Computational Environment

All of the algorithms were developed using Python version 3.11 and operated on a Google cloud platform (GCP) computing instance equipped with an Intel(R) Xeon(R) CPU @ 2.20 GHz, 8 GB of RAM, and the Debian 11 operating system. We established 1000 instances to run with different parameters of congestion and weather defined by the seed of the problem. We juxtaposed the performance of our proposed algorithms with the static method. In the static method, the same algorithm was used without utilizing the learned information from the white box. In other words, it assumes that \(\pi(n_{i})=1,\forall i\in V\). This approach allows for a thorough comparison.