## Abstract

Without an explicit formulation to minimize support structures, topology optimization may create complex shapes that require an intensive use of support material when additively manufactured. We propose a neural network-based approach to topology optimization that aims to reduce the use of support structures in additive manufacturing. Our approach uses a network architecture that allows the simultaneous determination of an optimized: (1) part segmentation, (2) the topology of each part, and (3) the build direction of each part that collectively minimize the amount of support structure. Through training, the network learns a material density and segment classification in the continuous 3D space. Given a problem domain with prescribed load and displacement boundary conditions, the neural network takes as input 3D coordinates of the voxelized domain as training samples and outputs a continuous density field. Since the neural network for topology optimization learns the density distribution field, analytical solutions to the density gradient can be obtained from the input–output relationship of the neural network. We demonstrate our approach on several compliance minimization problems with volume fraction constraints, where support volume minimization is added as an additional criterion to the objective function. We show that simultaneous optimization of part segmentation along with the topology and print angle optimization further reduces the support structure, compared to a combined print angle and topology optimization without segmentation.

## 1 Introduction

Additive manufacturing has become a popular method of manufacturing topology optimized components. Depositing materials layer by layer, additive manufacturing can manufacture topology optimization designs that are challenging or impossible for traditional subtractive machining. However, additive manufacturing requires support structures for overhang regions, which are common in the resulting shapes of topology optimization designs. Support structures require additional materials that do not contribute to the final product while taking up extra time during fabrication. Moreover, extra effort is required to remove support material afterward. It is possible to reduce support material without modifying the topology by reorienting the print direction or segmenting the part into smaller components [1]. However, this approach is limited to the extent that it can eliminate support material. Simultaneously optimizing build orientation and segmentation with the part’s topology could result in further elimination of support structures.

Previously, optimization for reducing support structures has been implemented in both solid isotropic material with penalization (SIMP), level-set method [2,3], and part consolidation [1]. Wang and Qian further developed the SIMP-based method by adding simultaneous build orientation optimization [4]. While overhang surfaces occur at the boundary of geometry, Heaviside projection is required to push SIMP results closer to 0 and 1 for a clear boundary. Chandrasekhar and Suresh’s work on neural network-based topology optimization demonstrated the possibility of direct topology optimization using neural network [5]. A neural network is a universal function approximator. The SIMP density field can be directly represented by neural network activation functions with the additional benefit of a crisp and differentiable boundary. Nie et al. demonstrated that print orientation optimization for each subassembly obtained after part decomposition can provide a greater reduction in support structure compared to print direction optimization for the large part [1]. Support structures may be further reduced by adding segmentation to the simultaneous print direction and overhang optimization. We develop upon the neural network approach used by Chandrasekhar and Suresh and extend Wang and Qian’s method of overhang detection, to achieve concurrent build direction, part segmentation, and topology optimization to reduce support structures.

Our approach combines print direction, segmentation, and topology optimization through a modular framework using neural networks. Within this modular framework, topology and segmentation is handled through radial basis function neural networks (RBNN) whereas print direction is determined through a single layer perceptron which serves as an optimizer that fits within the modular neural network framework. This modular neural network architecture allows combined optimization by selectively turning on and off different modules. The RBNN learns a density field for which it receives 3D coordinates as input and outputs density values. From this input–output relationship, we can obtain an analytical solution to the density gradient which directly correlates to the surface gradient used for overhang minimization. Finally, through combined build direction, segmentation, and topology optimization, we achieve superior results compared to previous methods.

The implementation of this work can be found at online.^{2}

Our main contributions are as follows:

An analytical solution to the density gradient obtained from the input–output relationship of the neural network.

Combined build direction, part segmentation, and topology optimization.

A modular neural network architecture that allows combined optimization and selectively turning on and off different modules.

## 2 Related Work

Our review focuses on studies that highlight additive manufacturing oriented topology optimization and integration of machine learning and topology optimization.

