Skip to main content

A greedy algorithm for optimal heating in powder-bed-based additive manufacturing


Powder-bed-based additive manufacturing involves melting of a powder bed using a moving laser or electron beam as a heat source. In this paper, we formulate an optimization scheme that aims to control this type of melting. The goal consists of tracking maximum temperatures on lines that run along the beam path. Time-dependent beam parameters (more specifically, beam power, spot size, and speed) act as control functions. The scheme is greedy in the sense that it exploits local properties of the melt pool in order to divide a large optimization problem into several small ones. As illustrated by numerical examples, the scheme can resolve heat conduction issues such as concentrated heat accumulation at turning points and non-uniform melt depths.


Powder bed fusion (PBF) is a type of additive manufacturing (AM) where metal powder is melted by a laser or electron beam in a layer-wise fashion to enable the production of geometrically complex parts [1]. AM undergoes continuous progress towards a technology that is robust and efficient, but there are still issues when it comes to quality and repeatability.

It is important for completed parts to meet the mechanical requirements and quality standards specified by the applications for which they are manufactured. The qualities of a completed part, such as tensile strength and surface roughness, depend on the melting process, which in turn is governed by several dozen material and process parameters such as preheating temperature, powder packing ratio, and beam speed, among other. Correlations between process parameters, process signatures (such as melt pool size and temperature), and product qualities are presented in [2] and references therein. Due to these correlations, the design of process settings requires critical attention. However, this involves extensive and costly experimental work and the resulting melting schemes implemented in machines rely on an excessive amount of parameters and functions in order to account for the dynamics of the melting process. This approach makes it difficult to optimize PBF and limits both the number of applications and the number of materials available for manufacturing.

As of late, computation based techniques are used to improve PBF related process control, i.e., to tackle the question of how to select different process parameters in order to build parts with desired properties [2, 3]. A common approach is design of (computational) experiments (DoE) [4, 5], which is an exploratory tool used to identify parameters that influence the qualities of the completed part. In [6], a DoE with a finite element model determines that the beam power and beam speed are the two process controllable parameters that have the largest impact on peak temperature during a single track melt. In [7], a DoE based on a simple thermal model [8] is used to determine optimal process parameters for building high density parts. Also this study shows that the beam power and beam speed have the largest impact on melt pool width and depth. Empirical modelling techniques such as artificial neural networks are also used to determine the optimal selection of process parameters, see, e.g., [9] as well as [10] and references therein.

While DoE is useful for developing a deeper understanding of the melting process, it can be a tedious affair to use them for optimization. An optimal control approach might be better suited for that purpose, as it starts off with preset, desired melt characteristics and seeks corresponding optimal process parameters via a mathematical optimization problem.

Attempts of optimizing melt pool characteristics have been made based on the two-phase Stefan problem, where the free boundary between solid and liquid is understood via the Stefan condition. In the context of PBF, the free boundary characterizes the size and shape of the melt pool. In [11], the two-phase Stefan problem in a container is considered, and the temperature on the container boundary is optimized with respect to a desired transient evolution of the free boundary. Optimization problems based on quasi-steady state formulations of the two-phase Stefan problem are solved in [12, 13]. Here the desired free boundary between liquid and melt is prescribed and the goal involves tracking the melt temperature on the prescribed free boundary.

This paper is part of an effort that aims to reduce the number of parameters needed in the design of melt schemes. We present a simulation based framework that seeks to facilitate process optimization and material development, while keeping computational costs at a minimum. Thus, computational efficiency is prioritized as we trade a certain level of detail for a fast optimization scheme that can be applied to the melting of large domains. The scheme is efficient for three reasons:

  • The continuum thermal model for describing heat conduction includes an analytic solution that allows for fast and pointwise computation of temperatures during melting [14, 15]. The model assumes that the beam parameters are piecewise constant in time. We remark that beam parameters in actual AM machines are often set to vary in such a discontinuous way. The model does not include phase change, and does in particular not capture the solid-liquid interface. Instead, we use the term melt pool to simply denote the region where the temperature is larger than the melt temperature.

  • The formulation of the optimization problem involves a severe model order reduction. Rather than striving for some desired temperature distribution that is difficult to express, the goal consists of tracking preset reference maximum temperatures on lines that run along the beam path.

  • The resulting optimization problem is solved by a greedy algorithm that divides it into several small problems that are easier to solve. These sub-problems are solved consecutively as the beam traverses the powder bed.

Together, this framework comprises an optimization scheme for process control as suggested in [16].

More general approaches were tested and will be further explored in future work. For instance, a full finite element simulation of the heat equation combined with an adjoint-based optimization was implemented. However, this must be made more computationally efficient by appropriate simplifications before it can be used for process optimization. The proposed Greedy algorithm was chosen as a first attempt in this direction.

As noted earlier, DoE suggests that the beam parameters have the largest impact on the temperature distribution during melting and, ultimately, on the quality of the completed part. For this reason, we choose the beam power, spot size and speed as control variables. Our scheme allows for time-dependent beam parameters, which increases their ability to control the melting process. An ability to optimize these beam parameters is useful not only for validation, but also in order to speed up the development of process settings for new (and old) materials. Since optimization is an iterative process, the solver of the forward problem needs to be highly efficient. The analytic solution provides such efficiency.

The remainder of this paper is organized as follows. Section 2 describes the thermal model and its corresponding analytic solution. The optimization problem is formulated in Sect. 3. Section 4 and Sect. 5 propose two greedy algorithms for solving said problem. In Sect. 6 we apply our optimization scheme in numerical examples. Here we also detail how the combination of the two greedy algorithms can aid in the development of so called beam parameter functions. Additional comments and concluding remarks are given in Sect. 7.

Thermal model

Consider the heat equation on the lower half space \(\Omega = \mathbb{R}^{2} \times \mathbb{R}_{-}\) during a time span \(\mathcal{T} = (0, T]\). Let Γ denote the surface boundary \(z = 0\) and let \(u_{\mathrm{init}}\) denote the constant initial temperature. The beam travels on the surface Γ along a preset, piecewise linear path

$$ \mathcal{C}^{\mathrm{s}} = \bigl\{ \boldsymbol{x}^{\mathrm{s}}(t): t \in \mathcal{T}\bigr\} , $$

where \(\boldsymbol{x}^{\mathrm{s}}(t) = (x^{\mathrm{s}}(t), y^{\mathrm{s}}(t), 0)\) is the position of the center of the beam at time t. The heat flux Φ due to a scanning electron beam is modeled as a Gaussian function

$$ \Phi = \Phi (x, y, t) = \frac{P(t)}{2\pi \sigma (t)^{2}}\, \mathrm{exp} \biggl(- \frac{ (x-x^{\mathrm{s}} (t ) )^{2}+ (y-y^{\mathrm{s}} (t ) )^{2}}{2\sigma (t)^{2}} \biggr). $$

The three beam parameters are the absorbed beam power \(P(t)\), the beam spot size \(\sigma (t)\), and the beam speed \(v(t) = |\boldsymbol{v}(t)|\). Here \(\boldsymbol{v}(t) = (v_{x}(t), v_{y}(t), 0) = (v(t)\cos {\theta (t)}, v(t) \sin {\theta (t)}, 0)\), where \(\theta (t)\) is the angle between the positive x-axis and the direction of the path. This angle is known for any t since the beam path \(\mathcal{C}^{\mathrm{s}}\) is preset and it follows that v uniquely defines the vector \((v_{x}, v_{y}, 0)\). The position of the beam \(\boldsymbol{x}^{\mathrm{s}}(t)\) depends on the speed with which the beam has traveled the path \(\mathcal{C}^{\mathrm{s}}\) up to time t. The beam parameters are often set to vary in a piecewise constant fashion in AM machines. The following definition makes the concept of piecewise constant beam parameters more precise.

