1 Introduction

In the class of direct energy deposition additive manufacturing processes, wire-arc additive manufacturing (WAAM) evolved into a promising alternative to common manufacturing processes like forging due to its large deposit rate, nearly limitless build size, and commonly available hardware (Williams et al. 2016). A wire is molten by an electrical or laser arc weld source and deposited in droplets onto a clamped substrate plate. The weld source can move freely around the workspace, building the desired workpiece layer by layer. If necessary, it can also move without welding, called transiting, but the required switch-off and switch-on of the weld source can produce condensation, reducing the quality of the workpiece. Next to this, the large temperature of the weld source has a significant effect on it. On the one hand, if the temperature of the already printed material is too high, it remelts when the next layer is processed, leading to deformations. On the other hand, high thermal gradients cause stress inside the workpiece, which results in strain or even cracks. Thus, controlling the temperature during the manufacturing process is crucial to achieving high-quality products.

The tool path planning problem for the considered process asks for a trajectory of the weld source such that material is deposited at all relevant places and the finished workpiece has the highest possible quality. Due to the high complexity of a whole workpiece consisting of many layers, we assume a single two-dimensional layer. We consider the tool path planning problem for the considered case as a split delivery vehicle routing problem (SDVRP), introduced by Dror and Trudeau (1990). Therein, a given fleet of vehicles must serve a set of customers, but every customer can be visited multiple times, delivering only a fraction of his demand. A survey about this problem class with theoretical properties and different solution methods is given by Archetti and Speranza (2008). Next to the trajectory of the weld source, the heat transmittance within the workpiece affects its temperature distribution. Thus, the heat equation (Fourier 1878) with suitable boundary conditions to describe radiation to the environment is incorporated, yielding a mixed-integer problem with partial differential equations (PDE) constraints (MIPDECO).

The solution of MIPDECO problems is challenging due to the combination of discrete decision variables with complex numerical discretization schemes. Several approaches were discussed in the literature. Hahn et al. (2022) use partial outer convexification to transform the discrete variables of a MIPDECO problem into binary variables and afterward solve its canonical continuous relaxation. The solution of the original problem with discrete variables can then be reconstructed by applying appropriate rounding algorithms. Furthermore, they show the convergence of their improved rounding techniques. Gnegel et al. (2021) presented a solution framework using a mixed-integer linear program (MILP), where the linear system, resulting from the discretization of the PDE, is solved for the basis of the control space in a preprocessing step. The effect of the PDE is then incorporated into the objective function. Vogt et al. (2022) formulate a MIPDECO problem for electromagnetic cloaking and describe a heuristic trust-region approach to solve it incorporating also uncertainty.

Considering WAAM, the research interest for the process parameters and the connected trajectory planning problem was constantly growing during the last years, as shown in the recent survey of Treutler and Wesling (2021). It gives a detailed overview of active research groups and the state-of-the-art for different materials and modeling approaches with the respective results. Due to the recency of this survey, we only mention some other recently published literature. Ferreira and Scotti (2021) proposed a modeling approach called pixels, where a bulky layer is represented by a grid of nodes and every node must be visited once. The resulting traveling salesman problem (TSP) is solved heuristically using a randomized greedy adaptive search to find a most continuous trajectory of minimal length, but temperature aspects are neglected in this procedure. For the case of multidirectional WAAM, Schmitz et al. (2021) presented a trajectory planning procedure incorporating the weld robot kinematic. The possible rotation of the workpiece during the process in their framework makes the trajectory planning more difficult since the slicing can be performed in an arbitrary direction. Thus, existing methods cannot be used efficiently. Zhang et al. (2020) generated for a bulky example geometry several trajectories by combining the zigzag and the contour-offset strategy to examine the influence of the weld trajectory on the residual stress for building a single layer while maintaining shape outline accuracy. Their study shows that with the combination of two common strategies, the residual stress can already be reduced.

We contribute to the state-of-the-art by formulating the trajectory planning problem for a single two-dimensional layer consisting of thin-walled parts and bulky regions as a MIPDECO problem. In the literature, geometries including only one of both types were studied (Diourté et al. 2021; Ferreira and Scotti 2021; Ma et al. 2019; Michel et al. 2019). For its solution, we follow the approach from Gnegel et al. (2021), transform the problem into a MILP by applying linear discretization schemes to the PDE constraints and show its applicability to the numerical solver IBM CPLEX in several computational experiments.

This paper is structured as follows. In Sect. 2, the heat conduction model is stated and its linearization is derived. The whole optimization model, consisting of path generation and temperature calculation, is then described in Sect. 3, next to possible objective functions. In Sect. 4, the performance of the model and its details are examined in several numerical experiments before we conclude and give directions for future work in Sect. 5.

2 Heat conduction model

To manufacture a three-dimensional workpiece, it is sliced horizontally to obtain the single layers. The following procedure must be carried out for each of them, but for more clarity, we consider a single two-dimensional layer with domain \(\Omega \subseteq \mathbb {R}^{2}\) throughout this article and omit an additional index referring to its horizontal layer slice. Defining a temperature function \({\theta :\Omega \times \left[ 0,T\right] \rightarrow \mathbb {R}}\) over \(\Omega \) for a given time interval \(\left[ 0,T\right] \), the two-dimensional heat conduction problem for one layer is formulated by

$$\begin{aligned} \frac{\partial \theta }{\partial t}(x,y,t)&= \alpha \left( \frac{\partial ^{2} \theta }{\left( \partial x\right) ^{2}}(x,y,t) + \frac{\partial ^{2} \theta }{\left( \partial y\right) ^{2}}(x,y,t) \right) \nonumber \\&\quad + q(x,y,t)\quad \forall (x,y)\in \Omega ,\quad t\in \left( 0,T\right] , \end{aligned}$$
(1a)
$$\begin{aligned} \frac{\partial \theta }{\partial \vec {n}}(x,y,t)&= \kappa ^{a}\left( \varphi ^{add} - \theta (x,y,t) \right) \quad \forall (x,y) \in \partial \Omega ,\quad t\in \left[ 0,T\right] , \end{aligned}$$
(1b)
$$\begin{aligned} \theta (x,y,0)&= \theta ^{init}(x,y) \quad \forall (x,y)\in \Omega , \end{aligned}$$
(1c)

with thermal diffusivity \(\alpha \in \mathbb {R}_{+}\), artificial cooling factor \(\kappa ^{a}\in \left( 0,1\right] \) and heat source \(q(x,y,t):\Omega \times [0,T]\rightarrow \mathbb {R}_{+}\). Note that (3a) neglects heat exchange by radiation within the layer.

A general description of the heat exchange at the boundary \(\partial \Omega \subseteq \Omega \) is taken from Hahn and Özisik (2012), maintaining energy conservation and incorporating convection and radiation. It is given by

$$\begin{aligned} \frac{\partial \theta }{\partial \vec {n}}(x,y,t)&= -\frac{h}{\lambda }\left( \theta (x,y,t) - \theta ^{amb}(x,y,t) \right) - \frac{\varepsilon \sigma }{\lambda } \left( \theta (x,y,t)^{4} - \theta ^{amb}(x,y,t)^{4} \right) \nonumber \\&\qquad \forall (x,y) \in \partial \Omega ,~\forall t\in \left[ 0,T\right] , \end{aligned}$$
(2)

with thermal conductivity \(\lambda \in \mathbb {R}_{+}\), heat transfer coefficient \(h\in \mathbb {R}_{+}\), total emissivity \(\varepsilon \in \mathbb {R}_{+}\), Stefan–Boltzmann constant \(\sigma \), and ambient temperature \(\theta ^{amb}:\Omega \times \left[ 0,T\right] \rightarrow \mathbb {R}_{+}\). To obtain a linear approximation scheme after discretization, the Rosseland approximation from Bähr et al. (2021) is applied to the non-linear radiation term in (2), resulting in the Robin boundary condition (1b) with cooling factor \(\kappa ^{a}\in \left[ 0,1\right] \) and additive constant \(\varphi ^{add}\in \mathbb {R}_{+}\).

