0% found this document useful (0 votes)
44 views6 pages

Path Optimization in 3D Printer: Algorithms and Experimentation System

Uploaded by

felipe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views6 pages

Path Optimization in 3D Printer: Algorithms and Experimentation System

Uploaded by

felipe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

2016 4th International Symposium on Computational and Business Intelligence

Path Optimization in 3D Printer: Algorithms and Experimentation System

Piotr Lechowicz, Leszek Koszalka, Iwona Pozniak-Koszalka, and Andrzej Kasprzak


Dept. of Systems and Computer Networks
Wroclaw University of Science and Technology
Wroclaw, Poland
e-mail: [email protected], {leszek.koszalka, iwona.pozniak-koszalka, andrzej.kasprzak}@ pwr.edu.pl

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

978-1-5090-3488-8/16/$31.00 ©2016 IEEE 137


considered as a greater value from two distances, related to Given: The array Px , y defined by (1); n points to be printed; the
necessary move on corresponding axes, expressed by the printer with known parameters sb and st.
uniform units defined as the distance between two adjacent To find: The order V of the visited printing points (2).
pixels (3). The total cost of path can be expressed as C Such that: The total time 𝑡𝑡𝑜𝑡𝑎𝑙 (7) is minimum.
computed by (4).
As an additional criterion the time needed for calculating

cPi , Pj   max x j  xi , y j  yi  (3) the optimal path can be taken into consideration. However,
we can assume that this time would be shorter than time
n
C   max  xi1  xi , yi 1  yi  (4) needed for printing a given layer. In such a situation it
i 2 would be possible to print an object concurrently to
computing the paths for succeeding layers.
In Fig. 2 there is shown the path founded for a layer
from Fig. 1. With light grey colour there are marked parts of III. SOLUTION TO THE PROBLEM
path with the lowest possible cost, which can be printed According to the fact that the problem (as a kind of TSP)
constantly. With dark grey colour there are marked parts of is a NP-hard with 𝑂(𝑛!) - the solution spaces grow very
path where the printing tool is moving without printing. quickly-it seems natural to try to solve it with heuristic
approach. There is reported a large amount of algorithms
which are suitable to solve that class of problems, e.g., [6]
[7] [8]. In [6] the authors presented the results of testing
some heuristic algorithms via computer simulation for path
optimization of 3D printer, however, the algorithm were
tested for layers with small amount of points.
In this paper, we take into consideration five
implemented algorithms: Greedy, Simulated Annealing
(SA), Two Opt (2O), in particular focusing on two created
hybrid algorithms, namely the Greedy Annealing (GA) and
Greedy Two Opt (G20). They are the compositions of two
algorithms. Both of them find the initial solution using
Figure 1. A layer – example. Figure 2. A founded path. Greedy algorithm, next, improve it with another algorithm:
Simulated Annealing for GA and Two Opt for G2O.
The time necessary to print a layer varies not only on the
cost of founded path but also on the parameters of the 3D A. Greedy Algorithm
printer. Printers can have different build speed, it is the The algorithm is a sequence of steps. For each step
speed in which they print points, travel speed and layer Greedy always makes the choice which looks as the best at
resolution [2]. The formula (5) describes the time denoted as the moment, i.e., it tries to find global optimal solution by
𝑡𝑏𝑢𝑖𝑙𝑑_𝑝𝑖𝑥𝑒𝑙 needed to print a single point as a ratio of layer making locally optimal steps [9]. The implemented Greedy
resolution 𝑙𝑟 and build speed 𝑠𝑏 of the printer. searches as a next point the nearest (with the lowest cost)
point to the currently visited one. Additionally, if it finds
lr more than one point with the same cost, it chooses the one
tbuild _ pixel  (5) with a lower number of adjacent neighbors (as a neighbors
sb are treated all adjacent points, including those placed
diagonally). This way of proceeding allows eliminating the
Time needed to move the printing tool over one pixel - isolated points, which can become especially costly at the
the cost of moving one pixel horizontally or vertically is the end of the creating a path. The detailed description of the
same as moving one pixel diagonally - is described by (6). own implementation of algorithms can be found in [10].
Time needed to travel one pixel 𝑡𝑡𝑟𝑎𝑣𝑒𝑙_𝑝𝑖𝑥𝑒𝑙 is a ratio of the
B. Greedy Two Opt (G2O)
layer resolution 𝑙𝑟 and travel speed 𝑠𝑡 of the printer.
G2O algorithm starts with finding an initial solution
lr with Greedy algorithm. After that the solution is optimized
ttravel _ pixel  (6) with Two Opt algorithm. In any iteration it selects two
st edges and swaps them that the new tour is generated. It is
done only if the cost of the new path is lower than the
The total time for creating a layer is the sum of time previous one. This is repeated until there is no possible swap
needed to print all points and the time to travel between that improve the solution [8]. After finding appropriate pair
them without printing is defined by (7). of edges with certain probability, G2O decides to search
solution space for more profitable two edges.
ttotal  tbuild  ttravel  n  tbuild _ pixel  C  n  ttravel pixel (7)
C. Greedy Annealing (GA)
The problem may be formulated as follows: Similarly to G2O, the initial solution is found with
Greedy algorithm and after that it is optimized along with

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

IV. EXPERIMENTATION SYSTEM