Definition 1

Given times \(0 = t_{0} < t_{1} < \ldots < t_{N} = T\),

$$ (t_{n-1}, t_{n}] = \bigl(t_{n}^{\mathrm{i}}, t_{n}^{\mathrm{f}} \bigr], \quad n = 1, 2, \ldots , N, $$

is a partition of \(\mathcal{T}\) consisting of N segments. Index n indicates the nth segment in the partition, and a segment in turn is a collection of the following data:

  • \(t_{n}^{\mathrm{i}}\), \(t_{n}^{\mathrm{f}}\); an initial time and final time, respectively,

  • \((P_{n}, \sigma _{n}, v_{n})\); a triplet of power, spot size, and speed such that

    $$ \bigl(P(t), \sigma (t), v(t) \bigr) = (P_{n}, \sigma _{n}, v_{n}) \quad \text{if } t \in \bigl(t_{n}^{\mathrm{i}}, t_{n}^{\mathrm{f}} \bigr], $$
  • \(\ell _{n}^{\mathrm{s}}\); a line traversed by the beam between times \(t_{n}^{\mathrm{i}}\) and \(t_{n}^{\mathrm{f}}\),

  • \(\boldsymbol{x}_{n}^{\mathrm{i}}\), \(\boldsymbol{x}_{n}^{\mathrm{f}}\); the initial position and final position of \(\ell _{n}^{\mathrm{s}}\), respectively.

  • \(\theta _{n} =\mathrm{tan}^{-1} ( \frac{y_{n}^{\mathrm{f}} - y_{n}^{\mathrm{i}}}{x_{n}^{\mathrm{f}} - x_{n}^{\mathrm{i}} } )\); the angle between the positive x-axis and the direction of the path.

With the outward unit normal of Ω, the heat transfer problem can be written as

$$ \begin{aligned} & \rho c_{p} \frac{\partial u}{\partial t} - \nabla \cdot ( \lambda \nabla u) = 0 \quad \text{in } \Omega \times \mathcal{T}, \\ &(\lambda \nabla u) \cdot \hat{z} = \Phi \quad \text{on } \Gamma \times \mathcal{T}, \\ &u(\cdot , 0) = u_{\mathrm{init}} \quad \text{in } \Omega , \end{aligned} $$

where ρ, \(c_{p}\), λ denote density, heat capacity, and thermal conductivity, respectively. These material parameters are assumed to be constant. This gives us the thermal diffusivity \(\kappa = \lambda /\rho c_{p}\). Problem (1) has an analytic solution [14, 15]. We refer to these sources for a detailed derivation of this solution and merely outline it here.

Proposition 1

Given a partition as in Definition 1, the solution of problem (1) can be written as

$$\begin{aligned} u(\boldsymbol{x}, t) &= u_{\mathrm{init}} + \sum_{k=1}^{n-1} u_{n,k}^{\mathrm{I}}(\boldsymbol{x}, t) + u_{n}^{\Phi }( \boldsymbol{x}, t) \quad \textit{for } t \in \bigl(t_{n}^{\mathrm{i}}, t_{n}^{\mathrm{f}} \bigr], n = 1, 2, \ldots , N, \end{aligned}$$

where \(u_{n,k}^{\mathrm{I}}\) is the temperature due to the earlier scanning of segment \(k< n\) and \(u_{n}^{\Phi }\) is the temperature due to the current scanning of segment n.

The analytic expressions of \(u_{n,k}^{\mathrm{I}}\) and \(u_{n}^{\Phi }\) are derived in [15], wherein it also described how the solution can be efficiently computed.

The power is largely determined by the beam current, and this current can not be adjusted at a fast rate. Therefore, P is set to be constant for all \(t \in \mathcal{T}\) for the remainder of this paper. It should be noted, however, that if one would be interested in optimizing all three beam parameters, the following extends to the case of non-constant power as well.

A remark on our thermal model is in order, as it does not include cooling, the latent heat of fusion nor a description of the solid-liquid intersection between powder and melt pool, which makes the notion of a melt pool quite fuzzy. Here we use the term melt pool to simply denote the volume where the temperature is larger than the melt temperature. Hence we use the isothermal \(\{\boldsymbol{x}(t): u(\boldsymbol{x}, t) = u_{\mathrm{melt}}\}\), where \(u_{\mathrm{melt}}\) is the melt temperature of the powder, to represent the solid-liquid interface. Furthermore, since the model is a continuum model, it breaks down on the mesoscale where we see phenomena such as balling, inter-capillary effects, Plateau–Rayleigh instabilities, thermal expansion, among other [17, 18]. Despite these restrictions, it is anticipated that effective parameters, tuned via comparisons with experiments, can be used to make the thermal model reliable enough for control and optimization. The optimization problem described below also aligns with the overarching aim to reduce the number of parameters needed for process control.

Formulation of the optimization problem

The goal is to optimize the melting process with respect to the beam spot size and beam speed. Since these beam parameters are defined in a piecewise constant fashion according to Definition 1, we can write

$$\begin{aligned} \sigma (t) &= \sum_{k=1}^{N} \sigma _{k} \chi _{(t_{k}^{\mathrm{i}}, t_{k}^{\mathrm{f}}]}, \\ v(t) &= \sum_{k=1}^{N} v_{k} \chi _{(t_{k}^{\mathrm{i}}, t_{k}^{\mathrm{f}}]}, \end{aligned}$$

where χ is the indicator function. Since we aim to optimize the speed, either the times \(t_{n}^{\mathrm{i}}\), \(t_{n}^{\mathrm{f}}\) or the positions \(\boldsymbol{x}_{n}^{\mathrm{i}}\), \(\boldsymbol{x}_{n}^{\mathrm{f}}\), \(n = 1, 2, \ldots , N\), in Definition 1 will have to vary during optimization. Due to the beam path being preset and reasons that will become clear in the next section, it is better to fix the positions. Therefore it is more appropriate to express σ and v as space dependent functions instead. To this end, introduce the scanning distance

$$ \gamma \bigl(\boldsymbol{x}^{\mathrm{s}}\bigr) = \sum_{k=1}^{n-1} \bigl|\boldsymbol{x}^{\mathrm{f}}_{k} - \boldsymbol{x}^{\mathrm{i}}_{k}\bigr| + \bigl|\boldsymbol{x}^{\mathrm{s}} - \boldsymbol{x}^{\mathrm{i}}_{n}\bigr|, \quad \text{if } \boldsymbol{x}^{\mathrm{s}} \in \ell _{n}^{s}, n = 1, 2, \ldots , N. $$

Then we have the following beam parameter functions:

$$ \begin{aligned} \sigma \bigl(\gamma \bigl(\boldsymbol{x}^{\mathrm{s}}\bigr) \bigr) &= \sum_{k=1}^{N} \sigma _{k} \chi _{(\gamma (\boldsymbol{x}_{k}^{\mathrm{i}}), \gamma (\boldsymbol{x}_{k}^{\mathrm{f}})]}, \\ v\bigl(\gamma \bigl(\boldsymbol{x}^{\mathrm{s}}\bigr)\bigr) &= \sum _{k=1}^{N} v_{k} \chi _{( \gamma (\boldsymbol{x}_{k}^{\mathrm{i}}), \gamma (\boldsymbol{x}_{k}^{\mathrm{f}})]}. \end{aligned} $$

