# Freeway Traffic Congestion Reduction and Environment Regulation via Model Predictive Control
## 4 The Proposed Algorithm: MPC_CPDMO-NSGA-II
### Cpdmo-Nsqa-Ii
#### 4.2.1 Description of CPDMO-NSGA-II
Initial clusters and centers in \(G\) are set as individuals themselves; Step 2: For each cluster in \(G\), calculate Euclidean distance between any two centers of clusters, recorded it into distance matrix \(D\): \(D_{ij}=\sqrt{\sum\limits_{m=1}^{M}{{{{({x_{i}}^{m}-{x_{j}}^{m})}^{2}}}}}\), where \({x_{i}},{x_{j}}\in P_{t}\), which represents the moving direction of the individual in Pareto optimal set, \(i\
eq j=1,2,\ldots,pop\), \(m=1,2,\ldots,M\), \(m\) is the dimension of decision vector; _pop_ is the size of \(P_{t}\); Step 3: Merge two clusters having minimal distance; update centers \(R(k)_{t}^{m}=\frac{1}{{{|G|}}{{k_{t}^{m}}}}\sum\limits_{{x_{i}^{m}\in G|}{{k_{t }^{m}}}}{{x_{i}^{m}}}\), where \(k=1,2,\ldots,cnum\); and update distance matrix \(D\); Step 4: If the number of clusters in \(G\) exceeds \(cnum\), then repeat Step2-Step3. In the proposed CPDMO-NSGA-II algorithm, the sub-algorithm 2 realized in Step 2.2.2, associate the individuals in the population is used to realize how to associate the individuals in the population and get reference lines \(\mathbf{RL_{t}}\), which consider the distribution performance and population diversity simultaneously. The sub-algorithm 2 is described as following:  
(3) Sub-algorithm 2: Associate the individuals in the population  
Step 1: Place the individuals of population \(P_{t}\) and reference point set \(R\) in rectangular coordinates, expressed as vector \(\mathbf{x_{t}}^{i},\mathbf{R_{j}}\), where \(i=1,2,\ldots,pop\), \(j=1,2,\ldots,n\), \(pop\) is the size of population \(P_{t}\), and \(n\) is the number of reference points, \(\mathbf{x_{t}}^{i}\) represents the _ith_ vector predicted at time \(t\);  
Step 2: If environment first changes, initialize reference lines \(\mathbf{RL_{o}}=\left\{\mathbf{x_{t}}^{i},\mathbf{R_{j}}\right\}\), then go to Step 4;  
Step 2.1: For each individual \(\mathbf{x_{t}}^{i}\) in \(P_{t}\), calculate the cosine of angles between \(\mathbf{x_{t}}^{i}\) and each reference point \(\mathbf{R_{j}}\): \(\cos\alpha_{ij}=\frac{\mathbf{x_{t}}^{i}\cdot\mathbf{R_{j}}}{|\mathbf{x_{t}}^{i}|\left| \mathbf{R_{j}}\right|}\);  
Step 2.2: Connect \(\mathbf{x_{t}}^{i}\) and \(\mathbf{R_{j}}\) having minimal angles \(\alpha_{ij}\) (or \(\cos\alpha_{ij}\) is maximal, see Figure 5a): \(\mathbf{RL_{t}}^{k}=\left\{\mathbf{x_{t}}^{i},\mathbf{R_{j}}^{i}\right\}\), where \(k=0,1,\ldots,K\), \(K\) is the number of reference lines;  
Step 3: If not, update reference lines merge \(\mathbf{RL_{t}}=\left\{\mathbf{x_{t}},\mathbf{Rx}\right\}\), then go to Step 4;  
Step 3.1: For each individual \(\mathbf{x_{t}}^{i}\) in \(P_{t}\), calculate the distances \(d_{ik}\) between \(\mathbf{x_{t}}^{i}\) and each current reference point \(\mathbf{RL_{t}}^{k}\): i.e., \(d_{ik}=\left|\overrightarrow{P_{t}}^{i}-R_{j}\overrightarrow{Q_{t-1}}^{i} \cdot\frac{\left(\overrightarrow{R_{j}}^{i}\cdot R_{j}\overrightarrow{Q_{t-1 }}^{i}\right)}{\left|\overrightarrow{R_{j}}\overrightarrow{Q_{t-1}}^{i} \right|^{2}}\right|\). Step 3.2: Connect \(\mathbf{x_{t}}^{i}\) and corresponding reference point having minimal distance (see Figure 5b), and \(\mathbf{x_{t}}^{i}\) is associated with historical individual \(Q_{t-1}\) on historical reference line \(\mathbf{RL_{t-1}}\). (see Figure 5c)  
Step 4: Save reference lines \(\mathbf{RL_{t}}=\left\{\mathbf{x_{t}},\mathbf{Rx}\right\}\). In general, reference points are uniformly distributed on a hyperplane. Reference point set \(R\) is set as follows [25]:  
\[R:\left\{ \begin{array}{c}R_{j}=\left\{R_{j}^{1},R_{j}^{2},\ldots,R_{j}^{m} \right\}\\ \\ R_{j}^{m}\in\left[0/p,1/p,\ldots,p/p\right],\end{array} \right.\begin{array}{c }R_{j}=\left\{R_{j}^{1},R_{j}^{2},\ldots,R_{j}^{m}\right\}\\ \\ \left.\left.\left.\left.\left.\left.\left.\left.\left.\left. where \(j=1,2,\ldots,n\), \(n\) is the number of reference points, \(n=\left( \begin{array}{cc}M+p-1\\ p\end{array} \right)\); \(m=1,2,\ldots,M\), \(M\) is the dimension of reference points, \(p=M\). Normally, set \(n\approx pop\), \(pop\) is the size of population.