## 3 Materials and Methods
### MILP Model  
A MILP model is formulated for AI service-oriented dynamic, collaborative computational resource scheduling problem based on distributed model training in the ECFN of the smart grid. Firstly, parameter definitions of MILP are introduced in detail. For constant parameters, a respective set of edge suppliers and a set of edge data centers are denoted as \(S\) and \(E\). The respective set of users and set of different types of AI services are indicated as \(U\) and \(R\), where \(k\in U\), and \(f\in R\). Moreover, \(\epsilon\) is defined as the backlog threshold of distributed model training tasks in an edge data center. For input variables, respective computing processing capacity (GOPS) and cost ($) for the \(j\)-th edge data center of \(i\)-th edge supplier are denoted as \(C_{i,j}\) and \(N_{i,j}\), where \(i\in S\) and \(j\in E\). Respective \(B^{k,f}\) and \(M^{k,f}\) indicate requested computing resources (GOPS) and payment ($) for the \(k\)-th user's \(f\)-th distributed model training tasks of AI service, where \(k\in U\) and \(f\in R\). \(P^{k,f}\) indicates the complaint rate of the distributed model training task, which is a statistical value. \(D_{i,j}\) indicates the remaining amount of computing resources that can be complained about in the \(j\)-th edge data center of \(i\)-th edge supplier. For decision variables, we define a Boolean variable of \(A^{l,k,f}_{i,j}\). If the requested computational resources of \(k\)-th user's \(f\)-th type of distributed model training task are assigned to the \(j\)-th edge data center of \(i\)-th edge supplier in \(t\)-th time frame, \(A^{t,k,f}_{ij}\) equals 1. \(\sigma^{t}_{ij}\) defines the backlog of computing tasks from \(j\)-th edge data center of \(i\)-th edge supplier in \(t\)-th time frame. \(X^{t}_{i,j}\) is defined as a Boolean variable. If the \(j\)-th edge data center of \(i\)-th edge computing resource supplier is used in \(t\)-th time frame, \(X^{t}_{i,j}\) equals 1. The respective constant parameters, input variables, and decision variables are given in Tables 1-3. Then, the ultimate goal of the proposed MILP is to maximize the total profit of AI service providers and minimize the backlog of distributed training tasks, as formulated \begin{table}
\begin{tabular}{p{142.3 pt} p{142.3 pt}} \hline \hline
**Parameters** & **Descriptions** \\ \hline \(S\) & Set of edge computing resource suppliers, \(i\in S\). \\ \hline \(E\) & Set of edge data centers, \(j\in E\). \\ \hline \(U\) & Set of computing resource request users, \(k\in U\). \\ \hline \(R\) & Set of different types of AI services requested by computing service request users, \(f\in R\). \\ \hline \(\varepsilon\) & Backlog threshold of AI-distributed model training tasks in the edge data center (GOPS). \\ \hline \(N_{max}\) & A very large positive integer. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Constant parameters. \begin{table}
\begin{tabular}{p{142.3 pt} p{142.3 pt}} \hline \hline
**Parameters** & **Descriptions** \\ \hline \(C_{i,j}\) & Computing resource processing capacity of \(j\)-th edge data center for \(i\)-th computing resource supplier (GOPS), \(i\in S,j\in E\). \\ \hline \(N_{i,j}\) & Computational processing cost of \(j\)-th edge data center for \(i\)-th computing resource supplier (Yuan/GOPS), \(i\in S,j\in E\). \\ \hline \(B^{k,f}\) & Edge computing service request for \(k\)-th user’s \(f\)-th type AI service request (GOPS), \(k\in U,f\in R\). \\ \hline \(M^{k,f}\) & Payment for data computing service of \(f\)-th type of AI service for \(k\)-th computing service request user (Yuan/GOPS), \(k\in U,f\in R\). \\ \hline \(p^{k,f}\) & Complaint rate of AI-distributed model training tasks for \(f\)-th type of AI service from \(k\)-th computing service request user (statistical value), \(k\in U\), \(f\in R\). \\ \hline \(D_{i,j}\) & The remaining amount of AI-distributed model training tasks can be complained about in the \(j\)-th edge data center of \(i\)-th computing resource supplier (GOPS), \(i\in S,j\in E\). \\ \hline \hline \end{tabular}
\end{table}