From (2), a decision vector can immediately be extracted as \(\boldsymbol{d} =(\boldsymbol{\sigma }, \boldsymbol{v}) = \{(\sigma _{k}, v_{k})\}_{k=1}^{N} = ( \sigma _{1}, v_{1}, \sigma _{2}, v_{2}, \ldots , \sigma _{N}, v_{N})\). The variables in the decision vector are bounded due to practical limitations, \(\boldsymbol{d}_{\mathrm{min}} \leq \boldsymbol{d} \leq \boldsymbol{d}_{\mathrm{max}}\).

The control of the melting process is a multiobjective optimization problem due to the many correlations between process parameters, process signatures, and product qualities. The qualities of the final part are strongly dependent on the temperatures obtained during the melting process [19]. The characteristics of the melt pool are important process signatures. If the melt pool is too small relative to the line offset (i.e., the distance between two hatch lines) and layer depth, powder might be left unmelted between hatch lines or between layers, causing discontinuities and porosity. Furthermore, high surface temperatures might result in too much evaporation and subsequent recoil pressure, which can result in undesired material transport such as ejection of molten materials that later cause defects [20] or formations of small ridges that prohibit the deposition of new powder layers and thus cause the manufacturing process to terminate [21]. Qualitatively, therefore, the choice of cost functional can be motivated by the desire to

  1. 1.

    maintain a uniform and appropriately sized melt pool during melting, and

  2. 2.

    avoid too high surface temperatures.

A reductive approach

Consider a beam scanning along a path \(\mathcal{C}^{\mathrm{s}}\). Denote by ω a supposed desired melt pool

$$ \omega (t) = \bigl\{ \boldsymbol{x} \in \Omega : u(\boldsymbol{x}, t) \geq u_{\mathrm{melt}} \bigr\} . $$

It is difficult to express \(\omega (t)\) explicitly. Instead, we consider the final solidified volume. With our purely thermal model, the powder-solid interface of this volume is dependent on the maximum temperature and would be easier to explicitly define than the melt pool \(\omega (t)\). However, even further reductions can be made by isolating particular curves on this powder-solid interface. More precisely, we introduce a secondary path \(\mathcal{C}^{\mathrm{wd}}\) chosen such that it lies on a desired powder-solid interface. The secondary path is related to the beam path by some function \(\mathfrak{F}: \mathcal{C}^{\mathrm{s}} \rightarrow \mathcal{C}^{\mathrm{wd}}\) and we write

$$ \mathcal{C}^{\mathrm{wd}} = \bigl\{ \mathfrak{F}\bigl(\boldsymbol{x}^{\mathrm{s}}(t) \bigr): t \in \mathcal{T}\bigr\} $$

and let \(\boldsymbol{x}^{\mathrm{wd}} = \mathfrak{F}(\boldsymbol{x}^{\mathrm{s}})\). For example, if the beam path consists of one segment, then a simple example of a secondary path is

$$ \mathcal{C}^{\mathrm{wd}} = \bigl\{ \bigl(x^{\mathrm{s}}(t) + w \sin \theta _{1}, \, y^{\mathrm{s}}(t) - w \cos \theta _{1},\, -d\bigr): t \in \mathcal{T}\bigr\} . $$

The idea is that the secondary path relates to \(\mathcal{C}^{\mathrm{s}}\) via a width w and a depth d. With this, the description of the optimal melting reduces to two paths; \(\mathcal{C}^{\mathrm{s}}\) (preset) and \(\mathcal{C}^{\mathrm{wd}}\) (chosen with respect to \(\mathcal{C}^{\mathrm{s}}\)). This reductive approach is illustrated in Fig. 1.

Figure 1

The desire to optimize the size and shape of the melt pool is reduced to a problem of tracking maximum temperatures on paths. (a) Temperature distribution due to a moving beam. (b) Maximum temperature obtained during melting, with the solidified volume highlighted. (c) Introduction of beam path \(\mathcal{C}^{\mathrm{s}}\) and secondary path \(\mathcal{C}^{\mathrm{wd}}\). The secondary path is drawn along the desired liquid-solid interface. (d) Maximum temperature after optimization, with the solidified volume highlighted. The shape of this volume is optimized due to the tracking of reference temperatures \(u_{\mathrm{surf}}\) and \(u_{\mathrm{melt}}\) on \(\mathcal{C}^{\mathrm{s}}\) and \(\mathcal{C}^{\mathrm{wd}}\), respectively.

As we shall see in the following section, the steps taken above allow us to formulate a simple optimization problem that is efficient in the sense that we, instead of tracking some desired transient melt pool \(\omega (t)\) in a volume, only track two scalar values \(u_{\mathrm{melt}}\) and \(u_{\mathrm{surf}}\) on paths.

Mathematical formulation

Following the reduction in Sect. 3.1, we are now interested in maximum temperatures on paths running along the beam path since these temperatures determine the size of the subsequent solidified volume. Before we formulate the problem, we need the following.

Definition 2

(Hatch line)

Given a partition as in Definition 1, two segments k and \(k+1\), \(1\leq k < N-1\), are connected if \(\boldsymbol{x}_{k}^{\mathrm{f}} = \boldsymbol{x}_{k+1}^{\mathrm{i}}\). A sequence \(\{i\}_{i=k}^{K}\) of connected segments form a hatch line if \(\theta _{n} = \theta _{m}\) \(\forall n, m \in [k, K]\) and \(\theta _{k-1} \neq \theta _{k}\) and \(\theta _{K} \neq \theta _{K+1}\).

The total number of hatch lines M satisfies \(1\leq M \leq N\).

Define also the maximum temperature field

$$\begin{aligned} \mathcal{M}(\boldsymbol{x}; \boldsymbol{d}) = \max_{t\in \mathcal{T}} \bigl\{ u ( \boldsymbol{x}, t; \boldsymbol{d} )\bigr\} . \end{aligned}$$

We want \(\mathcal{M}(\boldsymbol{x}; \boldsymbol{d}) = u_{\mathrm{melt}}\) for all x on \(\mathcal{C}_{i}^{\mathrm{wd}}\) in order to ensure a uniform and thorough melting. Similarly, \(\mathcal{M}(\boldsymbol{x}; \boldsymbol{d})\) should not exceed some maximum allowed temperature \(u_{\mathrm{surf}}\) on \(\mathcal{C}^{\mathrm{s}}\).

The resulting objective vector becomes

$$ f(\boldsymbol{d}) = \bigl\{ f_{1}(\boldsymbol{d}), f_{2}(\boldsymbol{d}) \bigr\} ,$$


$$ \begin{aligned} f_{1}(\boldsymbol{d}) &= \int _{\mathcal{C}^{\mathrm{wd}}} \alpha \bigl( \boldsymbol{x}^{\mathrm{wd}}\bigr) \cdot \bigl(\mathcal{M}\bigl(\boldsymbol{x}^{\mathrm{wd}}; \boldsymbol{d}\bigr) - u_{\mathrm{melt}} \bigr)^{2} \,\mathrm{d}x, \\ f_{2}(\boldsymbol{d}) &= \int _{\mathcal{C}^{\mathrm{s}}} \alpha \bigl(\boldsymbol{x}^{\mathrm{s}}\bigr) \cdot \bigl(\mathcal{M}\bigl(\boldsymbol{x}^{\mathrm{s}}; \boldsymbol{d}\bigr) - u_{\mathrm{surf}} \bigr)^{2} \,\mathrm{d}x. \end{aligned} $$


$$ \alpha (\boldsymbol{x}) = \textstyle\begin{cases} 0 &\text{if }\boldsymbol{x} \text{ is near the start or end of a hatch line,} \\ 1 &\text{otherwise} \end{cases} $$

