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.


Introduction
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 twophase 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 adjointbased 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 = R 2 × Rduring a time span T = (0, T]. Let denote the surface boundary z = 0 and let u init denote the constant initial temperature. The beam travels on the surface along a preset, piecewise linear path where x s (t) = (x s (t), y 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 The three beam parameters are the absorbed beam power P(t), the beam spot size σ (t), and the beam speed 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 C s is preset and it follows that v uniquely defines the vector (v x , v y , 0). The position of the beam x s (t) depends on the speed with which the beam has traveled the path C 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 < . . . < t N = T, is a partition of 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 i n , t f n ; an initial time and final time, respectively, -(P n , σ n , v n ); a triplet of power, spot size, and speed such that s n ; a line traversed by the beam between times t i n and t f n , -x i n , x f n ; the initial position and final position of s n , respectively. θ n = tan -1 ( ; 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 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 κ = λ/ρ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 where u I n,k is the temperature due to the earlier scanning of segment k < n and u n is the temperature due to the current scanning of segment n.
The analytic expressions of u I n,k and u n 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 ∈ 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 {x(t) : u(x, t) = u melt }, where u 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 where χ is the indicator function. Since we aim to optimize the speed, either the times t i n , t f n or the positions x i n , x f n , n = 1, 2, . . . , 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 Then we have the following beam parameter functions: From (2), a decision vector can immediately be extracted as 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. maintain a uniform and appropriately sized melt pool during melting, and 2. avoid too high surface temperatures.

A reductive approach
Consider a beam scanning along a path C s . Denote by ω a supposed desired melt pool It is difficult to express ω(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 ω(t). However, even further reductions can be made by isolating particular curves on this powder-solid interface. More precisely, we introduce a secondary path C wd chosen such that it lies on a desired powder-solid interface. The secondary path is related to the beam path by some function F : C s → C wd and we write and let x wd = F(x s ). For example, if the beam path consists of one segment, then a simple example of a secondary path is The idea is that the secondary path relates to C s via a width w and a depth d. With this, the description of the optimal melting reduces to two paths; C s (preset) and C wd (chosen with respect to C s ). This reductive approach is illustrated in Fig. 1.
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 ω(t) in a volume, only track two scalar values u melt and u 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, The total number of hatch lines M satisfies 1 ≤ M ≤ N . Define also the maximum temperature field The resulting objective vector becomes where Here 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 M(x; 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 ≥ 0, i = 1, 2. The scalarized optimization problem becomes 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 T into subintervals on the form Local optimization problems are solved on these subintervals and optimal parameter pairs (σ 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, C 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 C wd , the only difference being that it takes slightly longer to reach the maximum temperature on C 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 (Window). Given a partition as in Definition 1, a time window
is defined as a set of adjacent segments in T . The size of T p,q is the number of segments that constitutes it. The local beam path and local secondary path corresponding to T p,q are given by Hence the beam traverses the path C s p,q during time T p,q . Define a local decision vector d p,q = {(σ k , v k )} q k=p and a local maximum temperature field Similarly, we define the local objectives Here β 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 β p,q be piecewise constant over the segments and determined by a function that decreases quadratically along C s p,q . See Fig. 2. Formally, we have on C s p,q . We define β p,q (x 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.

Input
: A partition as in Definition 1. Remaining optimization problem data (C wd , u melt , u surf , bounds, weights).

Output
: (σ opt , v opt ), J opt Optimal decision vector and objective with respect to the subproblems (7). (We cannot expect to find the optimal decision vector for the global problem (6), only an approximation of it.) 1 begin 2 while p ≤ N do 3 Solve subproblem (7) for window T p,q with initial guess Freeze r parameter pairs.

5
Change window location: Update number of segments to freeze next. 9 end 10 J opt = J((σ opt , v opt )) Compute optimal objective in (6).

end
Algorithm 1: Greedy algorithm for finding an approximate solution of the scalarized problem (6). Note that qp + 1 equals the size of the current window. Now, by employing the same scalarization as for the global problem (6), the resulting scalarized subproblem becomes 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. L 4: Future parameter pairs are updated as well, because the values found in the current window are likely a better guess than the initial one. L 5: The segments corresponding to the frozen parameter pairs are removed from the window. In the implementation, certain checks can be made to determine Figure 2 The weight β p,q is based on a quadratic function that decreases along the local beam path C s p,q . 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 C wd p,q .

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).
whether freezing should take place or not (as in, the amount of pairs to freeze). We leave out the details. L 7-9: 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 qp + 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 where = ( σ , 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)) These parameter functions are defined with respect to the hatch lines as The reason for splitting F σ 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 S : {1, . . . , M} → {1, . . . , N} be an injective function that, given a hatch line m, returns the first segment in m. Let L : {1, . . . , N} → {1, . . . , 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 C s S(1), S(4)-1 . 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.

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 iterated p,q , scipy.optimize approximates the gradient of J p,q (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 (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 M p,q (x; d p,q ) with an approximation, 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.

Input
: A partition as in Definition 1; M hatch lines. Remaining optimization problem data (C wd , u melt , u surf , bounds, weights).
Coefficient sets/decision array. p = 1 Index of first hatch line in current window. q ∈ {1, . . . , M} Index of last hatch line in current window. r ∈ {1, . . . , qp + 1} Number of hatch lines to freeze next.

Output
: opt , J opt Optimal decision vector and objective with respect to the subproblems (7). (We cannot expect to find the optimal decision vector for the global problem (6), only an approximation of it.) Change window location: r ← min{r(p), qp + 1} Update number of segments to freeze next. J opt = J( opt ) Compute optimal objective in (6).

end
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.
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.   The secondary path is set to To avoid porosity, w and d need be chosen such that unmelted gaps between lines are avoided. Here we set w = l off /2 = 100 μm and d = 50 μm. A complete list of parameter values is given in Table 1. Figure 6 shows the solution of (6) as obtained by the greedy Al- 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.
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.

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.

Example 2: segmentwise optimization on nonparallel pattern
We melt the first quadrant of an annulus. The annulus has an inner radius r i = 1 mm and outer radius r o = 5 mm. The beam path is shown in Fig. 10.  Table 1.
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.  The plots in Fig. 13 confirm that the extension of the solution onto remaining lines 6-19 works well. While the temperature on C 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

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. and F σ l x s ; σ l = C σ 1,l 1 + for l = 1, . . . , 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  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.

Conclusions
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 melt , u surf . Furthermore, the weights and the secondary path C wd need to be carefully chosen. Work related to this kind of testing has not been detailed here.