*Support structure minimization*. A large body of work has investigated overhang edge detection and penalization for support structure minimization. Thompson et al. [6] explored support structures and their relationship to additive manufacturing costs and opportunities. Brackett et al. [7] first explored an approach to penalize overhang edges through edge detection in 2D. Several studies inferred surface gradients through approximation based on near neighbors. Leary et al. [8] created self-supporting structures with boundaries obtained through four or eight element connectivity. Overhang edges can also be obtained by scanning elements below. Gaynor and Guest [9] demonstrated the detection of three sets of overhang angles. Mhapsekar et al. [10] also used neighbor detection with additional height penalty. Overhang regions can also be excluded from layer-wise filtering [11]. Ven et al. [12] used front propagation to detect overhang surfaces. Zhang et al. [13] created self-supporting structures through polygon modifications. Support structure placement can be minimized while reducing the residual stress [14]. Most aforementioned methods lack accurate density gradient calculation due to the discretized grid of topology optimization. More emphasis on improving the accuracy of the density gradient calculation had been made through later research. Using the level set method, overhang control can be implemented by calculating the topological derivative [3]. Liu and To [15] demonstrated using level set for toolpath simulation to consider both raster direction and build direction. Zhang et al. [16] introduced an extra constraint to remove boundary oscillations in the density gradient formulation. Qian et al. [2] used linear interpolation between nodes of finite element mesh to obtain a more accurate density gradient. With density gradient, self-supporting structures, boundary slope control, and print angle optimization have been added for simultaneous optimization with topology [4,17,18]. We base our overhang detection method on Wang and Qian’s work which integrates print angle from the vector dot product of the print angle with filtered density gradient with the distinction of (1) accurate, differentiable density gradient from the neural network which topology optimization is directly executed on and no filtering required and (2) additional height penalization which minimizes tall and slim support structures that increase the possibility of print failure.

*Print direction and manufacturability optimization*. Print direction is the direction in which a part is oriented during additive manufacturing. Chandrasekhar et al. [19] demonstrated the importance of print direction on structure performance by optimizing the print direction of fiber-reinforced additive manufactured components. Ulu et al. [20] trained a surrogate model from running FEA in different directions for which an optimal build orientation can be determined from gradient descent on surrogate model. Ulu et al. [21] also demonstrated the advantages of concurrent optimization of the total production cost. By small adjustment to the shape and print direction optimization, models can also be better suited for additive manufacturing [22]. Anisotropy of additive manufactured parts have also been integrated with segmentation to determine the segmentation and optimal print orientation [23]. Nie et al. [1] conducted optimization for minimum production cost considering part consolidation while demonstrating the tradeoff between no and full consolidation. Part layout, including rotation of each individual component, is optimized. Nie et al. demonstrated that for metal additive manufacturing, segmentation leads to a reduction in shadow volume. However, the topology of each component remains unchanged which motivates us to add part segmentation to our framework to further reduce shadow volume.

*Topology optimization with machine learning*. Both data-driven and real-time approaches have been explored for the application of topology optimization. Data-driven topology optimization aims to learn a neural network model from a database of topology optimization results which speeds up the process. Surrogate neural network model has been used for microstructure design [24]. Many other methods rely on convolutional neural networks (CNN) for their capabilities to learn from a large set of image data. Banga et al. [25] used a 3D encoder–decoder CNN to generate 3D topology results with a 4$%$ reduction in computation time. Behzadi and Ilieş [26] used deep transfer learning with CNN. Zheng et al. [27] used U-net CNN for 3D topology synthesis. Machine learning can also generate an initial guess for topology optimization to speed up the convergence [28]. More accurate synthesis can be achieved from generative adversarial networks based on physical fields over the initial domain [29]. U-Net was also used for improving the manufacturablity of designs for metal additive manufacturing [30]. CNN demonstrated the capabilities of rapid topology synthesis but CNN alone cannot guarantee the mechanical performance of the result. A real-time data-driven hybrid approach trained the neural network during optimization to learned optimization sensitivities to further accelerate topology optimization [31]. Chandrasekhar and Suresh [5] first explored a real-time approach where the neural network directly optimizes the density field of SIMP. It guaranteed the mechanical performance of topology optimization as the density field is parameterized by the weights of the neural network. Chandrasekhar and Suresh [32] also explored Fourier projection-based neural network for length scale control. Application of multimaterial topology optimization is also explored with a similar concept [33]. Multimaterial topology optimization is achieved with a multilayer perceptron with a softmax layer attached at the end which serves to assign the material to each segment. Chandrasekhar and Suresh’s [33] research demonstrated the benefit of a real-time neural network-based approach where boundaries can be differentiable. In our work, we further exploit this advantage for the application of minimizing overhang while leveraging the segmentation capabilities to partition the topology for print direction optimization of each individual segment.