is a weight that excludes intervals from the cost functional if they are very close to the start point or end point of a hatch line. This type of weight is inserted because the total heat supplied to a region near a start point, for instance, is comparatively small since the beam only moves away from it rather than passing it. As a consequence, it can be difficult to reach the reference temperatures in these regions and if included, they deteriorate the overall performance of the optimizer. Therefore, it is better to ignore these intervals in the goal functional and instead let them be covered by the contouring stage, in which the beam scans along the boundary of the shape being melted. The contouring stage also improves the surface finish of the part [22]. Effectively, this choice of α simply means that the domains of integration in (4) become slightly smaller.

The functionals (4) are of tracking type where we use the \(L_{2}\) norm to minimize the distances between the actual maximum temperature and the desired maximum temperatures. The reason for tracking these temperatures rather than putting constraints on the temperature is that we want to control the shape and size of the melt pool not the temperature itself. The reason for tracking also the surface temperature is that it helps restricting the shape of the melt pool. Without this restriction, one could potentially end up with an extremely wide and shallow type of melting, for instance. However, it leads to multiobjective optimization. We also note that the functionals (4) are nondifferentiable, because \(\mathcal{M}(\boldsymbol{x}; \boldsymbol{d}) \) is not differentiable with respect to u due to the evaluation of the maximum. Both these facts make the resulting optimization problem more difficult. We show in Sect. 6 how these difficulties can be overcome.

The analytic solution presented in Sect. 2 allows for pointwise computations of temperatures, and that is why we can easily compute temperatures on lines, which saves a large amount of computation time compared to doing so on surfaces or in volumes. This remark highlights a big motivation behind the reduction carried out in Sect. 3.1.

The objective vector (3) needs to be translated into a scalar valued cost functional in order to use standard nonlinear programming solvers. We use a scalarization known as the weighting method. In this method the weighted sum of the objectives is minimized. We introduce weights \(W_{i} \geq 0\), \(i = 1, 2\). The scalarized optimization problem becomes

$$ \begin{aligned} &\text{minimize} \quad J( \boldsymbol{d}) = W_{1} f_{1}(\boldsymbol{d}) + W_{2} f_{2}( \boldsymbol{d}) \\ &\quad \text{subject to} \\ &\qquad \text{state eq. (1)},\qquad \text{(PDE constraint)} \\ &\qquad \boldsymbol{d}_{\mathrm{min}} \leq \boldsymbol{d} \leq \boldsymbol{d}_{\mathrm{max}}. \qquad \text{(Parameter constraint)} \end{aligned} $$

The choice of weights should represent the relative importance of the objectives; important objectives are weighted more heavily.

A first greedy algorithm for solving the scalarized optimization problem

In order to speed up the optimization, we propose a method that makes use of the fact that the melt pool, and hence maximum temperatures, are localized to the beam. The proceeding involves a division of \(\mathcal{T}\) into subintervals on the form \(\bigcup_{i=p}^{q} (t_{i}^{\mathrm{i}}, t_{i}^{\mathrm{f}}]\). Local optimization problems are solved on these subintervals and optimal parameter pairs \((\sigma _{p}, v_{p})\) are frozen sequentially. When given parameter pair(s) has been frozen, the local problem is translated in time (and space) and the initial condition is updated. As such, this greedy type of algorithm divides the optimization problem (6) into several smaller optimization problems that are faster to solve.

The goal functional in (6) involves maximum temperatures over time near the beam path, which is a property that is local to the beam itself. Given a point P on, say, \(\mathcal{C}^{\mathrm{s}}\), it is known that P will obtain its largest temperature during a time window when the beam, and the melt pool it generates, passes P. Therefore, it is the values of the beam parameters during this particular time window that has the highest influence on maximum temperature at P. The reasoning is similar for a point on \(\mathcal{C}^{\mathrm{wd}}\), the only difference being that it takes slightly longer to reach the maximum temperature on \(\mathcal{C}^{\mathrm{wd}}\) since heat diffusion is not an instantaneous process. Therefore, we decide to split the optimization problem (6) into multiple subproblems that are solved sequentially in time while parameter pairs are frozen as we go along.

In order to formalize the method, we make the following definition.

Definition 3

\(\mathrm{(Window).}\) Given a partition as in Definition 1, a time window \(\mathcal{T}_{p, q}=\cup _{i = p}^{q} (t_{i}^{\mathrm{i}}, t_{i}^{\mathrm{f}}]\) is defined as a set of adjacent segments in \(\mathcal{T}\). The size of \(\mathcal{T}_{p, q}\) is the number of segments that constitutes it. The local beam path and local secondary path corresponding to \(\mathcal{T}_{p, q}\) are given by

$$\begin{aligned} \mathcal{C}_{p, q}^{\mathrm{s}} &= \bigl\{ \boldsymbol{x}^{\mathrm{s}}(t): t \in \mathcal{T}_{p, q}\bigr\} , \\ \mathcal{C}_{p, q}^{\mathrm{wd}} &= \bigl\{ \boldsymbol{x}^{\mathrm{wd}}(t): t \in \mathcal{T}_{p, q}\bigr\} . \end{aligned}$$

Hence the beam traverses the path \(\mathcal{C}_{p, q}^{\mathrm{s}}\) during time \(\mathcal{T}_{p, q}\).

Define a local decision vector \(\boldsymbol{d}_{p, q} = \{(\sigma _{k}, v_{k})\}_{k=p}^{q}\) and a local maximum temperature field

$$\begin{aligned} \mathcal{M}_{p,q}(\boldsymbol{x};\boldsymbol{d}_{p, q}) = \max _{t\in \mathcal{T}_{p, q}} \bigl\{ u (\boldsymbol{x}, t; \boldsymbol{d}_{p, q} )\bigr\} . \end{aligned}$$

Similarly, we define the local objectives

$$\begin{aligned} g_{1}(\boldsymbol{d}_{p, q}) &= \int _{\mathcal{C}_{p, q}^{\mathrm{wd}}} \beta _{p, q}\bigl(\boldsymbol{x}^{\mathrm{wd}} \bigr) \cdot \alpha \bigl(\boldsymbol{x}^{\mathrm{wd}}\bigr) \cdot \bigl( \mathcal{M}_{p, q}\bigl(\boldsymbol{x}^{\mathrm{wd}}; \boldsymbol{d}_{p, q} \bigr) - u_{\mathrm{melt}} \bigr)^{2} \,\mathrm{d}s, \\ g_{2}(\boldsymbol{d}_{p, q}) &= \int _{\mathcal{C}_{p, q}^{\mathrm{s}}} \beta _{p, q}\bigl(\boldsymbol{x}^{\mathrm{s}} \bigr) \cdot \alpha \bigl(\boldsymbol{x}^{\mathrm{s}}\bigr) \cdot \bigl( \mathcal{M}_{p, q}\bigl(\boldsymbol{x}^{\mathrm{s}}; \boldsymbol{d}_{p, q} \bigr) - u_{\mathrm{surf}} \bigr)^{2} \,\mathrm{d}s. \end{aligned}$$

Here \(\beta _{p, q}\) is used to prioritize minimization of the errors over the earlier segments in the window. This weight accentuates the error on the segment(s) that is about to become frozen and it plays a crucial role; since the greedy algorithm never returns to a segment once it has been frozen it is important that the solver prioritizes this segment. Here we let \(\beta _{p, q}\) be piecewise constant over the segments and determined by a function that decreases quadratically along \(\mathcal{C}_{p, q}^{\mathrm{s}}\). See Fig. 2. Formally, we have

