Path Optimization in 3D Printer: Algorithms and Experimentation System
Path Optimization in 3D Printer: Algorithms and Experimentation System
Abstract—3d Printers create an object by printing thousands of considered as a special case of travelling salesman problem.
successive thin layers. Each layer is created by the printing tool There are many concepts for solving such a problem using
which moves on the selected paths. The ability to reduce the heuristic algorithms based on artificial intelligence, e.g., [6].
total length of printing paths results in lower overall time The optimization is focused on ensuring the shortest time in
needed for printing process. In this paper there are presented which the printer can complete the whole path. The
two hybrid algorithms for that purpose, Greedy Two Opt and considered problem of finding optimal path for 3D printer
Greedy Annealing. Both of them based on the same assumption may be regarded as a variation of the problem of finding the
that it is profitable to select initial solution with fast algorithm Hamiltonian cycle with the lowest cost.
and after that, to try to improve it by further exploration of the
We concentrate on the implementation of two heuristic
solution space with the other one. The simulations made with
the designed experimentation system confirmed good
algorithms, namely Greedy 2Opt and Greedy Annealing. In
properties of the implemented algorithms. order to check the properties of the proposed algorithms, the
own experimentation system was designed and implemented
Keywords-3D printing; algorithm; pathfinding; optimization; following the ideas proposed in [7]. Basing on the results of
experimentation system simulation experiments carried out using the experimentation
system we made a comparison between algorithms showing
I. INTRODUCTION that one of them seems to be promising.
The process of 3D printing, also known as additive The rest of the paper is organized in the following way:
manufacturing, is the innovative manufacturing method of Section II contains the problem formulation. Section III
creating prototypes or functional parts of the objects. These describes the proposed pathfinding algorithms. In Section IV,
processes are often used in rapid prototyping; because of the implemented experimentation system is presented. In
their possibility to create objects without necessity of Section V, the results of experiments are shown and analyzed.
construct specially dedicated forms or usage of the The conclusions appear in Section VI.
advanced tools. The industries which can greatly benefit II. PROBLEM STATEMENT
from 3D printing are medical and dental, aerospace,
automotive, jewellery, art and architecture. In order to The considered problem is concerned finding the best
ensure the low cost of printing objects, the prototype may be path for a single layer. The layer can be described as a two
produced in iterative manner. This way may speed up the dimensional array of binary points with size (𝑎 × 𝑏). Each
earliest stages of product development process, in point can have a value (1) equal to 1, which means that it is
consequence can save money [1] [2]. point to print, or equal to 0, otherwise. In Fig. 1 an example
The process of building a prototype starts with the is presented (the points to print are blackened).
design of a real life object as a surface model (STL model
[3]) stored in computer program or scan. This model is 1, if printing point
Px , y (1)
sliced into thin layers, which can be seen as a horizontal 0, otherwise
cross-section of an object. Next, for each of the layers there
is generated a path. The movement of the printing tool along Let us assume that the total number of points to print on
the path is saved in special G-code file [4]. The creation of the selected layer is equal to 𝑛. On a given layer the printing
an object by the printer is achieved by using an additive tool has to visit each point with value 1 exactly once. The
process. The layers are reproduced physically in a path made by the printing tool can be unambiguously
successive manner, one layer after another until the whole described by the order of the visited printing points (2).
object is created. According to the fact that there are a huge
number of layers to print, the selection of path determines
V P1 , P2 ,, Pn (2)
the overall time needed for creating an object. Therefore
reducing the length of paths becomes an essential part of the
printing process [5]. Each point 𝑃𝑖 , where 1 ≤ 𝑖 ≤ 𝑛 , has corresponding
This paper concerns the problem of finding the path to coordinates (𝑥𝑖 , 𝑦𝑖 ) describing its placement on the layer.
be generated for the printer purposes. Such a problem can be The printing tool is moving using two perpendicular axes.
The cost of a path from one point to another one is
138
SA algorithm. The main difference between GA and G2O is Layers are split recursively until the sub-layers are
that it would, with certain probability, accept worse solution smaller than the fixed constant value. Algorithm 1 presents
as a next step solution. That process allows escaping local splitting process.
minima. SA possesses an internal parameter called
temperature which decreases after each iteration. After Algorithm 1 – Splitting
reaching certain value of the parameter GA stops. The #function declaration
probability of accepting worse solution is determined by the 1: function split(start, end)
rule – the lower temperature, the lower probability [11]. 2: if(end – start) > MAX_SIZE
D. Problem Decomposition 3: split(start, end / 2)
Split(end / 2, end)
Layers can contain many points what create a real #call function for layer’s width and height
challenge for algorithms to calculate solution in a 4: split(0, layerWidth)
reasonable time. It is proposed that a set of big number of 5: split(0, layerHeight)
points in layer is divided into smaller subsets creating
sublayers, and path on each of sublayers is calculated
separately. The justification of such an idea comes from the The process is called twice – for width and for height.
assumption that points on the layer are densely located and There can be optionally set smooth parameter. After finding
it is worthless to consider moving to the point which is on solutions for each two succeeding sub-layers, the path is
the opposite side of a layer. Creating sublayers causes that combined into one. The algorithm is run against that path
and it tries to optimize the solution. Then the path is split
the final printing path should be a composition of paths
into two parts, so the second path can be used in the next
obtained while solving sub-problems for sub-layers. It is
iteration. The process of smoothing is performed with
also important that after dividing layer into sub-layers it is Algorithm 2.
necessity to determine the order in which the paths for sub-
layers are going to be finding–as an example: after dividing
layer into 16 parts the proposed order is presented in Fig. 3. Algorithm 2 – Smoothing
For each sub-layer should be determined starting and ending 1: subLayers = split(layer)
point. It is done by considering two successive layers: #find path for first sub layer
2: path1 = findPath(subLayers[0])
current and the following sub-layer and finding pair of the
3: for i = 1:subLayers.size - 1
closest points, such that they are located in different sub- 4: path2 =
layer. One point becomes an ending point of the first layer, findPath(subLayers[i])
and the second one is starting point of the second layer. In 5: path = path1 + path2
Fig. 4, the point 1 (as the ending point for layer A) and #connect paths from two sub-layers
the point 3 (as the starting point for layer B) are selected by 6: optimize(path)
taking into account the cost calculated by (3). 7: path1 = path.split(0,
path1.size)
7: path2 =
path.split(path1.size,
path1.size +
path2.size)
8: addPathToResult(path1)
9: path1 = path2
139
Input parameters:
The layer (number of points).
The printer’s properties (build time, travelling time,
layer resolution).
The starting point.
The algorithm used.
The strategy (number of concurrent solutions, split,
split size, smooth).
Output parameters:
The cost (7).
The calculation time. Layer 2 – 21 955 points. Layer 4 – 32 231 points.
The travelling time. Figure 6. The layers in experiments.
Layer 1 – 5 451points. Layer 3 – 11 017 points. Figure 7. GA algorithm with whole layer strategy.
140
G2O the some split sizes may be recommended for which
the calculation time was slightly lower than printing time.
Unfortunately, such values have to be estimated
experimentally, because they depend not only on the size of
the layer, but also on the number of points and their density,
as well as on the properties of the computer on which the
calculations are made.
In Fig. 9 and. Fig. 10, the obtained results for Layer 3
using G20 with different split sizes are shown.
141
REFERENCES system for the practical users,” J. of Intelligent & Fuzzy Systems, vol.
27, 2014, pp. 611-623.
[1] T. Grimm, User’s guide to rapid prototyping, Society of
Manufacturing Engineers, 2004. [8] R. Matai, S. Singh, and M. Mittal, Traveling Salesman Problem: An
[2] C. K. Chua, K. F. Leong, and C. S. Lim, Rapid prototyping: overview of applications, formulations, and solution approaches,
principles and applications, World Scientific Publ. Company, 2010. InTech, 2010, ISBN 978-953-307-426-9.
[3] A. C. Brown, D. de Beer, and P. Conradie, “Development of a [9] T. H. Cormen, C. Leiserson, R. L. Rivest, and C. Stein, Introduction
to Algorithm, Massachusetts Institute of Technology, 2009.
Stereolithography (STL) input and Computer Numerical Control
(CNC) output algorithm for an entry-level 3D printer,” The South [10] P. Lechowicz and W. Kowalski, “Path optimization of 3D printer,”
African Journal of Industrial Engineering, vol. 25 (2), Pretoria, 2014. Report, Faculty of Electronics, Wroclaw University of Science and
[4] R. T. Farouki, T. Koenig, K. A. Tarabanis, J. U. Korein, and J. S. Technology, 2015.
Batchelder, “Path planning with offset curves for layered fabrication [11] D. Bertsimas and O. Nohadani, “Robust optimization with Simulated
processes,” J. of Manufacturing Systems, vol.14, 1995, pp. 355–368. Annealing,” J. of Global Optimization, vol. 48, 2010, pp. 323-334.
[12] Top 10 personal 3D printers, [Online]. Accessed: Dec 2015:
[5] P. Kulkarni, A. Marsan, and D. Dutta, “A review of process planning
http://www.sd3d.com/top-10-personal-3d-printers-q4-2013/.
techniques in layered manufacturing,” Rapid Prototyping Journal, vol.
6, 2000, pp. 18-35. [13] W. Kmiecik, M. Wojcikowski, L. Koszalka, and A. Kasprzak, “Task
[6] M. Wojcik, I. Pozniak-Koszalka, L. Koszalka, and A. Kasprzak, allocation in mesh connected processors with local search meta-
“MZZ-GA algorithm for solving path optimization in 3D printing,” heuristic algorithms,” Lecture Notes in Artificial Intelligence,
Proceedings The Tenth International Conference on Systems, Springer, vol. 5559, 2010, pp. 215-224.
ICONS’15, Barcelona, eds.: Leszek Koszalka and Pascal Lorenz, [14] D. Zydek, H. Selvaraj, L. Koszalka, and I. Pozniak-Koszalka,
2015, pp.30-35. “Evaluation scheme for NoC-based CMP with integrated processor
[7] P. Bogalinski, D. Davies, L. Koszalka, I. Pozniak-Koszalka, and A. management system,” Journal Electronics and Telecommunications,
Kasprzak, “Evaluation of strip nesting algorithms: an experimentation vol. 56, 2010, pp. 157-168.
142