Let \(\partial \Omega \subset \mathbb {R}^{2}\) be a Lipschitz boundary and the heat source function \(q\in L^{2}\left( \Omega \times [0,T]\right) \). Using domain decomposition (Quarteroni and Valli 1999), the given layer is split up into two different parts. On the one hand, there are thin-walled structures, which are an arrangement of single weld beads connected only at their end points. On the other hand, there are bulky regions, where an area must be filled with material. While the former ones are processed by tracking them and only the order of the segments remains to be determined, for the latter ones there is no information about the trajectory available. Every part of the layer can be assigned to exactly one of these two cases, thin-walled or bulky. Thus, this approach yields a domain decomposition of \(\Omega \) containing subdomains with non-overlapping interior. Let \(\Omega _{1}\subseteq \Omega \) denote the subdomain including all thin-walled structures, \(\Omega _{2}\subseteq \Omega \), the subdomain containing all bulky regions, \(\Gamma =\Omega _{1}\cap \Omega _{2}\) their common interface, and \(\vec {n}\in \mathbb {R}^{2}\) the outward normal vector. An example of this decomposition can be found in Fig. 1.

Fig. 1
figure 1

Domain decomposition of an example geometry. The thin-walled structures are collected in \(\Omega _{1}\) (red), while \(\Omega _{2}\) (blue) contains the bulky part

Then, the heat conduction problem (1) is transformed to

$$\begin{aligned} \frac{\partial \theta _{i}}{\partial t}(x,y,t)&= \alpha \left( \frac{\partial ^{2} \theta _{i}}{\left( \partial x\right) ^{2}}(x,y,t) + \frac{\partial ^{2} \theta _{i}}{\left( \partial y\right) ^{2}}(x,y,t) \right) + q(x,y,t)\nonumber \\&\qquad \forall (x,y)\in \Omega _{i},\quad i\in \{1,2\},\quad t\in \left( 0,T\right] , \end{aligned}$$
(3a)
$$\begin{aligned} \frac{\partial \theta _{i}}{\partial \vec {n}}(x,y,t)&= \kappa ^{a}\left( \varphi ^{add} - \theta _{i}(x,y,t) \right) \quad \forall (x,y) \in \partial \Omega \cap \partial \Omega _{i},~i\in \{1,2\},~t\in \left[ 0,T\right] , \end{aligned}$$
(3b)
$$\begin{aligned} \theta _{i}(x,y,0)&= \theta ^{init}(x,y)\quad \forall (x,y)\in \Omega _{i},\quad ~i\in \{1,2\}, \end{aligned}$$
(3c)
$$\begin{aligned} \theta _{1}(x,y,t)&= \theta _{2}(x,y,t) \quad \forall (x,y)\in \Gamma ,\quad t\in \left[ 0,T\right] , \end{aligned}$$
(3d)
$$\begin{aligned} \frac{\partial \theta _{1}}{\partial \vec {n}}(x,y,t)&= \frac{\partial \theta _{2}}{\partial \vec {n}}(x,y,t) \quad \forall (x,y)\in \partial \Gamma ,\quad t\in \left[ 0,T\right] . \end{aligned}$$
(3e)

The heat Eq. (3a) and the Robin boundary (3b) are now applied to the respective domains. In (3c), the given initial temperature distribution \(\theta ^{init}(x,y):\Omega \rightarrow \mathbb {R}_{+}\) is applied. To enable the connection between the heat conduction problems on every subdomain, the transmission conditions (3d), (3e) are applied, guaranteeing the equality of the solutions and energy conservation at the common interface.

To discretize (3a), different methods are applied to the two subdomains. Concerning \(\Omega _{2}\), we use the known velocity of the weld source while processing \(v^{w}\in \mathbb {R}_{+}\) and a chosen time step length \(\Delta t\in \mathbb {R}_{+}\) to cover it by a grid of squares with equal side length \(h=\min \{b^{w},v^{w}\Delta t\}\), where \(b^{w}\in \mathbb {R}_{+}\) is the width of one weld bead. Then, each square is identified by a node i placed at its center \((x_{i},y_{i})\in \mathbb {R}^{2}\) and collected in the set \(\mathcal {V}^{p}\). Let \(A=(a_{i,j})\in \mathcal {V}^{p}\times \mathcal {V}^{p}\) denote the adjacency matrix of all areas with \(a_{i,j}=1\) if and only if, the squares related to the nodes \(i,j\in \mathcal {V}^{p}\) have a common side. Furthermore, \(\partial \mathcal {V}^{p}\subset \mathcal {V}^{p}\) describes the set of nodes \(i\in \mathcal {V}^{p}\) whose related squares belong to \(\partial \Omega \cap \partial \Omega _{1}\). Using linear triangle elements, we apply a triangulation \(\mathcal {E}\) to the node set \(\mathcal {V}^{p}\) and set up a finite element method to approximate the solution of (3) on \(\Omega _{2}\) with nodes \(i\in \mathcal {V}^{p}\), elements \(e\in \mathcal {E}\), and boundary \(\partial \mathcal {V}^{p}\). The general triangle element is represented by its three corner points \(P_{1},P_{2},P_{3}\in \mathbb {R}^{2}\) with coordinates \((x_{i},y_{i})\), \(i=1,2,3\), oriented counterclockwise. It is displayed in Fig. 2.

Fig. 2
figure 2

The general triangle element

Let \(\psi ^{e}:\mathcal {V}^{p}\mapsto \{1,2,3\}\) denote the function assigning the global nodes to the corner points of the triangle element \(e\in \mathcal {E}\). According to the derivation by Taler and Ocłoń (2014), the solution of the finite element method for the problem (3a), (3b), (3c) with backward difference time scheme is given by

$$\begin{aligned} (M + \Delta t K)\vec {\theta }_{t+1} = \Delta t (\vec {q}_{t+1} \vec {f}^{H} + \varphi ^{add}\vec {f}^{R}) + M\vec {\theta }_{t}. \end{aligned}$$
(4)

Therein, the mass matrix \(M\in \mathbb {R}^{\vert \mathcal {V}^{p}\vert \times \vert \mathcal {V}^{p}\vert }\), the stiffness matrix \(K\in \mathbb {R}^{\vert \mathcal {V}^{p}\vert \times \vert \mathcal {V}^{p}\vert }\), load vectors \(\vec {f}^{H}\in \mathbb {R}^{\vert \mathcal {V}^{p}\vert }\) and \(\vec {f}^{R}\in \mathbb {R}^{\vert \mathcal {V}^{p}\vert }\), the nodal temperature vector \(\vec {\theta }\in \mathbb {R}^{\vert \mathcal {V}^{p}\vert }\), and the heat input vector \(\vec {q}\in \mathbb {R}^{\vert \mathcal {V}^{p}\vert }\) are required and must be calculated.

The three linear basis functions for the corner points of the general triangle are defined by

$$\begin{aligned} \varphi _{1}(x,y)&= \frac{1}{2A}\left( x_{2}y_{3}-x_{3}y_{2}+\left( y_{2}-y_{3}\right) x + \left( x_{3}-x_{2}\right) y\right) , \end{aligned}$$
(5a)
$$\begin{aligned} \varphi _{2}(x,y)&= \frac{1}{2A}\left( x_{3}y_{1}-x_{1}y_{3}+\left( y_{3}-y_{1}\right) x + \left( x_{1}-x_{3}\right) y\right) , \end{aligned}$$
(5b)
$$\begin{aligned} \varphi _{3}(x,y)&= \frac{1}{2A}\left( x_{1}y_{2}-x_{2}y_{1}+\left( y_{1}-y_{2}\right) x + \left( x_{2}-x_{1}\right) y\right) , \end{aligned}$$
(5c)