$$ \beta _{p, q}\bigl(\boldsymbol{x}^{\mathrm{s}}\bigr) = \chi _{(\gamma (\boldsymbol{x}_{p}^{\mathrm{i}}), \gamma (\boldsymbol{x}_{p+r}^{\mathrm{i}})]} + \sum_{k=p+r}^{q-1} \biggl( \frac{\gamma (\boldsymbol{x}^{\mathrm{f}}_{q}) - \gamma (\boldsymbol{x}_{k}^{\mathrm{i}})}{\gamma (\boldsymbol{x}^{\mathrm{f}}_{q}) -\gamma (\boldsymbol{x}^{\mathrm{k}}_{p})} \biggr)^{2} \chi _{(\gamma (\boldsymbol{x}_{k}^{\mathrm{i}}), \gamma (\boldsymbol{x}_{k}^{\mathrm{f}})]} $$

on \(\mathcal{C}_{p,q}^{\mathrm{s}}\). We define \(\beta _{p, q}(\boldsymbol{x}^{\mathrm{wd}})\) in a similar fashion. The choice of a quadratic underlying function is based on tests that investigate how the weight affects the optimization results.

Now, by employing the same scalarization as for the global problem (6), the resulting scalarized subproblem becomes

$$ \begin{aligned} &\text{minimize} \quad J_{p, q}(\boldsymbol{d}_{p, q}) = W_{1} g_{1}( \boldsymbol{d}_{p, q}) + W_{2} g_{2}(\boldsymbol{d}_{p, q}) \\ &\quad \text{subject to} \\ &\qquad \text{state eq. (1)},\qquad \text{(PDE constraint)} \\ &\qquad \boldsymbol{d}_{{p, q}_{\mathrm{min}}} \leq \boldsymbol{d}_{p, q} \leq \boldsymbol{d}_{{p, q}_{\mathrm{max}}}. \qquad \text{(Parameter constraint)} \end{aligned} $$

We can now formulate the greedy algorithm. This is done in Algorithm 1, and some complementary comments are given below. An illustration of the main idea is given in Fig. 3.

Algorithm 1

Greedy algorithm for finding an approximate solution of the scalarized problem (6). Note that \(q-p+1\) equals the size of the current window.

Figure 2

The weight \(\beta _{p, q}\) is based on a quadratic function that decreases along the local beam path \(\mathcal{C}_{p,q}^{\mathrm{s}}\). It is piecewise constant, largest on the first r segments in the window since they are about to be frozen (see Algorithm 1), and takes different values over the remaining segments. The weight is identical for the local secondary path \(\mathcal{C}_{p,q}^{\mathrm{wd}}\).

Figure 3

The greedy algorithm divides the optimization problem (6) into several smaller optimization problems that are easier to solve. The procedure involves a division of the beam path into subintervals. Localized optimization problems are solved on these intervals and optimal parameters are frozen in steps. After each such step, a new sub-problem is created by translating in time (ans space) and updating the initial condition. Here \(q=p+3\) and \(r=1\) (see Algorithm 1).


Future parameter pairs are updated as well, because the values found in the current window are likely a better guess than the initial one.


The segments corresponding to the frozen parameter pairs are removed from the window. In the implementation, certain checks can be made to determine whether freezing should take place or not (as in, the amount of pairs to freeze). We leave out the details.


The window size is updated in preparation for the next iteration. The min operator is used to handle the ending when \(q=N\). Note also that the parameters q and r may depend on p (i.e., on the location of the window). For instance, in a region where the beam path is complex or where the lengths of the segments are small, we might require a large window size \(q-p+1\), and hence a large q. Furthermore, the size of the melt pool should be taken into account when choosing the value of q.

The presented greedy algorithm can be utilized as a standalone tool for process optimization. If the beam path consists of N segments, the total number of parameters to optimize becomes 2N. Now, depending on the design of the layer being melted, the value of N may be very high. In the next section we present a second version of the greedy algorithm that has the ability to significantly lower the size of the decision vector.

A second greedy algorithm based on fitting beam parameter functions

The greedy algorithm of this section expands on an example in [15]. As we shall see, it is similar to Algorithm 1 in most regards, but it is based on educated guesses of how the beam parameters should behave.

Recall from (2) the expression for piecewise constant beam parameters. The subsequent optimization makes no assumption on the behavior of the beam parameters along the beam path. An alternative approach is to do curve fitting of prespecified beam parameter functions. To this end, we write

$$ \begin{aligned} \sigma \bigl(\boldsymbol{x}^{\mathrm{s}}\bigr) = \sum _{k=1}^{N} F^{\sigma }\bigl( \boldsymbol{x}_{k}^{\mathrm{i}}; \boldsymbol{\Lambda }^{\sigma }\bigr) \chi _{(\gamma (\boldsymbol{x}_{k}^{\mathrm{i}}), \gamma (\boldsymbol{x}_{k}^{\mathrm{f}})]}, \\ v\bigl(\boldsymbol{x}^{\mathrm{s}}\bigr) = \sum_{k=1}^{N} F^{v}\bigl(\boldsymbol{x}_{k}^{\mathrm{i}}; \boldsymbol{\Lambda }^{v}\bigr) \chi _{(\gamma (\boldsymbol{x}_{k}^{\mathrm{i}}), \gamma ( \boldsymbol{x}_{k}^{\mathrm{f}})]}, \end{aligned} $$

where \(\boldsymbol{\Lambda } = (\boldsymbol{\Lambda }^{\sigma }, \boldsymbol{\Lambda }^{v})\), the coefficients in our beam parameter functions, become our new decision vector that we want to optimize. Given a decision vector, the beam parameters are then evaluated as (see (2))

$$\begin{aligned} \sigma _{k} &= F^{\sigma }\bigl(\boldsymbol{x}_{k}^{\mathrm{i}}; \boldsymbol{\Lambda }^{\sigma }\bigr), \\ v_{k} &= F^{v}\bigl(\boldsymbol{x}_{k}^{\mathrm{i}}; \boldsymbol{\Lambda }^{v}\bigr). \end{aligned}$$

These parameter functions are defined with respect to the hatch lines as

$$ \left . \textstyle\begin{array}{l} F^{\sigma }(\boldsymbol{x}^{\mathrm{s}}; \boldsymbol{\Lambda }^{\sigma }) = F_{l}^{\sigma }( \boldsymbol{x}^{\mathrm{s}}; \boldsymbol{\Lambda }_{l}^{\sigma }) \\ F^{v}(\boldsymbol{x}^{\mathrm{s}}; \boldsymbol{\Lambda }^{v}) = F_{l}^{v}(\boldsymbol{x}^{\mathrm{s}}; \boldsymbol{\Lambda }_{l}^{v}) \end{array}\displaystyle \right \} \quad \text{if } \boldsymbol{x}^{\mathrm{s}}\text{on hatch line } l. $$

The reason for splitting \(F^{\sigma }\) and \(F^{v}\) between hatch lines is that a new hatch line often requires a rapid jump in beam parameter values.

It follows from Definition 2 that hatch lines can simply be seen as an intermediate level between the segments and the beam path. Let \(\mathcal {S}:\{1, \ldots , M\} \rightarrow \{1, \ldots , N\}\) be an injective function that, given a hatch line m, returns the first segment in m. Let \(\mathcal {L}: \{1, \ldots , N\} \rightarrow \{1, \ldots , M\}\) be a surjective function that, given segment n, returns the hatch line that contains it. With these two functions it is possible to seamlessly work with both hatch lines and segments. For instance, the local beam path that consists of hatch lines 1 to 3 is \(\mathcal{C}_{\mathcal {S}(1),\,\mathcal {S}(4)-1}^{\mathrm{s}}\).

