# Topology Optimisation under Uncertainties with Neural Networks
## 3 Neural Network Architectures
### Topology Convolutional Neural Networks (TCNN)
#### 3.1.2 Data Preparation
\begin{bmatrix}\varphi_{n-5}&u_{n-5+1}^{x}&u_{n-5+1}^{y}\\ &\vdots&\\ \varphi_{n}&u_{n+1}^{x}&u_{n+1}^{y}\end{bmatrix} \mapsto \begin{bmatrix}\varphi_ {n+1}\\ \vdots\\ \varphi_{n+10}\end{bmatrix} \]

_for \(\varphi_{n}\in\mathbb{R}^{|V(\mathcal{T}_{m})|}\) and \(u_{n}=(u_{n}^{x},u_{n}^{y}),\ u_{n}^{x},u_{n}^{y}\in\mathbb{R}^{|V(\mathcal{T }_{m})|}\) defined on mesh \(\mathcal{T}_{m}\)._

The TLSTM from Example 4 can directly be integrated into Algorithm A1 as with the previous integration with Algorithm 1. In fact, since in Algorithm A1 only the most recent gradient step is relevant, in practice we restrict the inverse mapping on the last element of the predicted sequences to save calculation time. The only difference is that the sequences \(\varphi_{n-T},\ldots,\varphi_{n}\) and \(u_{n-T+1},\ldots,u_{n+1}\) have to be stored in a list. We chose \(c_{1}=125\) and \(c_{m}=50\) for all \(2\leq m\in\mathbb{N}\). This procedure is described in Algorithm 3. As in the case of the TCNN, we are able to include the extra sample dimension \(S\) to approximate gradient steps from multiple problems at once. ```
Input: mesh \(\mathcal{T}_{0}\), \(\mathcal{T}_{\text{const}}\), initial values \(\varphi_{0}\), sequence \(c_{m}\in\mathbb{N}\) and \(j=1,T\in\mathbb{N}\) and list \(L=[\varphi_{0}]\) 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}\) add \(u_{n+1}\) to \(L\) if\(j=c_{m}\)then  interpolate \(\varphi_{n-T},\ldots,\varphi_{n}\) and \(u_{n-T1},\ldots,u_{n+1}\) on to \(\mathcal{T}_{\text{const}}\) project \(\varphi_{n-T},\ldots,\varphi_{n}\) and \(u_{n-T+1},\ldots,u_{n+1}\) on to \(\mathcal{T}_{\text{const}}\) to \(\mathbb{R}^{T\times d+1\times H\times W}\) evaluate \(\mathcal{N}_{\text{LSTM}}^{\mathcal{T}}(\varphi_{n-T},\ldots,\varphi_{n},u_{ n-T+1},\ldots,u_{n+1};\theta)\) as performed in Equation (31) \(\Rightarrow\)\(\varphi_{n}\ldots\varphi_{n+T}\) project \(\varphi_{n+T}\) to \(\mathcal{T}_{\text{const}}\) interpolate \(\varphi_{n+T}\) onto \(\mathcal{T}_{m}\) declare list and add \(\varphi_{n+T}\Rightarrow L=[\varphi_{n+T}]\) \(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}^{*}\) project \(\varphi_{n+1}^{*}\) to \([0,1]\Rightarrow\varphi_{n+1}\) add \(\varphi_{n+1}\) to \(L\) \(j=j+1\) end if  end for declare list \(L\) \(j=1\)  adapt mesh according to Appendix B\(\Rightarrow\)\(\mathcal{T}_{m+1}\)  end for
```

**Algorithm 3**Deterministic optimisation algorithm with TLSTM approximated gradient step

## 4 Results

This section is devoted to numerical results of the two previously described neural network architectures. The implementations were conducted with the open source packages PyTorch[18] for the NN part and FEniCS[24] for the FE simulations (see introduction for the link to the code repository). We first illustrate the performance of the TCNN in Section 4.1 with a deterministic bridge example compared to a classical optimisation. The important observation is that with the TCNN the optimisation can be carried out with far fewer optimisation steps while still leading to the reference topologies from [1]. Similar results can be observed for the risk-averse stochastic optimisation. In Section 4.2, numerical experiments of the TLSTM architecture are presented. The performance is revealed to be comparable to the TCNN architecture and the optimisation appears to be more robust with respect to the data realisations. ### TCNN Examples

Before we can use the TCNN architecture for the optimisation in Algorithm 1, we have to train it on data that describe the system response of Equation (6). Note that it would not be useful to allow the \(\mathcal{N}_{\text{CNN}}\) to learn the gradient steps of a fixed setting since different settings of the bridge problem from Appendix A.1 should efficiently be tackled.