where A denotes the area of the triangle. Using these functions, the element mass matrix \(M^{e}\in \mathbb {R}^{3\times 3}\) and the element stiffness matrix \(K^{e}\in \mathbb {R}^{3\times 3}\) can be computed. The former one is constant for every triangle element and given by

$$\begin{aligned} M^{e} = A^{e} \begin{pmatrix} \frac{1}{6} &{} \frac{1}{12} &{} \frac{1}{12} \\ \frac{1}{12} &{} \frac{1}{6} &{} \frac{1}{12} \\ \frac{1}{12} &{} \frac{1}{12} &{} \frac{1}{6} \end{pmatrix}, \end{aligned}$$
(6)

with \(A^{e}\in \mathbb {R}_{+}\) the area of triangle element \(e\in \mathcal {E}\), \(c\in \mathbb {R}_{+}\) the specific heat capacity of the material, and \(\rho \in \mathbb {R}_{+}\) its density. The latter one is the sum of matrices \(K^{H,e}\in \mathbb {R}^{3\times 3}\) and \(K^{R,e}_{h,p}\in \mathbb {R}^{3\times 3}\), representing the influence of the heat Eq. (3a) and the Robin boundary condition (3b), respectively. It is computed by

$$\begin{aligned} K^{e}&= \frac{\alpha }{4A}K^{H,e} + \frac{\kappa ^{a}}{c\varrho } \sum _{(h,p)\in \partial \Omega } l_{h,p} K^{R,e}_{h,p}, \end{aligned}$$
(7)
$$\begin{aligned} K^{H,e}&= \begin{pmatrix} k^{H,e}_{11} &{} k^{H,e}_{12} &{} k^{H,e}_{13} \\ k^{H,e}_{12} &{} k^{H,e}_{22} &{} k^{H,e}_{23} \\ k^{H,e}_{13} &{} k^{H,e}_{23} &{} k^{H,e}_{33} \end{pmatrix}, \end{aligned}$$
(8)
$$\begin{aligned} k^{H,e}_{11}&= \left( y_{2}-y_{3}\right) ^{2} + \left( x_{3}-x_{2}\right) ^{2}, \nonumber \\ k^{H,e}_{12}&= \left( y_{2}-y_{3}\right) \left( y_{3}-y_{1}\right) + \left( x_{3}-x_{2}\right) \left( x_{1}-x_{3} \right) , \nonumber \\ k^{H,e}_{13}&=\left( y_{2}-y_{3}\right) \left( y_{1}-y_{2}\right) + \left( x_{3}-x_{2}\right) \left( x_{2}-x_{1}\right) , \nonumber \\ k^{H,e}_{22}&= \left( y_{3}-y_{1}\right) ^{2} + \left( x_{1}-x_{3}\right) ^{2}, \nonumber \\ k^{H,e}_{23}&= \left( y_{3}-y_{1}\right) \left( y_{1}-y_{2}\right) + \left( x_{1}-x_{3}\right) \left( x_{2}-x_{1}\right) , \nonumber \\ k^{H,e}_{33}&= \left( y_{1}-y_{2}\right) ^{2} + \left( x_{2}-x_{1}\right) ^{2},\nonumber \\ K^{R,e}_{h,p}&= (k^{R,e}_{h,p})_{i,j} = {\left\{ \begin{array}{ll} \frac{1}{3}, &{} i=j=\psi ^{e}(h) \\ \frac{1}{3}, &{} i=j=\psi ^{e}(p) \\ \frac{1}{6}, &{} i=\psi ^{e}(h),\quad j=\psi ^{e}(p) \\ \frac{1}{6}, &{} j=\psi ^{e}(h),\quad ~i=\psi ^{e}(p) \\ 0, &{} else \end{array}\right. }. \end{aligned}$$
(9)

The element load vectors \(\vec {f}^{H,e}\in \mathbb {R}^{3}\) and \(\vec {f}^{R,e}\in \mathbb {R}^{3}\) represent the effect of the heat source within the heat Eq. (3a) and of the ambient temperature within the Robin boundary condition (3b), respectively. Assuming a constant heat input \(q\in \mathbb {R}\) over the area related to one node, they are calculated by

$$\begin{aligned} \vec {f}^{H,e}&= A^{e}\begin{pmatrix} \frac{1}{3} \\ \frac{1}{3} \\ \frac{1}{3} \end{pmatrix}, \end{aligned}$$
(10)
$$\begin{aligned} \vec {f}^{R,e}&=\kappa ^{a}\sum _{(h,p)\in \partial \Omega } l_{h,p} \vec {f}^{R,e}_{h,p},\end{aligned}$$
(11)
$$\begin{aligned} \vec {f}^{R,e}_{h,p}&= \left( f^{R,e}_{h,p}\right) _{i} = {\left\{ \begin{array}{ll} \frac{1}{2}, &{} i = \psi ^{e}(h) \\ \frac{1}{2}, &{} i = \psi ^{e}(p) \\ 0, &{} else\end{array}\right. }. \end{aligned}$$
(12)

Summing the local matrices \(K^{e}\), \(M^{e}\), and vectors \(f^{H,e}\), \(f^{R,e}\) up for all elements \(e\in \mathcal {E}\), the global matrices K, M and vectors \(f^{H}\), \(f^{R}\) are obtained (Taler and Ocłoń 2014).

Concerning \(\Omega _{1}\), we define a node at every intersection point between two thin-walled segments and collect them in the set \(\mathcal {V}^{e}\). Let \(\mathcal {V}^{c}\subseteq \mathcal {V}^{p}\) denote the set containing all nodes at the interface, then every thin-walled welding segment is described as an element of the set \(\mathcal {W}^{e}\subseteq \mathcal {V}^{e}\times (\mathcal {V}^{e}\cup \mathcal {V}^{c})\). Thus, the subdomain \(\Omega _{1}\) is again decomposed into smaller subdomains, one for each \((i,j)\in \mathcal {W}^{e}\). On every segment, a one-dimensional heat equation must be solved, while the new transmission conditions between adjacent segments must be incorporated.

Similar to Bähr et al. (2021), we add \(N_{i,j}\in \mathbb {N}\) equidistantly distributed discretization points to every segment \((i,j)\in \mathcal {W}^{e}\) of length \(l_{i,j}\), yielding \(\Delta x_{i,j} = \frac{l_{i,j}}{N_{i,j}+1}\). Every discretization point is identified with its position \(k\in \{0,1,\ldots ,N_{i,j}+1\}\) within the segment, starting with 0 at \(i\in \mathcal {V}^{e}\) and ending with \(N_{i,j}+1\) at \(j\in \mathcal {V}^{e}\). Furthermore, let \(\mathcal {L}_{i,j} = \{1,\ldots ,N_{i,j}\}\) denote the set of the interior discretization points for every segment \((i,j)\in \mathcal {W}^{e}\). The interior discretization points of all segments are stored in the set \(\mathcal {V}^{int}\) and let \({\overline{\mathcal {V}}} = \mathcal {V}^{e}\cup \mathcal {V}^{p}\cup \mathcal {V}^{int}\) denote the set of all nodes within the layer. The function \(\xi :\mathcal {W}^{e}\times \{0,1,\ldots ,N_{i,j}+1\}\rightarrow {\overline{\mathcal {V}}}\) is used to map the local labels at every segment to the global node labels for the layer. Applying finite differences of the backward time centered space (BTCS) scheme gives

$$\begin{aligned} \theta _{k,t-1}&= - {\tilde{\alpha }}_{i,j}\theta _{k-1,t} + (1+2{\tilde{\alpha }}_{i,j})\theta _{k,t} - {\tilde{\alpha }}_{i,j}\theta _{k+1,t} - \Delta t q_{k,t} \nonumber \\&\qquad \forall (i,j)\in \mathcal {W}^{e},\quad k\in \mathcal {L}_{i,j},\quad t\in \mathcal {T}, \end{aligned}$$
(13)
$$\begin{aligned} \theta _{0,t}&= \theta _{i,t} \quad \forall (i,j)\in \mathcal {W}^{e},\quad t\in \mathcal {T}_{0}, \end{aligned}$$
(14)
$$\begin{aligned} \theta _{N_{i,j}+1,t}&= \theta _{j,t} \quad \forall (i,j)\in \mathcal {W}^{e},\quad t\in \mathcal {T}_{0}, \end{aligned}$$
(15)

with transformed diffusivity \({\tilde{\alpha }}_{i,j} = \frac{\alpha \Delta t}{(\Delta x_{i,j})^{2}}\), discretized heat source \(q_{k,t}\), representing the function value of q(xyt) at the position of interior point \(k\in \mathcal {L}_{i,j}\) at time step \(t\in \mathcal {T}\).

By applying the global node set \({\overline{\mathcal {V}}}\), the transmissions conditions (3d) and (3e) are guaranteed implicitly since it holds \(\mathcal {V}^{c}\subseteq \mathcal {V}^{p}\) and the normal vector \(\vec {n}\) is defined to point outside of the respective domain.

3 Mixed-integer optimization model

In this section, we derive a MIPDECO formulation for the trajectory planning problem of the weld source of the general form

$$\begin{aligned}&\max \quad \! \int _{0}^{T} f(t,\theta (x,t))~dt, \end{aligned}$$
(16a)
$$\begin{aligned}&\text {s.t.} \quad \partial _{t} \theta (x,t) = \alpha \nabla \theta (x,t) + q(x,w,t) \quad \forall x\in \Omega ,~t\in \left[ 0,T\right] , \end{aligned}$$
(16b)
$$\begin{aligned}&\partial _{n} \theta (x,t) = \kappa ^{a} \left( \theta (x,t) - \varphi ^{add}\right) \quad \forall x\in \partial \Omega ,~t\in \left[ 0,T\right] , \end{aligned}$$
(16c)
$$\begin{aligned}&\theta (x,0) = \theta ^{init}(x) \quad \forall x\in \Omega , \end{aligned}$$
(16d)
$$\begin{aligned}&Aw \le b, \end{aligned}$$
(16e)
$$\begin{aligned}&w \in \{0,1\}^{\vert M\vert }, \end{aligned}$$
(16f)

and discretize and linearize it to achieve a MILP formulation. The objective function (16a) measures the quality of the workpiece incorporating the time t and the temperature distribution \(\theta (x,t)\). In the constraints, two parts, one for the temperature calculation (16b)–(16d) and another for the trajectory generation (16e), (16f), are coupled by the binary variables w using the weld source term q(xwt). These binary variables describe the trajectory of the weld source in a time expanded graph. In the following, let \(\delta (j):\mathcal {V}^{e}\rightarrow \mathbb {N}\) denote the function assigning the node degree to every node \(j\in \mathcal {V}^{e}\) regarding the set of welding segments \(\mathcal {W}^{e}\) and \({\mathcal {V}^{odd}=\{j\in \mathcal {V}^{e}~|~\delta (j)=2k-1\wedge k\in \mathbb {N}\}}\) the set of nodes in \(\Omega _{1}\) with odd node degree. Since the resulting trajectory should be most continuous, transition moves should be avoided if possible. Thus, we allow them only between nodes \(i,j\in \mathcal {V}^{odd}\). Otherwise, one can find a feasible trajectory requiring fewer transition moves.

Since every node \(j\in \mathcal {V}^{e}\) with \(\delta (j)=2\) has only one neighbor in either direction, the further trajectory is determined when arriving at this point. If there is no edge \((i,k)\in \mathcal {W}^{e}\) connecting its neighbors \(i,k\in \mathcal {V}^{e}\cup \mathcal {V}^{c}\), the node j can be removed from the set \(\mathcal {V}^{e}\) and seen as an additional interior node. Therefore, the edges \((i,j),(j,k)\in \mathcal {W}^{e}\) are replaced by the new edge (ik) with \(\mathcal {L}_{i,k} = \{1,\ldots ,N_{i,j}+N_{j,k}+1\}\), where node i is at position 0, j is the interior node at position \(N_{i,j}+1\), and k has the last position \(N_{i,j}+N_{j,k}+2\). By applying this transformation, the set of nodes, where a decision regarding the progression of the trajectory is possible, is given by

$$\begin{aligned} \mathcal {V}= \mathcal {V}^{p} \cup \left\{ j\in \mathcal {V}^{e}~|~\delta (j) \ge 3~\vee ~ \left( \delta (j) = 2 ~\wedge ~ (i,j),(j,k),(i,k)\in \mathcal {W}^{e} \right) \right\} . \nonumber \\ \end{aligned}$$
(17)

The set of feasible connections between the nodes in \(\mathcal {V}^{p}\) can be obtained from the adjacency matrix A and is given by \(\mathcal {A}= \{(i,j)\in \mathcal {V}^{p}\times \mathcal {V}^{p}~|~a_{i,j} = 1\}\). Thus, the considered layer is represented by the graph \(G=(\mathcal {V},\mathcal {W}^{e}\cup \mathcal {A})\) as displayed in Fig. 3.

Fig. 3
figure 3

Top view on an example geometry (left) and the associated graph G (right). The boundaries of the pixels covering the bulky part are displayed in gray. Every node of the global node set \({\overline{\mathcal {V}}}\) is represented by a circle which is not filled for the decision nodes in the set \(\mathcal {V}\)

To obtain the number of discrete time steps to process the complete layer, the time for welding and the time for transition moves must be taken into account. Since the length of each welding segment \({(i,j)\in \mathcal {W}^{e}}\) is known, the number of time steps to weld all segments of one layer is given by \(T^{e}=\sum _{(i,j)\in \mathcal {W}^{e}} \tau _{i,j}^{w}\) with \({\tau _{i,j}^{w} = \frac{l_{i,j}}{v^{w}\Delta t}}\). Due to the applied space discretization of the areas, the weld source requires one time step to reach the next node \(i\in \mathcal {V}^{p}\). Thus, there are \(T^{p} = \vert \mathcal {V}^{p} \vert -1\) time steps necessary to manufacture all bulky parts and it holds \(\tau ^{w}_{i,j}=1\) for all \((i,j)\in \mathcal {A}\). Although in practical applications the velocity \(v^{m}\) of the weld source while moving without welding is much greater than \(v^{w}\), already for medium-scaled workpieces the required time for necessary transition moves must be taken into account. Since their duration depends on the chosen trajectory, the processing time to finish one layer is unknown a priori. Nevertheless, an upper bound can be obtained since the number of necessary transition moves \(\omega \in \mathbb {N}\cup \{0\}\) should be minimal. Assuming that the weld source uses the euclidean distance \(d_{i,j}\) to travel between nodes \(i,j\in \mathcal {V}^{odd}\), the number of time steps for this action is computed by \(\tau ^{m}_{i,j} = \frac{d_{i,j}}{v^{m}\Delta t} \). Thus, the number of necessary time steps to process the whole layer is bounded from above by \(T^{\textrm{max}} = T^{e} + T^{p} + \omega \max _{i,j\in \mathcal {V}^{odd}} \tau _{i,j}^{m}\) and the discrete time horizon is \(\mathcal {T}_{0}=\{0,1,\ldots ,T^{\textrm{max}}\}\). As abbreviations we use in the following \({\mathcal {T}= \mathcal {T}_{0}{\setminus } \{0\}}\), \(\mathcal {T}^{-} = \mathcal {T}{\setminus } \{T^{\textrm{max}}\}\). Furthermore, let denote \(\mathcal {T}^{w} = \{0,\ldots ,\mathcal {T}^{e} + T^{p}-1+ \omega \min _{i,j\in \mathcal {V}^{odd}} \tau _{i,j}^{m}\}\) the number of time steps before the whole layer can be processed. All used sets, intervals, parameters, and variables of the resulting MILP are listed in Tables 12 and 3.

Table 1 Overview of the sets and intervals used in the trajectory planning problem
Table 2 Overview of the parameters used in the trajectory planning problem
Table 3 Overview of the variables used in the trajectory planning problem

3.1 Path generation

According to the space discretization of \(\Omega _{2}\) in Sect. 2, it is necessary to visit every node in \(\mathcal {V}^{p}\setminus \mathcal {V}^{c}\) once to fill its related square with the material. For all nodes \(j\in \mathcal {V}^{c}\) in the common interface, there are at most visits due to their adjacent welding segments. These are processed by tracking them once. Thus, also all interior nodes \(\mathcal {V}^{int}\) are visited exactly once and for all nodes \(j\in \mathcal {V}^{e}\) the number of visits is . Let \(\nu (j):\mathcal {V}\rightarrow \mathbb {N}\) denote the function assigning the maximum number of visits to every node by

(18)

The problem of finding a feasible trajectory for a given layer can be formulated as an SDVRP on the graph G with one (artificial) depot and \(\omega \) identical vehicles with unbounded capacity in the following way. By setting the delivered demand per visit to one and the total demand of node \(j\in \mathcal {V}\) to \(\nu (j)\), we ensure that the whole layer is processed. Every vehicle tour represents a continuous part of the welding trajectory and the edges from the endpoint of one tour to the depot and from the depot to the starting point of the next tour are summarized into a transition move. By this approach, the depot can be neglected in the model. To eliminate subtours, we apply a time-expanded formulation. Every segment can be welded in either direction and to incorporate the welding time \(\tau _{i,j}^{w}\), we introduce the sets \({\overline{\mathcal {W}}}^{e}=\left\{ (i,j)\in \mathcal {V}\times \mathcal {V}~|~(i,j)\in \mathcal {W}^{e} \vee (j,i)\in \mathcal {W}^{e}\right\} \) and

$$\begin{aligned} \mathcal {W}^{*} = \left\{ (i,t_{i},j,t_{j})\in \mathcal {V}\times \mathcal {T}_{0}\times \mathcal {V}\times \mathcal {T}~|~(i,j)\in {\overline{\mathcal {W}}}^{e} \cup \mathcal {A}\wedge t_{j} = t_{i} + \tau _{i,j}^{w}\right\} , \end{aligned}$$
(19)

respectively. For the transition moves, let \(\mathcal {U}= \left\{ (i,j)\in \mathcal {V}^{odd}\times \mathcal {V}^{odd}~|~i\ne j\right\} \) denote the set of all possible transition moves and

$$\begin{aligned} \mathcal {U}^{*} = \left\{ (i,t_{i},j,t_{j})\in \mathcal {V}\times \mathcal {T}\times \mathcal {V}\times \mathcal {T}^{-}~|~(i,j)\in \mathcal {U}\wedge t_{j} = t_{i} + \tau _{i,j}^{m} \right\} \end{aligned}$$
(20)

be its extension, incorporating the time to move.

To compute the trajectory of the weld source, binary variables \(w_{i,t_{i},j,t_{j}}\), \((i,t_{i},j,t_{j})\in \mathcal {W}^{*}\), indicating whether segment \((i,j)\in {\overline{W}}\) is welded from time step \(t_{i}\in \mathcal {T}_{0}\) to time step \(t_{j}\in \mathcal {T}\), and \(u_{i,t_{i},j,t_{j}}\), \((i,t_{i},j,t_{j})\in \mathcal {U}^{*}\), indicating whether the weld source transits from \(i\in \mathcal {V}^{odd}\) to \(j\in \mathcal {V}^{odd}\) from time step \(t_{i}\in \mathcal {T}\) to time step \(t_{j}\in \mathcal {T}\), are introduced. In the following, the abbreviation

$$\begin{aligned} w_{j,t} = {\left\{ \begin{array}{ll} \sum _{k,t_{k}:(j,0,k,t_{k}) \in \mathcal {W}^{*}} w_{j,0,k,t_{k}}, &{} j\in \mathcal {V},t=0, \\ \sum _{i,t_{i}:(i,t_{i},j,t) \in \mathcal {W}^{*}} w_{i,t_{i},j,t} + \sum _{i,t_{i}:(i,t_{i},j,t) \in \mathcal {U}^{*}} u_{i,t_{i},j,t}, &{} j\in \mathcal {V},t\in \mathcal {T}, \\ \sum _{\begin{array}{c} (i,t_{i},k,t_{k})\in \mathcal {W}^{*} \\ \xi (i,k,h)=j \\ t = t_{i}+h \end{array}} w_{i,t_{i},k,t_{k}} + \sum _{\begin{array}{c} (k,t_{k},i,t_{i})\in \mathcal {W}^{*} \\ \xi (i,k,h)=j \\ t = t_{i}-h \end{array}} w_{k,t_{k},i,t_{i}},&j\in \mathcal {V}^{int},~t\in \mathcal {T}_{0} \end{array}\right. } \end{aligned}$$
(21)

is used describing at which node \(j\in {\overline{\mathcal {V}}}\) the weld source is positioned at time step \(t\in \mathcal {T}_{0}\). Further binary variables \(u^{-}_{j}\in \{0,1\}\) and \(u^{+}_{j,t}\in \{0,1\}\), indicating whether the trajectory starts at node \(j\in \mathcal {V}^{p}\cup \mathcal {V}^{e}\) or ends in this node at time step \(t\in \mathcal {T}\setminus \mathcal {T}^{w}\), respectively, are required to determine the start and the end of the trajectory correctly. Note that the latter ones are defined for a set of time steps since the discrete time horizon can contain more time steps than the process requires to finish. Thus, the problem of finding a feasible welding trajectory for a single layer is given by

$$\begin{aligned}&\sum _{j\in \mathcal {V}^{p}\cup \mathcal {V}^{e}} u^{-}_{j} = 1, \end{aligned}$$
(22a)
$$\begin{aligned}&\sum _{k,t_{k}:(j,0,k,t_{k}) \in \mathcal {W}^{*}} w_{j,0,k,t_{k}} = u^{-}_{j} \quad \forall j\in \mathcal {V}, \end{aligned}$$
(22b)
$$\begin{aligned}&\sum _{j\in \mathcal {V}} \sum _{t\in \mathcal {T}\setminus \mathcal {T}^{w}} u^{+}_{j,t} = 1, \end{aligned}$$
(22c)
$$\begin{aligned}&w_{j,t} = \sum _{k,t_{k}:(j,t,k,t_{k})\in \mathcal {W}^{*}} w_{j,t,k,t_{k}} + \sum _{k,t_{k}:(j,t,k,t_{k})\in \mathcal {U}^{*}} u_{j,t,k,t_{k}} \quad \forall j\in \mathcal {V},~t\in \mathcal {T}^{w}, \end{aligned}$$
(22d)
$$\begin{aligned}&w_{j,t} = \sum _{k,t_{k}:(j,t,k,t_{k})\in \mathcal {W}^{*}} w_{j,t,k,t_{k}} \nonumber \\&\quad \qquad + \sum _{k,t_{k}:(j,t,k,t_{k})\in \mathcal {U}^{*}} u_{j,t,k,t_{k}} + u^{+}_{j,t} \quad \forall j\in \mathcal {V},~t\in \mathcal {T}\setminus \mathcal {T}^{w}, \end{aligned}$$
(22e)
$$\begin{aligned}&\sum _{(i,t_{i},j,t_{j})\in \mathcal {U}^{*}} u_{i,t_{i},j,t_{j}} = \omega , \end{aligned}$$
(22f)
$$\begin{aligned}&\sum _{t\in \mathcal {T}_{0}} w_{j,t} = \nu (j) \quad \forall j\in {\overline{\mathcal {V}}}\setminus \mathcal {V}^{c}, \end{aligned}$$
(22g)
$$\begin{aligned}&\sum _{t\in \mathcal {T}_{0}} w_{j,t} \ge \nu (j)-1 \quad \forall j\in \mathcal {V}^{c}, \end{aligned}$$
(22h)
$$\begin{aligned}&\sum _{t\in \mathcal {T}_{0}} w_{j,t} \le \nu (j) \quad \forall j\in \mathcal {V}^{c}, \end{aligned}$$
(22i)
$$\begin{aligned}&\sum _{t_{i},t_{j}:(i,t_{i},j,t_{j})\in \mathcal {W}^{*}} w_{i,t_{i},j,t_{j}} +\sum _{t_{j},t_{i}:(j,t_{j},i,t_{i})\in \mathcal {W}^{*}} w_{j,t_{j},i,t_{i}}\nonumber \\&\qquad =1\quad \forall ~(i,j)\in \mathcal {W}^{e}:\,\tau _{i,j}^{w} = 1. \end{aligned}$$
(22j)

Constraints (22a)–(22c) specify the start and end point of the trajectory. Its continuity is ensured by (22d) and (22e). The number of transition moves is limited by (22f) and the correct number of visits is guaranteed by (22g) for all nodes in \({\overline{\mathcal {V}}}\setminus \mathcal {V}^{c}\). Due to the geometry of the layer, it can be possible that a node \(j\in \mathcal {V}^{c}\) of the common interface is visited only times if all other nodes in \(\mathcal {V}^{p}\) can be reached without visiting node j. Thus, the number of visits can vary by one and (22h), (22i) are required to incorporate this case into the model.

Furthermore, we formulate two cutting planes to accelerate the solution process. At first, every feasible trajectory holds

$$\begin{aligned} \sum _{i,t_{i}:(i,t_{i},j,t)\in \mathcal {U}^{*}} u_{i,t_{i},j,t} + \sum _{k,t_{k}:(j,t,k,t_{k})\in \mathcal {U}^{*}} u_{j,t,k,t_{k}} \le 1 \quad \forall j\in \mathcal {V}^{odd},~t\in \mathcal {T}^{-}. \end{aligned}$$
(23)

Otherwise, both transition moves can be merged into a single one, leading to a solution with \(\omega -1\) transition moves. This contradicts the definition of \(\omega \) to be minimal. Also constraint (22j) can be extended to

$$\begin{aligned} \sum _{t_{i},t_{j}:(i,t_{i},j,t_{j})\in \mathcal {W}^{*}} w_{i,t_{i},j,t_{j}} + \sum _{t_{j},t_{i}:(j,t_{j},i,t_{i})\in \mathcal {W}^{*}} w_{j,t_{j},i,t_{i}} = 1 \quad \forall ~(i,j)\in \mathcal {W}^{e}. \end{aligned}$$
(24)

All welding segments not included in (22j) contain at least one interior node and (24) is implied by (22g) for \(i\in \mathcal {V}^{int}\).

3.2 Temperature calculation

Following the assumption of uniform heat input from Sect. 2, we adapt the piece-wise constant, circular approximation of the Goldak heat source used by Bähr et al. (2021) and assume that it is constant over the area related to any node in \({\overline{\mathcal {V}}}\). By this approach, each node gets heated proportionally to its distance to the center of the weld source. Due to the used space discretization in Sect. 2, the weld source is centered above one node \(i\in {\overline{\mathcal {V}}}\) at the end of every time step. Thus, the required distances to all other nodes \(j\in {\overline{\mathcal {V}}}\) are given by the euclidean distances \(d_{i,j}\). For a set of \(K^{w}\) radii \(r^{w}_{k}\), \(k=1,\ldots ,K^{w}\), we define factors \(\kappa ^{w}_{k}\), \(k=1,\ldots ,K^{w}\) and intervals \(\mathcal {P}_{k} = \left( r_{k-1},r_{k}\right] \), \(k=2,\ldots ,K^{w}\). They describe the proportion of the temperature gain \(\varphi ^{\textrm{max}}\) at the center of the weld source. Setting \(r^{w}_{1}=0\), \(\kappa ^{w}_{1} = 1\) and \(\mathcal {P}_{1} = \{0\}\), the temperature gain \(q_{j,t}\) of every node \(j\in {\overline{V}}\) at time step \(t\in \mathcal {T}_{0}\) is calculated by

$$\begin{aligned} q_{j,t} = \varphi ^{\textrm{max}} \sum _{k=1}^{K^{w}} \sum _{\begin{array}{c} i\in {\overline{\mathcal {V}}} \\ d_{i,j}\in \mathcal {P}_{k} \end{array}} \kappa ^{w}_{k} w_{j,t} \quad \forall j\in {\overline{\mathcal {V}}},\quad \forall t\in \mathcal {T}_{0}, \end{aligned}$$
(25)

where \(w_{j,t}\) is again from (21).

The temperature of every node \(j\in {\overline{\mathcal {V}}}\) at time step \(t\in \mathcal {T}_{0}\) is stored at the variable \(\theta _{j,t}\in \mathbb {R}_{+}\) and the initial temperature distribution is given by \(\theta ^{init}_{j}\in \mathbb {R}\). Using the results of Sect. 2, the temperature distribution within the workpiece is computed by

$$\begin{aligned} \theta _{j,0}&= \theta ^{init}_{j} + \frac{\varphi ^{\textrm{max}} - \theta ^{init}_{j} }{\varphi ^{\textrm{max}}}q_{j,0} \quad \forall j\in {\overline{\mathcal {V}}} \end{aligned}$$
(26)
$$\begin{aligned} \sum _{h\in \mathcal {V}^{p}} (m_{j,h} + \Delta tk_{j,h})\theta _{h,t}&= \sum _{h\in \mathcal {V}^{p}} m_{j,h}\theta _{h,t-1} + \Delta t\left( q_{j,t}f^{H}_{j} +\varphi ^{add}f^{R}_{j}\right) \nonumber \\&\qquad \forall j\in \mathcal {V}^{p},~t\in \mathcal {T}, \end{aligned}$$
(27)
$$\begin{aligned} \theta _{\xi (i,j,k),t-1}&= - {\tilde{\alpha }}_{i,j}\theta _{\xi (i,j,k-1),t} + (1+2{\tilde{\alpha }}_{i,j})\theta _{\xi (i,j,k),t} \nonumber \\&\quad - {\tilde{\alpha }}_{i,j}\theta _{\xi (i,j,k+1),t} - \Delta t q_{\xi (i,j,k),t} \nonumber \\&\qquad \forall (i,j)\in \mathcal {W}^{e},~k\in \mathcal {L}_{i,j},~t\in \mathcal {T}, \end{aligned}$$
(28)
$$\begin{aligned} \theta _{j,t}&= (1-\kappa ^{a}) \theta _{j,t-1} + \Delta tq_{j,t} + \kappa ^{a} \varphi ^{add}\quad \forall j\in \mathcal {V}^{e},~t\in \mathcal {T}. \end{aligned}$$
(29)

Since the welding head is already centered above a node at the beginning and the welding process starts at \(t=0\), the position-dependent temperature gain \(q_{j,t}\), scaled to yield the welding temperature, must be incorporated into the initial temperature distribution in (26). The approximated solutions of the heat equation for the subdomains \(\Omega _{1}\) and \(\Omega _{2}\) are calculated in (27)–(29).

3.3 Objective function

In additive manufacturing, there are different objectives possible to choose the best welding trajectory from a feasible set. Here we discuss the criteria used by Jiang and Ma (2020): material/time savings, part quality, and material properties.

Material/time savings Since we consider only a single layer without support structures and allow no cooling breaks, the necessary material is constant and the processing time depends solely on the performed transition moves. The binary variables \(u^{+}_{j,t}\) are used to minimize the processing time of the considered layer by

$$\begin{aligned} \min \left( \max _{\begin{array}{c} j\in \mathcal {V}\\ t\in \mathcal {T}\setminus \mathcal {T}^{w} \end{array}} tu^{+}_{j,t}\right) . \end{aligned}$$
(30)

To linearize (30), a new variable \(z^{\textrm{max}}\in \mathbb {R}_{+}\) is defined with

$$\begin{aligned} tu^{+}_{j,t} \le z^{\textrm{max}} \quad \forall j\in \mathcal {V},~t\in \mathcal {T}\setminus \mathcal {T}^{w}. \end{aligned}$$
(31)

The objective function is then rewritten as

$$\begin{aligned} \min \quad z^{\textrm{max}}. \end{aligned}$$
(32)

Part quality To compare different trajectories in terms of the quality of their resulting workpiece, one must first define measurable criteria for the quality. In this work, we consider the objective of minimizing thermal stress to measure quality since strain within the material causes warping or can lead to cracks. In the work of Bähr et al. (2021), thermal gradients are identified as a source of thermal stress, leading to the objective function

$$\begin{aligned} \min \quad \sum _{t\in \mathcal {T}_{0}} \sum _{(i,j)\in \mathcal {W}} \vert \theta _{i,t} - \theta _{j,t} \vert . \end{aligned}$$
(33)

Due to the nonlinearity of the absolute value function, objective (33) must be linearized. Therefore, non-negative auxiliary variables \(\vartheta ^{+}_{i,j,t}\in \mathbb {R}_{+}\) and \(\vartheta ^{-}_{i,j,t}\in \mathbb {R}_{+}\) for every segment \((i,j)\in \mathcal {W}\) and time step \(t\in \mathcal {T}_{0}\) are introduced, representing the positive and negative portion of the absolute value function. They are calculated by

$$\begin{aligned} \vartheta ^{+}_{i,j,t} - \vartheta ^{-}_{i,j,t} = \theta _{i,t} - \theta _{j,t} \quad \forall (i,j)\in \mathcal {W},\quad t\in \mathcal {T}_{0}, \end{aligned}$$
(34)

leading to the linear objective function

$$\begin{aligned} \min \quad \sum _{t\in \mathcal {T}_{0}} \sum _{(i,j)\in \mathcal {W}} \vartheta ^{+}_{i,j,t} + \vartheta ^{-}_{i,j,t}. \end{aligned}$$
(35)

Material Properties Depending on cooling time and temperature, metal develops different material properties. Thus, it can be desirable to ensure a certain temperature at some segments or even the whole workpiece to achieve characteristics supporting the functional aspects of the finished product. A possible approach is the minimization of the absolute deviation between the temperature of a node \(j\in {\overline{\mathcal {V}}}\) at time step \(t\in \mathcal {T}_{0}\) and a given target temperature \(\theta ^{tar}_{j,t}\in \mathbb {R}_{+}\), leading to the objective function

$$\begin{aligned} \min \quad \sum _{t\in \mathcal {T}_{0}} \sum _{j\in {\overline{\mathcal {V}}}} \vert \theta _{j,t} - \theta ^{tar}_{j,t} \vert . \end{aligned}$$
(36)

The objective (36) also must be linearized. Defining again non-negative auxiliary variables \({\vartheta ^{+}_{j,t}\in \mathbb {R}_{+}}\) and \(\vartheta ^{-}_{j,t}\in \mathbb {R}_{+}\), representing the positive and negative portion of the deviation, gives the objective function

$$\begin{aligned} \min \quad \sum _{t\in \mathcal {T}_{0}} \sum _{j\in {\overline{\mathcal {V}}}} \vartheta ^{+}_{j,t} + \vartheta ^{-}_{j,t}, \end{aligned}$$
(37)

with the additional constraint

$$\begin{aligned} \vartheta ^{+}_{j,t} - \vartheta ^{-}_{j,t} = \theta _{j,t} - \theta _{j,t}^{tar} \quad \forall j\in {\overline{\mathcal {V}}},\quad t\in \mathcal {T}_{0}. \end{aligned}$$
(38)

If a segment or larger parts of the workpiece should have the same temperature, then the parameter \(\theta ^{tar}_{j,t}\) is set to the same value for the subset of nodes describing this segment or part.

For practical applications, this approach may be too strict since often it is sufficient to maintain certain temperature intervals to achieve a special property. To relax the last approach to minimize the distance of the temperature \(\theta _{j,t}\) of node \(j\in {\overline{\mathcal {V}}}\) at time step \(t\in \mathcal {T}_{0}\) to a desired temperature interval \(\left[ \theta ^{tar,-}_{j,t},\theta ^{tar,+}_{j,t}\right] \), objective (37) is used and only constraint (38) is replaced by

$$\begin{aligned} \theta _{j,t} + \vartheta ^{-}_{j,t}&\ge \theta ^{tar,-}_{j,t}\quad \forall j\in {\overline{\mathcal {V}}},\quad t\in \mathcal {T}_{0}, \end{aligned}$$
(39)
$$\begin{aligned} \theta _{j,t} - \vartheta ^{+}_{j,t}&\le \theta ^{tar,+}_{j,t} \quad \forall j\in {\overline{\mathcal {V}}},\quad t\in \mathcal {T}_{0}, \end{aligned}$$
(40)

where \(\vartheta ^{-}_{j,t}\) and \(\vartheta ^{+}_{j,t}\) now represent the deviation of the temperature to the left and the right interval endpoint, respectively.

The appearance of the absolute value function in (33) and (36) has a significant impact on the applicable solution methods. On the one hand, it rules out the computation of the PDE system in a preprocessing step from Gnegel et al. (2021) since it cannot be predetermined if the temperature gain in a node is beneficial to the objective function value. On the other hand, in an optimal solution of its linear programming (LP) relaxation, the temperature gain of the weld source is spread over all nodes. Especially for the objective function (33), this leads to many very small positive fractional values for the variables \(w_{i,t_{i},j,t_{j}}\) and \(u_{i,t_{i},j,t_{j}}\) and an objective function value close to zero. Regarding the objective function (36), the LP relaxation yields slightly better variable values due to the given target temperature instead of a second variable in the absolute value function. This problem is also mentioned by Beisegel et al. (2021). For the procedure of Hahn et al. (2022), the solution values of the variables \(w_{i,t_{i},j,t_{j}}\) and \(u_{i,t_{i},j,t_{j}}\) are required as input for the rounding algorithms, making the rounding decisions difficult.

4 Computational results

To achieve realistic results, the weld source and material parameters are chosen following practically used values. The time step length is set to \(\Delta t = 0.5\) s and the transiting velocity is given by \(v^{m}=30\) mm \({\text {s}}^{-1}\). For the weld source, we assume a Fronius TPS/i 500 welding device similar to Bähr et al. (2021), also following the piece-wise constant discretization therein. Thus, the weld source velocity while welding is set to \(v^{w} = 6.67\) mm \({\text {s}}^{-1}\) and the parameters for its discretized heat distribution are given in Table 4 using \(K^{w}=5\) intervals.

Table 4 Interval lengths and factors of the piece-constant approximated heat distribution of the weld source Fronius TPS/i 500 from Bähr et al. (2021)

As welding material, steel is considered with a thermal diffusivity of \(\alpha = 3.774~\text {mm}^{2}\,{\text {s}}^{-1}\). The temperature-related parameters are artificial and must be estimated. They are chosen according to the estimation results from Beisegel et al. (2021) yielding \(\varphi ^{\textrm{max}} = 1569\) K, \(\kappa ^{a} = 0.1741\), and \(\varphi ^{add} = 709.56\) K.

The necessary number of transition moves \(\omega \) depends on the geometry of the layer and can, in general, not be read off the instance directly but obtained in a preprocessing step. Therefore, we solve the MILP consisting of the path generation constraints (22)–(24) with the objective

$$\begin{aligned} \min \sum _{(i,t_{i},j,t_{j})\in \mathcal {U}^{*}} u_{i,t_{i},j,t_{j}}, \end{aligned}$$
(41)

minimizing the number of transition moves. In the case of a layer consisting only thin-walled structures, it holds since every feasible trajectory is an Eulerian path (Bähr et al. 2021).

For the computational experiments, the model consisting of constraints (22a)–(22i), (23)–(29), and (38) is considered with the objective function (37). The target temperature is set to \(\theta ^{tar}_{i,t} = 973.15\) K for all nodes \(i\in {\overline{\mathcal {V}}}\) and time steps \(t\in \mathcal {T}_{0}\), while the initial temperature is set to \(\theta ^{init}_{i} = 709.56\) K. All instances were solved using IBM ILOG CPLEX 20.1.0.0 (International Business Machines Corporation 2021) on a Mac Pro with an Intel Xeon W running 32 threads parallel at 3.2 GHz clock speed and 768 GB RAM. For all computations, a time limit of 10,800 s was set and a branching priority by increasing cost per coefficient count was enabled.

4.1 CPU time sensitivity analysis

In the first set of experiments, the effect of various input parameters is studied concerning the runtime behavior of the solver. This gives insights to which complexity and size an instance can be solved within the given time limit.

Number of Nodes Varying the node number from 35 to 70 in steps of five nodes, 41 instances with \(\omega =1\) were randomly generated for each value. The computation of all 328 instances required 1,455,812 s and the CPU time for each run is given in Fig. 4, together with three common mean values.

Fig. 4
figure 4

Computation time concerning the number of nodes increasing in steps of five

For all instances with 35 nodes, the optimal solution is obtained in less than 1800 s and the average solution time increases with every additional node. Furthermore, there is a large spread of the solution time within the instances with equal node numbers. Already for 45 nodes, one instance is not solved to global optimality, while for the largest instances with 70 nodes, there are some whose proven optimal trajectory is found in less than 5400 s.

Number of transition moves Now the number of necessary transition moves \(\omega \) is varied between zero and three, while the number of nodes is kept at 50. Again, 41 instances were generated for each value and the computation of all of them finished after 1,134,978 s. The detailed solution times of the 164 instances are displayed in Fig. 5, together with three common mean values.

Fig. 5
figure 5

Computation time concerning the number of necessary transition moves

It shows that the number of necessary transition moves has a great impact on the computation time. In the absence of transition moves, the global optimal solution is computed very fast (less than 1000 s), but, already in the presence of a single one, there is a large spread of the solution times from 222 s to the time limit of 10,800 s and a resulting gap of 19.9%. For more than a single transition move, only one of the respective 82 instances was solved within the given time limit. This behavior is a consequence of the massive increase of possible trajectories in the presence of transition moves since for every node in \(\mathcal {V}^{odd}\) there is now the possibility of moving at certain time steps also to more distant parts of the geometry instead of only visiting its neighbors.

4.2 Detailed temperature progression

In this experiment, the focus is on the temperature progression within the workpiece. We consider an instance with 50 nodes and \(\omega =2\). Its solution took 9233 s. The optimal trajectory and the temperature progression of two selected nodes are displayed in Fig. 6.

Fig. 6
figure 6

Optimal trajectory of the considered instance (left) with the chosen welding order and the temperature progression of two selected nodes (right), marked by a red and blue circle, respectively. The bulky part is represented with all possible connections by thin grey lines. Transition moves are displayed by dashed arrows and the starting node is highlighted by a red square

The red circled node is within the thin-walled part of the instance. Its initial temperature is higher than the given value due to its proximity to the starting node. Furthermore, it is the first node visited by the weld source, yielding a large increase in its temperature. Every trespassing of it generates a peak in the node’s temperature progression, followed by a cooling phase. Therein, the radiation in the environment is the primary source of the heat loss.

For the blue node located in the bulky part of the instance, the effect of the heat conduction is better visible. Its initial temperature equals the prescribed value. Due to the heating of the nodes on the left of the bulky part, its temperature increases due to the heat conduction. At the fourteenth welding move (at time step 28), there is a significant temperature gain caused by its proximity to the weld source, followed by a cooling phase, where heat radiation and heat conduction nearly balance each other. At the trespassing of the weld source in the 29th weld move (at time step 56), there is again a large increase in the temperature.

4.3 LP relaxation

In this experiment, we study the effect of the objective functions (33) and (36) to the LP relaxation of the model using the respective objective with the necessary constraints. Therefore, relaxed binary variables with a value smaller than \(10^{-3}\) are neglected to achieve clear results. For the computations, the instance from Sect. 4.2 is taken again. Detailed information about the the solutions can be found in the Tables 5 and 6.

Table 5 Number of relaxed binary variables greater or equal than \(10^{-3}\) and their minimum and maximum values for the objective function (33)
Table 6 Number of relaxed binary variables greater or equal than \(10^{-3}\) and their minimum and maximum values for the objective function (36)

For both objective functions, the solution of the LP relaxation yields a similar distribution of the relaxed variables on the interval \(\left[ 0,1\right] \). Regarding the absolute difference between adjacent nodes (33), 97.8% of them have a value smaller than 0.1 and only three of them are greater than 0.5. Considering the absolute deviation from a target temperature (36), 91.2% of the variables are smaller than 0.1 and only five are greater than 0.5. Interestingly, the variables \(u_{i,t_{i},j,t_{j}}\) for the transition moves are all smaller than 0.1 in both cases, yielding no information about preferable transition moves. As expected, the number of variables with a value greater or equal to \(10^{-3}\) is smaller for the objective function (36) since the given target temperature requires more heating of the node to reduce the absolute deviation.

5 Conclusions and future work

In this work, we presented a MIPDECO model to optimize the trajectory of the weld source in WAAM for a single layer of arbitrary geometry. Its formulation as a MILP was introduced and a detailed heat conduction model, including also heat radiation into the environment, was incorporated by applying finite element and finite difference methods. For different optimization goals, we presented possible objective functions and proved the applicability of our approach using the state-of-the-art numerical solver CPLEX in several experiments. The effect of the number of considered nodes and the number of necessary transition moves were extensively studied, revealing that especially the latter has a great impact on the model complexity and the computation time. Furthermore, a detailed discussion of the temperature progression highlighting the considered aspects of heat transmittance was given for an example instance.

In our future work, we will accelerate the solution process to allow the computation of large-size workpieces and compare the computed temperature distribution to the one measured during the manufacturing process. Therefore, it is also necessary to extend the model into three dimensions to calculate several connected layers at once and incorporate the choice of different trajectories per layer. Otherwise, there will be joints reducing the quality of the finished workpiece. In future experiments, we will also study the effect of the ratio \(\frac{\vert \Omega {1}\vert }{\vert \Omega _{2}\vert }\) to the computation time.