In terms of implementation, the second greedy algorithm is in many ways similar to the first greedy algorithm from the previous Sect. 4. They both rely on Definition 1 and piecewise constant beam parameters and they both solve subproblems of the form (7). What separates them is the content of the decision vector d as illustrated in Fig. 4. In essence, the first algorithm optimizes the beam parameters segmentwise while the second algorithm optimizes the beam parameters linewise. The second greedy algorithm is detailed in Algorithm 2.

Figure 4

Difference between the two greedy algorithms. In the second version (b), the additional step significantly reduces the dimension of the decision vector if the number of lines is much smaller than the number of segments, i.e., if \(M \ll N\).

Algorithm 2

Second greedy algorithm for finding an approximate solution of the scalarized problem (6). It is in many ways similar to the first Algorithm 1, but uses a different decision vector d. Note that indices p, q and r now count over hatch lines instead of over segments.

Numerical examples and discussion

We apply the greedy algorithm on a couple of single layer problems. The scalarized subproblems (7) are solved with the L-BFGS-B optimization algorithm [23, 24] provided by the optimization package of SciPy [25]. Given some iterate \(\hat{\boldsymbol{d}}_{p, q}\), scipy.optimize approximates the gradient of \(J_{p,q}(\hat{\boldsymbol{d}}_{p, 1})\) using a 2-point finite difference estimation. Then L-BFGS-B, which is a quasi-Newton method, approximates the Hessian that enters in the local quadratic approximation of \(J_{p,q}(\hat{\boldsymbol{d}}_{p, q})\). The solver options are selected to fit the scale of the problems considered here.

It is worth noting that the objective \(J_{p, q}\) is not differentiable. At an initial stage, not only L-BFGS-B but also some gradient free methods were tested, and L-BFGS-B performed the best out of all solvers in those trials. It is not remarkable that L-BFGS-B performs well on nonsmooth problems as well (although we can not expect the same convergence as for a smooth optimization problem) [26]. On a related note, in the implementation we relax the scalarized subproblem (7) somewhat by replacing the (local) maximum temperature field \(\mathcal{M}_{p,q}(\boldsymbol{x};\boldsymbol{d}_{p, q})\) with an approximation,

$$ \mathcal{M}_{p,q}(\boldsymbol{x};\boldsymbol{d}_{p, q}) \approx \frac{1}{K} \log \biggl( \int _{\mathcal{T}_{p, q}} \exp \bigl(K \cdot u(\boldsymbol{x}, s; \boldsymbol{d}_{p, q})\bigr) \,\mathrm{d}s \biggr), $$

for an appropriate scalar K, which improves performance slightly. Finally, while the choice of starting point/initial decision vector can have a large impact on the performance of the optimizer, efforts related to this choice are not the main focus here and so disregarded.

It is important to emphasize that for practical use of the optimization scheme, the material data that enter the thermal model need to be fit with respect to experiments or a more detailed model. The determination of effective parameters is crucial since the model is simple and based on several assumptions. In the following examples we use material parameters that represent Ti-6Al-4V.

In the current implementation of the beam scanning, there are no pauses between any segments during melting. For instance, a jump from one hatch line to the next is instantaneous. However, adding delay time for jumps is straightforward.

Example 1: segmentwise optimization on snake pattern

We illustrate how the optimization scheme resolves certain heating related issues. The beam path is shown in Fig. 5. It consists of 50 segments, each with length 0.5 mm. The line offset during hatching is \(l_{\mathrm{off}} = 200~\mu \mathrm{m}\). The hatching is performed in a snake-like manner in the upward y-direction. The weight \(\alpha (\boldsymbol{x})\) (see (5)) is zero on the first 0.4 mm and last 0.4 mm of a hatch line. While this beam path amounts to a simple rectangular shape, it still allows for several types of investigations.

Figure 5

Beam path in Example 1: 5 hatch lines with length 5 mm. The path consists of 50 segments that are separated by the small ticks. The line offset (i.e., the distance between two adjacent lines) is 200 μm. The thin gray lines indicate the secondary path \(\mathcal{C}^{\mathrm{wd}}\).

The secondary path is set to

$$ \mathcal{C}^{\mathrm{wd}} = \bigl\{ \bigl(x^{\mathrm{s}}(t), y^{\mathrm{s}}(t) + w, - d\bigr): t \in \mathcal{T}\bigr\} . $$

To avoid porosity, w and d need be chosen such that unmelted gaps between lines are avoided. Here we set \(w = l_{\mathrm{off}}/2 = 100~\mu \mathrm{m}\) and \(d = 50~\mu \mathrm{m}\). A complete list of parameter values is given in Table 1. Figure 6 shows the solution of (6) as obtained by the greedy Algorithm 1. We see rapid variations in the optimized beam parameters, in particular close to the turning points where they seek to neutralize the concentrated influx of heat that occur in those regions. Problem (1) is then solved for the optimized beam parameters and the resulting maximum temperature in various slices of the domain is shown in Figs. 7, 8, and 9. These figures include the initial maximum temperature for comparison. The results indicate that despite the reductions leading up to its formulation, the greedy algorithm is able to control the heat generated during melting to a rather large degree.

Figure 6

The solution as obtained by the first greedy algorithm. The dotted parts indicate the intervals where the weight α is 0 (the start and end of the hatch lines).

Figure 7

A comparison between maximum temperatures on the surface (\(z = 0\)) before optimization (top) and after optimization. The optimization scheme resolves the heat accumulation at the turning points.

Figure 8

A comparison between maximum temperatures in the cross-section \(x = 2.5\text{ mm}\) before optimization (top) and after optimization. Initially, the melt area increases for each hatch line since the heat influx is larger than the rate of diffusion. The optimization scheme resolves this issue and makes the area more uniform.

Figure 9

A comparison between maximum temperatures in the cross-section \(y = 2 \, l_{\mathrm{off}} = 0.4\text{ mm}\) (i.e., along the 3rd hatch line) before optimization (top) and after optimization. The depth of the melt area is reduced and made more uniform. The domain is scaled by a factor 10 in the vertical direction.

Table 1 Parameter values in Example 6.1.

One concern with the greedy algorithm is that it carries with it several uncertainties. Many trials are required to find proper values for the parameters that make up the scheme, such as α, the window size and segment lengths, since they depend on the beam path and thermal diffusivity.

Example 2: segmentwise optimization on nonparallel pattern

We melt the first quadrant of an annulus. The annulus has an inner radius \(r_{i}=1\,\mathrm{mm}\) and outer radius \(r_{o}=5\,\mathrm{mm}\). The beam path is shown in Fig. 10. It consists of 19 lines of length \(4\,\mathrm{mm}\). Two adjacent lines differ by an angle of \(5{}^{\circ }\). Consequently, the distance between them at \(r_{i}\) and \(r_{o}\) are about \(87\,\mu \mathrm{m}\) and \(436\,\mu \mathrm{m}\), respectively. Each line is divided into 8 segments of equal length \(0.5\,\mathrm{mm}\). The hatching is performed in the counter-clockwise direction. The thin gray lines indicate the secondary path \(\mathcal{C}^{\mathrm{wd}}\). Once again, the weight \(\alpha (\boldsymbol{x})\) is zero on the first \(0.4\,\mathrm{mm}\) and last \(0.4\,\mathrm{mm}\) of a hatch line. The remaining parameters are identical to the ones used in the previous example and are listed in Table 1.

Figure 10

Beam path in Example 2 for melting the first quadrant of an annulus with \(r_{i} = 1\text{ mm}\) and outer radius \(r_{o} = 5\text{ mm}\). The entire beam path consists of 19 lines of length 4 mm. Each line is divided into 8 segments of equal length 0.5 mm. Only the blue part, \(\mathcal{C}^{\mathrm{s}}\), of the entire beam path is considered during optimization and the results from this optimization is then extended to the entire beam path. The path consists of 40 segments that are separated by the small ticks. The thin gray lines indicate the secondary path \(\mathcal{C}^{\mathrm{wd}}\).