## 3 Proposed Method

The goal of this work is to reduce the support structure for topology optimization through segmentation and print angle optimization. We decompose the functionality of generating topology, segmentation, and print angle for each segment into three modular neural networks (Fig. 1). These three modular networks enable us to selectively turn on and off different modules depending on the complexity of the problem. Using only topology neural networks, we can run standalone topology optimization similar to SIMP. While print angle optimization can be added for simultaneous print direction and topology optimization similar to Wang and Qian’s approach [4]. With segmentation added, concurrent optimization can be achieved. These three modules are linked together by a combined loss function. Backpropagation of the loss function into each module is handled by the machine learning package TensorFlow [34].

### 3.1 Neural Network.

The topology network *T*(**X**) learns a density field which is different compared to typical topology optimization which represents the density field as a finite element mesh. The topology neural network takes in 3D coordinates **X** = (*x*, *y*, *z*) as inputs and outputs the density value *ρ* at each coordinate point. The 3D coordinates represent the center of each element in the design domain. For standalone topology optimization, a batch of 3D coordinates that correspond to a 3D mesh grid is fed into the topology network. The output is then sent to the finite element analysis (FEA) solver. The solver outputs the compliance which is combined with volume fraction as a loss. The loss is then backpropagated to adjust the weight of each neuron of the topology network.

**X**is the 3D coordinate input,

**X**= (

*x*,

*y*,

*z*).

*σ*is the Sigmoid activation function. $bkernel$ is the bias of the RBNN layer. $K$ are kernels for the RBNN layer. $W$ are weights for the dense layer. $bdense$ is the bias for the dense layer.

*δρ*/

*δ*

**X**[34].

*δρ*/

*δ*

**X**is the analytical density gradient at each 3D coordinate input. Mathematically, $\u2207\rho $ can be derived from using chain rule by taking the derivative w.r.t. input

**X**,

*T*′(

**X**) =

*δρ*/

*δ*

**X**:

*S*(

**X**) is different from the topology network in two ways. First, the segmentation network second layer has the same number of neurons as the number of segments that is requested. Second, the final layer is a Softmax layer to guarantee partition of unity. The segmentation network can be formulated as

*s*(

*x*) is the Softmax operator $s(z)=ezi/\u2211l=1nezl$. Using chain rule, the derivative of

*S*(

**X**) with respect to input

**X**is

*i*,

*j*= 1, 2, …

*n*

_{segs}.

### 3.2 Topology Optimization.

**X**

_{passive}. We then use Eq. (9) to compute the L1 loss $Lpassive$ to force the density field within the passive region to be 0. Intuitively,

**X**

_{passive}should always be smaller than

**X**which reduces the memory burden on the GPU

**X**and mirrored input

**X**

_{mirrored}

### 3.3 Optimization for Additive Manufacturing.

The first step for overhang detection is to calculate the density gradient $\u2207\rho $. We obtain the analytical solution of the density gradient from the input–output relation of the neural network. We then follow the proposed algorithm for overhang detection from Wang and Qian [4]. We then add an additional height penalization to the overhang regions.

*α*which can be calculated from the boundary normal

**n**and the build direction

**b**. The overhang angle

*α*is defined as

*x*- and

*z*-axes

*R*

_{x}and

*R*

_{z}, respectively. An illustration for coordinate system and rotation definition is shown in Fig. 2(a). We use the following to convert it into build direction vector

**b**:

*β*set to 10 is used

### 3.4 Overhang Formulation With Height Penalization.

*y*-axis coordinates and then multiply with the Heaviside filtered density at each coordinate (Fig. 2(h))

**X**

_{y}coordinates with the overhang regions to obtain a height penalized overhang constraint (Fig. 2(i))

### 3.5 Loss Function.

*V** is an equality constraint. When

*α*

_{1}→ ∞, the equality constraint is satisfied. We assign a maximum value of 100 for

*α*

_{1}with initial value of 0 and gradually increase

*α*

_{1}every iteration. For the overhang constraint $H\alpha \xaf$, we do not target complete overhang removal.

*α*

_{2}gradually increases from 0 to 1 during training. For topology optimization,

*c*

_{0}is the initial compliance calculated on the design domain with the uniform volume fraction

*V**.

## 4 Results and Discussions

### 4.1 Validation.

