## 3 Problem Description
### Modified Kernel Function
\[\mathbf{D}=d_{ij}=\{||f^{-1}(x_{i})-f^{-1}(y_{j})||\} \tag{16}\]  
Since the goal is to find the permutation that minimizes the distance between wells in the two samples, the problem can be expressed as finding the permutation of rows (or columns) that minimizes the trace of matrix \(\mathbf{D}\), shown in Table 2, which has complexity \(O(N!)\). Since permutation invariance only affects injectors and producers separately, the problem can be reduced to the two counterparts, i.e., finding the right ordering of the injectors which has complexity \(O(m! )\) and finding the right ordering of the producers with complexity \(O(n!)\). This is a very well-known problem in the literature called the assignment problem. Algorithm A1 (Appendix A), known as the Hungarian method [66], or Munkres algorithm [67], is commonly utilized to reduce its complexity to the order of \(O(N^{3})\), or in our case, \(O(m^{3})+O(n^{3})\), saving valuable computational time. Algorithm 2, describing the full Kernel modification, is shown below. ```
Input: Modified input space Output: Modified kernel function FunctionGenerateDistanceMatrix(Modified input space):  Calculate the inverse mapping \(f^{-1}\) for each sample in the modified input space using the 1-1 dictionary values produced from Algorithm 1;  Initialize an empty distance matrix; for each pair of samples \(\mathbf{x}_{i}\) and \(\mathbf{y}_{j}\)do  Define \(f^{-1}(\mathbf{x}_{i})\) and \(f^{-1}(\mathbf{y}_{j})\) as the inverse mappings of \(\mathbf{x}_{i}\) and \(\mathbf{y}_{j}\) respectively;  Calculate the Euclidean distance \(d_{ij}\) using the inverse mapping:  Store \(d_{ij}\) in the distance matrix;  end for returnDistance matrix; FunctionHungarianMethod(Distance matrix):  Use the Hungarian method A1 to find the optimal permutation ordering that minimizes the trace of the distance matrix; returnOptimal permutation ordering; FunctionModifiedKernel(Distance matrix, Optimal permutation ordering):  Calculate the modified kernel function using the optimal permutation ordering; returnModified kernel function;
```  
**Algorithm 2**Covariance calculation. \begin{table}
\begin{tabular}{c|c c c c} \hline  & \(y_{1}\) & \(y_{2}\) & \(y_{n}\) \\ \hline \(x_{1}\) & \(d_{11}\) & \(d_{12}\) & \(\cdots\) & \(d_{1n}\) \\ \(x_{2}\) & \(d_{21}\) & \(d_{22}\) & \(\cdots\) & \(d_{2n}\) \\ \(\vdots\) & \(\vdots\) & \(\vdots\) & \(\ddots\) & \(\vdots\) \\ \(x_{n}\) & \(d_{n1}\) & \(d_{n2}\) & \(\cdots\) & \(d_{nn}\) \\ \hline \end{tabular}
\end{table} 
Table 2: Distance matrix \(\mathbf{D}\). The modified kernel function is represented by a functional form, \(k(\mathbf{x},\mathbf{y})=k(\min_{m}||\)\(f^{-1}(\mathbf{x})-f^{-1}(\mathbf{P}_{m}\mathbf{y})||)\), where \(\mathbf{P}_{m}\) denotes the permutation matrix. This functional form introduces significant non-linearity, due to the involvement of inverse mapping \(f^{-1}\) and permutation matrix \(\mathbf{P}_{m}\). This non-linearity poses challenges in directly establishing a proof of satisfaction of Mercer's conditions, which typically rely on simpler, more linear forms of kernel functions. However, despite the inherent complexity introduced by the functional form, extensive sampling efforts across a large number of input samples consistently yield a positive semidefinite covariance matrix. This empirical observation is crucial, as it provides compelling evidence supporting the validity of the modified kernel function. To elaborate, the positive semi-definite covariance matrix implies that the resulting kernel function preserves important properties required for Mercer's conditions, such as symmetry and non-negativity. The positive semi-definite nature of the covariance matrix indicates that any linear combination of kernel evaluations over the sampled inputs remains non-negative, thus aligning with the requirements of [PERSON]'s theorem.