Only the blue part of the beam path is considered during optimization. More precisely, we apply the greedy algorithm on the first 5 lines only. The results from this optimization is then extended by letting the beam parameters on lines 6-19 equal the optimal beam parameters on line 5.

Figure 11 shows the solution of the optimization problem. The speed increases along each hatch line since the width between a hatch line and the corresponding secondary path decreases as the hatch line approaches \(r=1\,\mathrm{mm}\) (see Fig. 10).

Figure 11

Optimal beam parameters in the second example, as obtained by the first greedy algorithm. The dotted parts indicate the places where the weight α is 0 (the start and end of the hatch lines). The parameter values start to stabilize somewhat by the fifth line. This motivates us to copy the parameter values for the fifth line to the remaining lines 6-19 that were omitted in the optimization.

After having extended this solution to the entire beam path, problem (1) is solved for the optimized beam parameters and the resulting maximum temperature is shown in Figs. 12 and 13. These figures include the initial maximum temperatures for comparison.

Figure 12

A comparison between maximum temperatures on the surface (\(z = 0\)) before optimization (top) and after optimization. The optimization scheme resolves the heat accumulation near the inner radius of the annulus. The optimized maximum surface temperature appears slightly jagged along the beam path, which suggests that the segment length of 0.5 mm is too big.

Figure 13

A comparison between maximum temperatures on the (extended) secondary path and (extended) beam path. The reference temperatures \(u_{\mathrm{melt}} = 1800\) K and \(u_{\mathrm{surf}} = 2800\) K are successfully tracked.

The plots in Fig. 13 confirm that the extension of the solution onto remaining lines 6-19 works well. While the temperature on \(\mathcal{C}^{\mathrm{wd}}\) increases near the inner radius of the annulus as the scanning progresses, this increase is small and does not justify applying the greedy algorithm on the entire beam path, 19 lines, rather than just 5 lines. This is just a small example of how the results from the greedy algorithm on a very small section can be utilized on larger sections of the build area. In general, this procedure offers an efficient method for improving process control: first examine and optimize typical problematic melting scenarios, then combine the results and extend them to the remainder of the layer.

Example 3: linewise optimization on snake pattern

We now use the second greedy algorithm to solve the problem introduced in the first example, Sect. 6.1, and compare the results with the results obtained by the first greedy algorithm. Motivated by the solution obtained by the first greedy algorithm, see Fig. 6, we make the following ansatz. Let

$$ \boldsymbol{\Lambda }_{l} = \bigl(\boldsymbol{\Lambda }_{l}^{\sigma }, \boldsymbol{\Lambda }_{l}^{v}\bigr) = \bigl(C_{1, l}^{\sigma }, C_{2, l}^{\sigma }, C_{3, l}^{\sigma }, C_{4, l}^{\sigma }, C_{1, l}^{v}, C_{2, l}^{v}, C_{3, l}^{v}, C_{4, l}^{v}\bigr) $$


$$ \begin{aligned} F_{l}^{\sigma }\bigl( \boldsymbol{x}^{\mathrm{s}}; \boldsymbol{\Lambda }_{l}^{\sigma }\bigr) &= C_{1, l}^{\sigma } \biggl(1 + \frac{C_{2, l}^{\sigma }}{1+C_{3, l}^{\sigma }(\gamma ({\boldsymbol{x}^{\mathrm{s}}}) - \gamma (\boldsymbol{x}_{\mathcal{S}(l)}^{\mathrm{i}}))^{C_{4, l}^{\sigma }}} \biggr), \\ F_{l}^{v}\bigl(\boldsymbol{x}^{\mathrm{s}}; \boldsymbol{\Lambda }_{l}^{v}\bigr) &= C_{1, l}^{v} \biggl(1 + \frac{C_{2, l}^{v}}{1+C_{3, l}^{v}(\gamma ({\boldsymbol{x}^{\mathrm{s}}}) - \gamma (\boldsymbol{x}_{\mathcal{S}(l)}^{\mathrm{i}}))^{C_{4, l}^{v}}} \biggr), \end{aligned} $$

for \(l = 1, \ldots , M\). Hence we associate 8 coefficients with each hatch line. From the beam path in Fig. 5, we have \(M=5\). We solve optimization problem (6) according to Algorithm 2. The window always consist of 1 hatch line, i.e., 10 segments. The results are shown in Fig. 14. The solution obtained by the first greedy algorithm is included for comparison. The results are similar. The corresponding optimal objectives \(J^{\mathrm{opt}}\) are similar as well, as \(J^{\mathrm{opt}}=124.18\) with the second greedy algorithm and \(J^{\mathrm{opt}}=123.03\) with the first greedy algorithm (\(J^{\mathrm{init}} = 1655.21\)).

Figure 14

The solution as obtained by the second greedy algorithm. The solution is a piecewise constant discretization of the beam parameter functions \(F^{\sigma }\) and \(F^{v}\) in (9). The solution obtained by the first greedy algorithm is included for comparison.

We end this section with a comparison between the first greedy algorithm and the second greedy algorithm. The first algorithm from Sect. 4 optimizes the beam parameters segmentwise. It can be applied to general beam paths and there are no restrictions on the window. In particular it and can be used to look at specific problematic areas of the layer being melted in order to get an understanding of how the beam parameter functions should behave in those areas.

The second greedy algorithm from Sect. 5 optimizes the beam parameters linewise. This makes the second algorithm preferable in practical problems because it significantly decreases the dimension of the decision space; the number of lines M is much lower than the number of segments N. In the above example, the hatch lines are fairly short, but we still get \(40=8M<2N=100\) when comparing dimensions of the two decision spaces. For more realistic problems the number of segments could be orders of magnitude larger, making the second greedy algorithm more attractive.

The potential drawback of the second algorithm is that it might be difficult to make the initial ansatz for the beam parameter functions since they depend on the beam path (and secondary path). However, this is where the first algorithm can be utilized to give an initial estimate that shows the behavior of the desired beam parameters. This approach is what enabled us to choose the beam parameter functions in (9). For the future, we imagine the development of a database of parameter functions that have been generated for different melting scenarios and that can be shared and used in other, more detailed models.


We have formulated an optimization scheme for controlling the heat conduction during the melting process in powder-bed-based additive manufacturing. The scheme is efficient because it exploits that the melt pool is local to the beam and shows good capabilities despite several simplifications. The current choice of objectives prioritizes speed since it only requires temperature evaluations on lines rather than in entire volumes. The scheme should be useful for studying problematic areas of the melting process where particular care needs to be put into the choice of beam parameters.

The optimization scheme relies on a greedy algorithm. Two versions of a greedy algorithm have been presented and applied in this paper. The first one carries out optimization segmentwise, which makes it applicable to many types of beam paths. The second one carries out optimization linewise, which can significantly reduce the dimension of the decision space. While the two algorithms are similar, they serve different purposes and we have detailed how they can be combined to improve process control.

The examples considered in this paper are fairly small. For more realistic problems the number of segments could be orders of magnitude larger. By design, the greedy algorithm becomes more attractive as the total amount of segments in the beam path increases; the division of the global problem (6) into subproblems (7) becomes more beneficial, relatively speaking, as N (and M) increases. Furthermore, the examples are purely numerical. It is currently difficult to compare the results in Sect. 6 with experiments because existing machines lack the functionality required to match our numerical results. Because of this, a crucial next step is to implement the necessary code in the machine such that experimental validation becomes possible. Experiments are also needed for the generation of effective parameters; the analytic model is very simple and since it contains few parameters, they need to be carefully fit against experiments.