We begin with comparing our neural network based optimization with SIMP. For the comparison, we set up SIMP using the same machine learning framework with the same cantilever beam boundary condition. The problem size is 40 × 20 × 8 elements. We only enable the topology network within our modular architecture. The difference is that we configured a one layer neural network with one constant as input and the number of elements within the design domain as output. This configures the neural network to just store the optimization variables similar to the print angle network design. When running the optimization, for the first 100 iterations, we use SGD as the optimizer and afterward we switch to Adam [37]. We run the optimization for 300 iterations.

We observe that compared to SIMP, the topology network converged to a similar compliance. We observe a benefit of using a neural network to learn a continuous density field is that it inherently prevents checkerboard patterns without needing filtering (Fig. 3(b)).

We also show for a 2D problem (cantilever beam with 0.3 volume fraction) that the KKT conditions are approximately satisfied with the neural network-based topology optimization approach (Fig. 4). The optimization objective in our case consists of compliance and volume fraction constraint violation. There are no other constraints and hence for approximately satisfying the KKT conditions, the gradient of loss with respect to the design variables (the trainable weights of the neural network in our case) needs to be approximately zero. Figures 4(d) and 4(e) show that the mean and standard deviation of the gradients of loss with respect to these trainable weights in the two layers gradually move towards zero as the iterations increase. We also show this for a fine solution (i.e., we change the scale of the first NN layer) (Fig. 4(f)) for the same problem. Hence, it can be said that KKT conditions are approximately satisfied in the neural network-based topology optimization approach.

### 4.2 Upsampling and Mini-Batch Using the Topology Neural Network.

**X**

_{upsample}by sampling at closer intervals within the original coordinates domain and obtain

*ρ*

_{upsample}from the topology network

We compare the compliance and runtime between running at 20 × 10 × 8 with 2 × upsampling with running at 40 × 20 × 16 resolution (Fig. 5). When comparing the runtime, running at the lower resolution takes 209 s while the higher resolution example takes 767 s, a 73$%$ reduction in runtime. When upsampling the lower resolution to the same resolution, the compliance is calculated to be 59$%$ higher. Running the optimization from a lower resolution and then upsampling it can be useful when a quick solution or preview of the optimization is desired while still maintaining acceptable structural performance.

There may be cases where topology optimization of high resolution geometries needs to be run. A mini-batch approach can be used here for alleviating the problem of high GPU memory usage. In the mini-batch approach, a small part of the geometry is updated in each epoch instead of the entire geometry, thus reducing GPU memory consumption. An example comparing the mini-batch and full-batch approaches is shown in Fig. 6, with the same boundary conditions as in Fig. 3 example, but with a higher resolution geometry. The mini-batches are formed by splitting up the part evenly in the *y*-direction. Four parts/batches are made in the given example, with each batch of 5400 voxels. The optimization is run for 300 epochs. The full-batch achieves a compliance of 21.94, while the mini-batch achieves a compliance of 24.77. Though the mini-batch optimization takes more time as FEA calculations for the entire geometry have to be performed for each batch, the maximum GPU memory required is significantly reduced. For the given example run on a Tesla T4 GPU, full-batch optimization took 7 min 8 s and required 5.74 GB GPU memory, while mini-batch optimization took 45 min 28 s and required 2.74 GB GPU memory.

### 4.3 Overhang Minimization.

With the promising result from running standalone topology optimization using only the topology network, we then enable the print direction network for simultaneous build direction and overhang optimization (Fig. 7(a)). With height penalization disabled, we can recreate the result from Wang and Qian albeit using a neural network to represent the topology with differentiable density gradients (Fig. 7(b)). We run two examples with both overhang region and print direction optimization enabled after 150 iterations to allow the geometry to first roughly converge. The critical overhang angle $\alpha \xaf$ is set to be 45°. One has height penalization enabled while the other is disabled to compare the effect of height penalization.

When comparing the result of these two examples, the compliance and optimal print direction are all similar. Both managed to significantly reduce the total overhang area. A noticeable distinction is that with the additional height penalty, the cantilever on the top has been removed (Fig. 7(a)). Despite being a very small overhang, its location is further away from the build plate which was removed with the addition of height penalization. When comparing the height-adjusted overhang penalization, our method manages a 94$%$ decrease in the total overhang regions.

### 4.4 Concurrent Build Direction, Part Segmentation, and Topology Optimization.

