# Topology Optimisation under Uncertainties with Neural Networks
## 3 Neural Network Architectures
### Topology Convolutional Neural Networks (TCNN)
#### 3.1.2 Data Preparation
```
Input: mesh \(\mathcal{T}_{0}\), \(\mathcal{T}_{const}\) and initial values \(\varphi_{0}\) sequence \(c_{m}\in\mathbb{N}\) and \(j=0\in\mathbb{N}\) for\(m=0,1,\ldots\)until convergeddo for\(n=0,1,\ldots\)until convergeddo solve state equation on mesh \(\mathcal{T}_{m}\Rightarrow u_{n+1}\) if\(j=c_{m}\)then interpolate \(\varphi_{n}\) onto \(\mathcal{T}_{\text{const}}\) project \(u_{n+1}\), \(\varphi_{n}\) to \(\mathbb{R}^{d+1\times H\times W}\) evaluate \(\mathcal{N}_{\text{CNN}}^{k}(\varphi_{n},u_{n+1};\theta)\) as performed in Equation (21) \(\Rightarrow\)\(\varphi_{n+k}\) project \(\varphi_{n+k}\) to \(\mathcal{T}_{\text{const}}\) interpolate \(\varphi_{n+k}\) onto \(\mathcal{T}_{m}\)\(j=1\) else solve adjoint equation on mesh \(\mathcal{T}_{m}\Rightarrow\)\(p_{n+1}\) solve gradient equation on mesh \(\mathcal{T}_{m}\Rightarrow\)\(\varphi_{n+1}^{n}\) project \(\varphi_{n+1}^{*}\) to \([0,1]\Rightarrow\)\(\varphi_{n+1}\)\(j=j+1\) end if
1
2 end for
3
4 adapt mesh according to Appendix B\(\Rightarrow\)\(\mathcal{T}_{m+1}\)
5 end for
```  
**Algorithm 1**Deterministic optimisation algorithm with TCNN approximated gradient step```
Input: mesh \(\mathcal{T}_{0}\), \(\mathcal{T}_{\text{const}}\) and initial values \(\varphi_{0}\), sequence \(c_{m}\in\mathbb{N}\) and \(j=0\in\mathbb{N}\) for\(m=0,1,\ldots\)until convergeddo for\(n=0,1,\ldots\)until convergeddo for\(i=1,\ldots,N\)do  sample \(g(\omega_{i}),\lambda_{mat}(\omega_{i}),\mu_{mat}(\omega_{i})\)  solve state equation on mesh \(\mathcal{T}_{m}\Rightarrow u_{n+1}(\omega_{i})\)  solve adjoint equation on mesh \(\mathcal{T}_{m}\Rightarrow p_{n+1}(\omega_{i})\) if\(j=c_{m}\)then  interpolate \(\varphi_{n}(\omega_{i})\) onto \(\mathcal{T}_{\text{const}}\)  project \(u_{n+1}(\omega_{i}),\varphi_{n}(\omega_{i})\) to \(\mathbb{R}^{d+1\times H\times W}\)  evaluate \(\mathcal{N}_{\text{CNN}}^{\text{}}(\varphi_{n}(\omega_{i}),u_{n+1}(\omega_{i} );\theta)\) as performed in Equation (21) \(\Rightarrow\varphi_{n+k}(\omega_{i})\)  project \(\varphi_{n+k}(\omega_{i})\) to \(\mathcal{T}_{\text{const}}\)  interpolate \(\varphi_{n+k}(\omega_{i})\) onto \(\mathcal{T}_{m}\) \(j=1\) else  solve gradient equation on mesh \(\mathcal{T}_{m}\Rightarrow\varphi_{n+1}^{*}(\omega_{i})\)  end if  end for  compute the mean \(\hat{\varphi}_{n+1}=\frac{1}{N}\sum_{i=1}^{N}\varphi_{n+1}^{*}(\omega_{i})\)  project \(\hat{\varphi}_{n+1}\) to \([0,1]\Rightarrow\varphi_{n+1}\)  adapt mesh according to Appendix B\(\Rightarrow\mathcal{T}_{m+1}\) \(j=j+1\)  end for  adapt mesh according to Appendix B\(\Rightarrow\mathcal{T}_{m+1}\)  end for
```

**Algorithm 2**Stochastic optimisation algorithm with TCNN approximated gradient step

### Topology Long Short-Term Memory Neural Networks (TLSTM)

One possible approach to improve the prediction of \(\varphi_{n}\) using an NN is to provide the classifier not just one tuple \((\varphi_{n},u_{n+1})\) as an input, but to have it process a larger amount of information by a sequence of these tuples of the last \(T\in\mathbb{N}\) iteration steps, i.e.,

\[\Big{(}(\varphi_{n-T},u_{n-T+1}),(\varphi_{n-T+1},u_{n-T+2}),\ldots,(\varphi_{ n},u_{n+1})\Big{)}.\]

Through this, the shift of the phase field or the change of the topology \(\varphi_{n}\) over time is also transferred as input to the NN. The sequence prediction problem considered in this case differs from the single step time prediction in the sense that the prediction target is now a sequence that contains both spatial and temporal information. Theoretically, this information can also be learned directly from the NN. However, in practice it is more effective to adapt the architecture to the information we have in advance (in our case with respect to the time dependency) to achieve better results. An NN that allows exactly this is a recurrent Neural Network (RNN). Unfortunately, standard RNNs often suffer from the vanishing gradient problem [19; 20] which we try to prevent from the beginning.