The optimization method also needs to be complemented with different types of testing. It requires effective reference temperatures \(u_{\mathrm{melt}}\), \(u_{\mathrm{surf}}\). Furthermore, the weights and the secondary path \(\mathcal{C}^{\mathrm{wd}}\) need to be carefully chosen. Work related to this kind of testing has not been detailed here.

Availability of data and materials

Not applicable.



Additive Manufacturing


Design of Experiments


Powder Bed Fusion


  1. 1.

    Heinl P, Müller L, Körner C, Singer RF, Müller FA. Cellular Ti–6Al–4V structures with interconnected macro porosity for bone implants fabricated by selective electron beam melting. Acta Biomater. 2008;4(5):1536–44.

    Article  Google Scholar 

  2. 2.

    Mani M, Lane B, Donmez MA, Feng S, Moylan S, Fesperman R. Measurement science needs for real-time control of additive manufacturing powder bed fusion processes. Technical report. Gaithersburg, MD: National Institute of Standards and Technology; 2015. NIST Interagency/Internal Report (NISTIR).

  3. 3.

    King WE, Anderson AT, Ferencz RM, Hodge NE, Kamath C, Khairallah SA, Rubenchik AM. Laser powder bed fusion additive manufacturing of metals; physics, computational, and material challenges. Appl Phys Rev. 2015;2(4).

  4. 4.

    Markl M, Körner C. Multi-scale modeling of powder-bed-based additive manufacturing. Annu Rev Mater Res. 2016;46:93–123.

    Article  Google Scholar 

  5. 5.

    Zeng K, Pal D, Stucker B. A review of thermal analysis methods in laser sintering and selective laser melting. In: Solid freeform fabrication symposium. 2012. p. 796–814.

    Google Scholar 

  6. 6.

    Ma L, Fong J, Lane B, Moylan S, Filliben J, Heckert A, Levine L. Using design of experiments in finite element modeling to identify critical variables for laser powder bed fusion. In: Solid freeform fabrication symposium. 2015. p. 219–28.

    Google Scholar 

  7. 7.

    Kamath C, El-dasher B, Gallegos GF, King WE, Sisto A. Density of additively-manufactured, 316L SS parts using laser powder-bed fusion at powers up to 400 W. Int J Adv Manuf Technol. 2014;74(1):65–78.

    Article  Google Scholar 

  8. 8.

    Eagar TW, Tsai N-S. Temperature fields produced by traveling distributed heat sources. Weld Res Suppl. 1983;62:346–55.

    Google Scholar 

  9. 9.

    Ning Y, Fuh JYH, Wong YS, Loh HT. An intelligent parameter selection system for the direct metal laser sintering process. Int J Prod Res. 2004;42(1):183–99.

    Article  Google Scholar 

  10. 10.

    Garg A, Tai K, Savalani MM. State-of-the-art in empirical modelling of rapid prototyping processes. Rapid Prototyping J. 2014;20(2):164–78.

    Article  Google Scholar 

  11. 11.

    Hinze M, Ziegenbalg S. Optimal control of the free boundary in a two-phase Stefan problem. J Comput Phys. 2007;223(2):657–84.

    MathSciNet  Article  MATH  Google Scholar 

  12. 12.

    Volkov O, Protas B, Liao W, Glander DW. Adjoint-based optimization of thermo-fluid phenomena in welding processes. J Eng Math. 2009;65(3):201–20.

    MathSciNet  Article  MATH  Google Scholar 

  13. 13.

    Cao X, Ayalew B. Partial differential equation-based multivariable control input optimization for laser-aided powder deposition processes. ASME J Manuf Sci Eng. 2015;138(3):031001.

    Article  Google Scholar 

  14. 14.

    Malmberg JB, Wallenås M. Solving the heat equation in connection with electron beam melting. Master’s thesis. Department of Mathematical Sciences, Mathematics, Chalmers University of Technology; 2012.

  15. 15.

    Forslund R, Snis A, Larsson S. Analytical solution for heat conduction due to a moving Gaussian heat flux with piecewise constant parameters. Appl Math Model. 2019;66.

  16. 16.

    Snis A. Method for production of a three-dimensional body. 2015. US Patent 9,073,265 B2.

  17. 17.

    Khairallah SA, Anderson AT, Rubenchik A, King WE. Laser powder-bed fusion additive manufacturing: physics of complex melt flow and formation mechanisms of pores, spatter, and denudation zones. Acta Mater. 2016;108:36–45.

    Article  Google Scholar 

  18. 18.

    King WE, Anderson AT, Ferencz RM, Hodge NE, Kamath C, Khairallah SA. Overview of modelling and simulation of metal powder bed fusion process at Lawrence Livermore National Laboratory. Mater Sci Technol Ser. 2015;31(8):957–68.

    Article  Google Scholar 

  19. 19.

    Mukherjee T, Zuback JS, De A, DebRoy T. Printability of alloys for additive manufacturing. Sci Rep. 2016;6.

  20. 20.

    Gong H, Rafi K, Starr T, Stucker B. The effects of processing parameters on defect regularity in Ti-6Al-4V parts fabricated by selective laser melting and electron beam melting. In: Solid freeform fabrication symposium. 2013. p. 424–39.

    Google Scholar 

  21. 21.

    Vandenbroucke B, Kruth J. Selective laser melting of biocompatible metals for rapid manufacturing of medical parts. Rapid Prototyping J. 2007;13(4):196–203.

    Article  Google Scholar 

  22. 22.

    Smith CJ, Derguti F, Nava EH, Thomas M, Tammas-Williams S, Gulizia S, Fraser D, Todd I. Dimensional accuracy of Electron Beam Melting (EBM) additive manufacture with regard to weight optimized truss structures. J Mater Process Technol. 2016;229:128–38.

    Article  Google Scholar 

  23. 23.

    Zhu C, Byrd RH, Lu P, Nocedal J. Algorithm 778: L-BFGS-b: fortran subroutines for large-scale bound-constrained optimization. ACM Trans Math Softw. 1997;23(4):550–60.

    MathSciNet  Article  MATH  Google Scholar 

  24. 24.

    Byrd RH, Lu P, Nocedal J, Zhu C. A limited memory algorithm for bound constrained optimization. SIAM J Sci Comput. 1995;16(5):1190–208.

    MathSciNet  Article  MATH  Google Scholar 

  25. 25.

    Jones E, Oliphant T, Peterson P et al.. SciPy: open source scientific tools for python. 2001.

    Google Scholar 

  26. 26.

    Lewis AS, Overton ML. Nonsmooth optimization via quasi-Newton methods. Math Program. 2013;141(1):135–63.

    MathSciNet  Article  MATH  Google Scholar 

Download references


The authors are grateful to the anonymous referee for constructive criticism.


This work was supported by the Swedish Foundation for Strategic Research under the contract “Industrial PhD 2015 – ID15-0058” and by the H2020 European funded project EBMPerform no. 666788. Open access funding provided by Chalmers University of Technology

Author information




The main idea of this paper was proposed by AS. RF wrote the manuscript, implemented the algorithm and ran the numerical examples. RF, AS and SL closely reviewed and discussed all stages of development. All the authors read and approved the final manuscript.

Corresponding author

Correspondence to Robert Forslund.

Ethics declarations

Competing interests

The authors declare that they have no competing interests.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Forslund, R., Snis, A. & Larsson, S. A greedy algorithm for optimal heating in powder-bed-based additive manufacturing. J.Math.Industry 11, 14 (2021).

Download citation


  • Additive manufacturing
  • Powder bed fusion
  • Process control
  • Greedy optimization