In the previous example, we demonstrated the effect of adding build direction into the optimization routine. We would like to further reduce the support structure for complex designs. We choose a simplified bike frame for this example. The boundary condition is shown in Fig. 8(a). Symmetry constraint is enforced on the design. We run three experiments with (1) standalone topology optimization, (2) simultaneous print angle and topology optimization, and (3) three segments with concurrent print angle and topology optimization. For the first 150 iterations, only topology optimization is enabled to obtain a rough geometry. Then for the experiment with segmentation enabled, we run 100 iterations with only print angle optimization enabled. This step is to prevent the topology and segmentation from converging faster than the print angle resulting in optimization being stuck at a suboptimal print angle. At 250 iterations, build direction, part segmentation, and topology optimization is enabled.

When comparing the result of the three experiments, we observed that with segmentation (Fig. 8(d)), the height penalized overhang is reduced by 30$%$ while compliance is smaller compared to without segmentation (Fig. 8(c)). Comparing to standalone topology optimization, our concurrent optimization managed to reduce height penalized overhang by 98.5$%$. With segmentation, the two segments in the rear can be laid flat on the build plate with fewer restrictions on its topology to further reduce overhang (Fig. 8(d)). While there is some small amount of overhang on the bottom of the front segment, the optimization still rotated the part such that support higher up the build plate is eliminated. Without segmentation, the second experiment also has overhang regions reduced but has higher compliance and more overhang (Fig. 8(c)). Due to the geometry of the bike frame, print angle optimization alone has limited effect.

To explore the relationship between overhang and support structure, we exported the geometry as stereolithography files and imported them into Cura with the optimized print direction applied [38]. We set the overhang angle to be $45\u2218$. The support structure is on the bottom of the part. We observe that almost all support material has been removed. We also demonstrate additional concurrent optimization examples in Fig. 9.

## 5 Limitations and Future Work

One concern with segmented parts is that it needs welding or assembly after printing. However, large components require segmentation to fit inside the build chamber already. Cost may also be a consideration to decide if the support structure reduced is worth the additional effort of piecing parts together. Nevertheless, we demonstrated with the addition of segmentation, support structures can be further reduced. We also observe that during the concurrent optimization of topology, segmentation, and print angle, the print angle has small oscillation. This is the result of using “min” operator when determining the lowest point of the part. Switching to p-norm to calculate the lowest point of the part may further improve optimization stability.

Currently one bottleneck for topology optimization using neural networks lies in the memory consumption during back propagation and hence very high resolution structures have not been presented in this paper. We show using mini-batches can potentially alleviate this issue and future work will explore creating a more robust and scalable framework.

The present work explored optimization for additive manufacturing. In the future, we plan to further develop upon the current framework by adding cost models to conduct optimization for manufacturing costs. With the cost model added, we can explore the cost related to the number of segments by accommodating the assembly cost. In the present work, the segmentation field requires an educated guess for initialization. This is due no penalizing disconnected islands within the segmentation network. A recent work by Zhou et al. [23] demonstrated segmentation with anisotropy modeled. We could incorporate material anisotropy into our framework not only to improve simulation accuracy for additive manufactured components but also reduce disconnected islands when performing segmentation. Currently, we treat the mating surface between each segment with the same mechanical performance while welding and assembly may alter the mechanical performance. Furthermore, subtractive machining constraints may be added from leveraging the continuous density field by the neural networks.

## 6 Conclusions

We present a framework for concurrent build direction, part segmentation, and topology optimization using neural networks that aim to reduce support structures. With only the topology network, we benchmark against SIMP and demonstrate that similar results can be obtained from using a neural network to learn the density field of topology optimization. When the print direction network is enabled, simultaneous print direction and topology optimization can be achieved. Detecting overhang regions and minimization can be done effectively using the analytical density gradient obtained from the input–output relationship of neural networks. Finally, with a bike frame example, we demonstrated the effectiveness of combined build direction, part segmentation, and topology optimization in reducing support structures.

## Footnotes

## Acknowledgment

This research was funded by Army Research Laboratory 50114.5.9.1130260. We would like to thank Krishnan Suresh and Aaditya Chandrasekhar for their insightful feedback. We also thank Sangjin Jung for help in problem formulation, data generation, and validation.

## Conflict of Interest

There are no conflicts of interest.

## Data Availability Statement

The data and information that support the findings of this article are freely available at online.^{3}