In order to create the opportunities for testing the
Figure 3. Order of sub-layers in which paths are finding.
algorithms, we implemented the experimentation system as
an appropriate application in Java environment. The system
allows displaying a layer; setting printer properties, and
checking the algorithm and the strategy (Fig. 5). After the
execution of algorithms, the user can get the displayed
founded path, and the calculated values of the results.
The application allows finding paths concurrently, it
means that several instances of an algorithm are running
parallel in many threads, and after they all finish
calculations, the best result is chosen. The programs were
written in such a way that new algorithms and their
strategies can be easily added. The experimentation system
Figure 4. Ending and starting point for two sub-layers. can be treated as input-output system with:

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.

Two cases were investigated:


Experiment #1. Different strategies – checking how the
splitting and smoothing processes may affect the solution.
Experiment #2. Different splitting size – checking how
the size of splitting affects the solution.
Experiment #1. The different strategies, including
solving whole layer, splitting with splitting size=50, and
smoothing, were tested. The obtained results for Layer 2 and
building time = 4.59[s] are given in Table I.
TABLE I. PERFORMANCE OF ALGORITHMS WITH DIFFERENT
STRATEGIES

Calculation time Travelling time


Algorithm & strategy Cost
[𝑠] [𝑠]
G2O – whole layer 12126 112.40 0.31
G2O – split 13858 0.71 0.79
G2O – smooth 13834 1.57 0.78
GA – whole layer 12570 55.20 0.43
Figure 5. Screen view of experimentation system.
GA – split 15421 8.92 1.22
V. INVESTIGATION GA – smooth 15439 23.36 1.23
During all experiments the following inputs were taken: It may be observed that the best cost was achieved for
Greedy Two Opt : solving whole layer; however, such strategy was time
 Greedy swap probability = 0.1. consuming. The difference between the costs produced with
Greedy Simulated Annealing: smooth and split was small but the difference in time was
 Starting temperature = 1.0. significant. If the slightly worse solution (from the cost
 Cooling rate = 0.95. point of view) could be accepted, then using the split
 Minimal temperature = 0.001. strategy might be considered as a better choice.
 The number of iterations = 100.
Parameters of printer (from real 3D printer Form 1 [12]):
 Top build speed = 60 [mm/s].
 Top travel speed = 90 [mm/s].
 Minimum layer resolution = 25 [𝜇𝑚2 ].
The algorithms G2O and GA were tested on four layers
with the different number of points (see Fig. 6).

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.

Figure 8. GA algorithm with split strategy.

The visualization of the solution for Layer 2 founded by


GA with two different strategies is presented in Fig. 7 and
Fig. 8 (there are also shown the parts of path on which the
printing tool does not print).
Experiment #2. The splitting strategy was tested with
Figure 9. G2O run on Layer 3 Figure 10. G2O run on Layer 3
different splitting size in the range [30, 170] with the step with split size = 70. with split size = 150.
size 20. The results for Layer 3 (with building time = 9.15
[s]) are presented in Table II. VI. FINAL REMARKS
TABLE II. PERFORMANCE OF ALGORITHMS FOR DIFFERENT SPLIT According to performed tests, G2O is much faster and
SIZES more accurate than GA. The splitting procedure highly
increases time needed for calculation, but decreases
Algorithm & split Calculation Travelling Print time
Cost accuracy. However, its quickness can be used to calculate
size time [𝑠] time [𝑠] [𝑠]
and produce layers concurrently. Smoothing process
G2O – 30 33093 0.40 3.09 12.24 provides benefits, but with additional time spent on
G2O – 50 28034 1.45 1.69 10.84 computations. Due to the fact that points on the layer are
densely located, the greedy part in G2O provides good
G2O – 70 28011 1.83 1.68 10.83
results in quick time. Depending on the necessary accuracy
G2O – 90 27272 4.54 1.48 10.63 or time, the splitting size can be adjusted.
G2O – 100 26386 12.06 1.23 10.38 In the future work, we plan designing an algorithm
G2O – 110 26388 12.16 1.23 10.38
which could compare diversity of two succeeding layers. If
the second layer would be similar to the previous one, the
G2O – 130 26319 12.19 1.23 10.38
algorithm could use calculations made in the past for the
G2O – 150 26344 11.72 1.22 10.37 first layer to obtain the solution for the second one. If the
G2O – 170 26060 39.38 1.15 10.30 diversity would be low enough, the algorithm could try to
GA – 30 34176 15.49 3.40 12.55
modify the solution for the first layer, to find the best match
for the second layer.
GA – 50 31220 15.42 2.57 11.72
The implemented experimentation system presented in
GA – 70 31280 19.23 2.59 11.74 this paper is serving as the teaching tool during MSc courses
GA – 90 30848 19.50 2.47 11.62 in advanced informatics and control in the Faculty of
GA – 100 29338 21.69 2.05 11.20
Electronics at Wroclaw University of Science and
Technology. In the nearer future, we plan to improve the
GA – 110 29364 22.39 2.06 11.21
experimentation system ensuring opportunities carrying out
GA – 130 29364 21.85 2.06 11.21 simulation experiments following the ideas presented in [13]
GA – 150 29363 20.75 2.06 11.21 and [14].
GA – 170 29159 29.27 2.00 11.15
ACKNOWLEDGMENT
It may be observed that the cost of the solution founded This work was supported by the statutory founds of the
is decreasing when split size is increasing; however, the Department of Systems and Computer Networks, Faculty of
calculation time is also increasing. The calculation time of Electronics, Wroclaw University of Science and Technology,
GA is higher than the time of printing the layer. In case of Poland.

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

You might also like