# BPDM-GCN: Backup Path Design Method Based on Graph Convolutional Neural Network
## 4 Backup Path Design Method Based on BPDM-GCN
### Data Transmission Path Optimization Algorithm Based on BPDM-GCN
To maintain vector scale consistency following multi-layer matrix transformations, matrix \(A\) undergoes normalization, \(\hat{A}=D^{-\frac{1}{2}}(D-A)D^{-\frac{1}{2}}\). \(D\) is the degree matrix of matrix \(A\). (2) Action mapping: The action strategy generated by the GCN-based DDPG algorithm after iterative training based on state \(s_{t}\) and reward value \(r_{t}\) is represented as \(action=\left[a_{w_{1,2}},a_{w_{1,3}},\cdots,a_{w_{ij}}\right]\). The action value \(a_{w_{ij}}\) in the set represents the link weight of link \(e_{i_{j}}\). (3) Reward value mapping: The reward value represents the feedback of the agent based on the corresponding action \(a_{t}\) made according to state \(s_{t}\). The BPDM-GCN algorithm is optimized to minimize phasor data transmission delay, low bandwidth occupancy, and low packet loss rate. The phasor data transmission delay, bandwidth occupancy, and packet loss rate are standardized and utilized as the foundation for the reward value calculation. The reward value calculation process is illustrated in Equation (7). \[reward=\alpha*Delay^{\prime}\left(p_{s,d}\right)+\beta*Occupancy\left(path_{s,d }\right)+\delta*Loss\left(path_{s,d}\right) \tag{7}\]  
In Equation (7), the reward factor parameter is designated as \(\alpha,\beta,\delta\in(0,1),\alpha+\beta+\delta=1\). The value of parameter \(\alpha,\beta,\delta\) is determined by the relative importance of phasor data transmission delay, link occupancy rate, and packet loss rate within the network topology. In this paper, the values of parameters \(a\), \(b\), and \(\delta\) are set to 0.4, 0.4, and 0.2, respectively. In order to ensure the reliability of the backup path designed in the communication network of the wide-area measurement system, this paper proposes an improved DDPG algorithm based on the GCN. The detailed procedure is shown in Algorithm 1. ```
Input: Link state eigenvector matrix \(E\in R^{I*C}\) and structural adjacency matrix \(A\in R^{I*f}\) Output: Link \(e_{i,j}\) weight \(w_{e_{i,j}}\) 1. Initialize \(\theta^{\mu}\), \(\theta^{U^{\prime}}\), \(\theta^{Q}\), \(\theta^{Q^{\prime}}\) and \(D\) 2. For episode = 1, \(M\) do: 3. Initialize \(s_{1}\leftarrow\) Initalize noise strategy \(\aleph\) 4. For \(t\) = 1, \(T\)do 5. Select action \(a_{t}\)=\(\mu(s_{t}|\theta^{\mu})\) according to the current policy 6. \(\hat{A}=D^{-\frac{1}{2}}(D-A)D^{-\frac{1}{2}}\) 7. \(H_{1}=\text{RrLU}\big{[}\hat{A}(\xi E)W_{0}\big{]}\) 8. \(Z=\text{soft}\max\big{(}\hat{A}\text{ReLU}\big{[}\hat{A}(\xi\varepsilon)W_{0} \big{]}W_{1}\big{)}\) 9. Obtain \(r_{t}\) and \(s_{t+1}\) 10. Store transition \((s_{t},a_{t},r_{t},s_{t+1})\) in \(D\) 11. Sample a random mini batch of \(N*(s_{t},a_{t},r_{t},s_{t+1})\) from \(D\) 12. Calculate target return value \(y_{t},y_{t}=r_{t}+\gamma Q^{\prime}\Big{(}s_{t+1},\mu^{\prime}\Big{(}s_{t+1} \Big{|}\theta^{U^{\prime}}\Big{)}\Big{|}\theta^{Q^{\prime}}\Big{)}\) 13. \(L=\frac{1}{N}\sum_{i}\big{(}y_{t}-Q\big{(}s_{t},a_{t}|\theta^{Q}\big{)}\big{)}^ {2}\) 14. \(\
abla_{\theta^{U^{\prime}}}G(\mu_{\theta^{U^{\prime}}})\approx\frac{1}{N}\sum _{i}\
abla_{A}Q\left(s,a|Q^{\prime}\right)|_{s=s_{t},a=(s_{t})}\
abla_{\theta^ {U^{\prime}}}\mu(s|\theta^{U})|s_{t}\) 15. \(\theta^{Q^{\prime}}\leftarrow\tau\theta^{Q}+(1-\tau)\theta^{Q^{\prime}}\) 16. \(\theta^{U^{\prime}}\leftarrow\tau\theta^{U^{\prime}}+(1-\tau)\theta^{U^{\prime}}\) 17. End for 18. End for
```  
**Algorithm 1**DDPG algorithm flow improved based on GCN  
In Algorithm 1, the initial step initializes variables \(\theta^{\mu}\), \(\theta^{U^{\prime}}\), \(\theta^{Q}\), and \(\theta^{Q^{\prime}}\). Subsequent lines 2-16 outline the training and parameter update procedures of the DDPG algorithm enhanced with GCN. Specifically, lines 5-9 delineate the process of updating GCN neural network parameters, states, actions, and reward values during interactions between the algorithm and its environment. Line 10 involves storing information \((s_{t},a_{t},r_{t},s_{t+1})\) within the experience replay pool \(D\).