Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
53
TOOL PATH OPTIMIZATION OF A 3D PRINTER VIA AN ENHANCED
ELECTROMAGNETISM-LIKE MECHANISM ALGORITHM FOR SOLAR
PANEL BRACKETS FABRICATION
Jian-Ding Tan
Institute of Sustainable Energy, Universiti Tenaga Nasional,
43000 Kajang, Selango, (Malaysia)
E-mail: TJianDing@uniten.edu.my
Chin-Wai Lim
Institute of Sustainable Energy, Universiti Tenaga Nasional,
43000 Kajang, Selango, (Malaysia)
Siaw-Paw Koh
Institute of Sustainable Energy, Universiti Tenaga Nasional,
43000 Kajang, Selango, (Malaysia)
Sieh-Kiong Tiong
Institute of Sustainable Energy, Universiti Tenaga Nasional,
43000 Kajang, Selango, (Malaysia)
Ying-Ying Koay
Institute of Sustainable Energy, Universiti Tenaga Nasional,
43000 Kajang, Selango, (Malaysia)
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
54
ABSTRACT
There is a growing consensus that 3D printing technologies will be one of the next
major technological revolutions. Over the past few years, many studies and
researches have been carried out to improve and enhance the functions and
performance of the 3D printers. In this paper, a modified Electromagnetism-like
Mechanism (EM) algorithm is proposed to search for the optimum printing path of
a 3D printer. The machine is set to fabricate the bracket of a photovoltaic solar
energy harvesting panel. Instead of randomly setting the search step size, the
improved EM systematically fine-tunes the steps to search for the best printing path.
The performance of the enhanced EM is benchmarked with the conventional EM
and Genetic Algorithm (GA). The results presented in this paper shows that the
modified EM outperformed all other optimization techniques in terms of time
taken, distance traveled and overall convergence process. We can thus conclude that
the proposed modified EM performs well in optimizing the path planning sequence
of a 3D printer.
KEYWORDS
Three Dimensional Printer, Electromagnetism-Like Mechanism Algorithm,
Photovoltaic Solar Panel.
1. INTRODUCTION
Rapid prototyping, or better known as the 3D printing technologies have
progressively taken more attention in the manufacturing research around the world
as the process has proven to be compatible with industrial manufacturing beyond
Prototyping [1-3]. The 3D printing technology evolved during the mid-1980s when
computing and control systems progressed [4]. 3D printing is a form of “build-up”
manufacturing, where an object is constructed and fabricated by adding layer after
layer of a particular material. This is different from the conventional “cut-off”
fabrication, in which an object is carved out of a block of raw material [5]. The
systems are usually associated with the Computer-Assisted Design (CAD) software
to digitally model the objects to be printed. It is widely recognized that the 3D
printer offers significant advantages in terms of design freedoms, mass
customization, and co-creation [6-8].
The study on the 3D printing technology can be split into several divisions. Among
others is the tool path planning [9]. A primary goal in planning the tool path is to
avoid tool collision. Solving the optimization problem of tool path has an important
role because reducing the time to perform one piece ultimately leads to a significant
reduction in cost of the entire series of fabrication. Several reports can be found in
the literature on the tool path planning and optimization. In [10], the authors
employed a hybrid algorithm to reduce the length of the tool path. A mathematical
model for calculating the processing time was developed. The algorithm finds an
optimal tool path, which has a proven effect on the process productivity. Some
optimization mechanism, such as Ant Colony Optimization algorithm [11-13],
Genetic Algorithm (GA) and Hill-Climbing [14, 15] were also attempted in the
optimization of the tool path.
This paper presents an enhanced Electromagnetism-Like Mechanism algorithm
(EM) for the tool path optimization of a 3D printer. In this research, the 3D printer
is set to fabricate a bracket for a photovoltaic solar panel. The breakdown of the
paper can basically be divided into 4 major sections. The second section of the paper
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
55
presents the implementation method of the EM algorithm and the proposed
modification. The experimental results are shown in section 3, along with the
analysis and some discussions. The final section of the paper offers the conclusion
made from the research.
2. ELECTROMAGNETISM-LIKE MECHANISM ALGORITHM
This section presents the implementation procedure of a global optimization
algorithm known as Electromagnetic-like Mechanism (EM) in minimizing the
traveling path of the 3D printer tool. The EM is a global optimization search
mechanism proposed by Birbil and Fang in 2003 [16]. The EM imitates the
attraction-repulsion mechanism of electromagnetic charges in the search for a
global optimal solution. In the EM, all solutions are known as particles in the search
space and the charge of each reflects the objective value of each. Particles with better
objective attract other particles. Particles with worse objective values, on the other
hand, repulse other particles so that they move away from the known bad solutions
[17]. The magnitudes of the forces are in proportion to the objective values. The
particles are then moved based on superposition theorem. Figure 2.1 shows an
example of the forces applications.
Figure 2.1. Total force exerted on Q
a
by Q
b
and Q
c.
There are five important operations in the EM, namely the initialization, the local
search, the charge calculation, the force calculation, and the movement of particles.
In the initialization stage, the feasible ranges of all the tuning parameters are
defined. Then, m sample of initial particles are randomly picked from the feasible
solution domain, each represents an N dimensional hyper-solid. Each value of
dimension in each particle is assumed to be uniformly distributed inside the upper
and lower bound. Since this research shows a minimization problem, the particle
with the lowest tool travel path distance is marked as the best particle. Table 1 shows
the pseudocode of the original EM proposed by Birbil and Fang in 2003 [16]. The
mechanism is further illustrated in the flowchart shown in Figure 2.2.
Table 1. Original EM proposed by Birbil and Fang.
EM (m, MAXITER, LSITER, δ)
m= number of initial particles
MAXITER: maximum number of iterations
LSITER: maximum number of local search iterations
δ: local search parameter, δ (0,1)
1: Initialize ( )
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
56
2: iteration 1
3: while iteration < MAXITER do
4: Local (LSITER, δ)
5: F CalcF ( )
6: Move (F)
7: iteration iteration + 1
8: end while
Figure 2.2. The mechanism flow of a conventional EM.
The original local search procedure in a conventional EM employs a random line
search within the feasible range of a solution. This simple line search involves a
particle being tuned along its dimensions one by one, restricted by a maximum
feasible random step length of 𝜆 (0,1). For each of the iterations, a new random
step length is generated. The overall local search procedure is immediately
terminated upon achieving any better objective value. Table 2 shows the
pseudocode of the original local search procedure in the original EM. The flow of
the original local search mechanism is as illustrated in Figure 2.3.
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
57
Table 2. The original local search of the original EM.
Local Search ( LSITER, )
1: counter
2: Length 


3: for  do
4: for  do
5:

6: while do
7:
8:

9: if
 then
10:

11: else
12:

13: end if
14: if

then
15:
16: 
17: end if
18: 
19: end while
20: end for
21: end for
22:



The total force vector exerted onto each particle is calculated based on the
Coulomb’s Law. The charge of each particle is evaluated by its current objective
value compared to the best particle in the iteration. The computed charge of a
particle, qi , when compared to that of other particles, will determine if it is a
repulsive or attractive force to the respective particles. The calculation of qi is shown
in equation (1):







 (1)
where n refers the total dimension of the particle and m denotes the population
size. f(xbest) represents the objective value of the best particle.
With the charges calculated for all particles, forces generated by one particle onto
another can be computed. According to the electromagnetic theory, the force of one
particle onto another is inversely proportional to the distance between the two
particles and directly proportional to the product of their charges. The force vector
for a particle can be determined using equation (2).















(2)
where f(xj) < f(xi) denotes attraction and f(xj) f(xi) refers to repulsion.
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
58
Figure 2.3. The flow of the original local search mechanism.
The movement stage in EM involves relocation of all particles but the best to a new
location in space. This step is crucial to ensure better global exploration of other
possible routes. The calculation for the movement of a particle is as shown in
equations (3), where represents the global particle movement step length. It is a
random value between 0 and 1, assumed to be uniformly distributed between the
upper boundary (uk ) and the lower boundary (lk ).


 ;



;
(3)
Holding the absolute power of attraction towards all other particles, the best particle
of the iteration does not move. After a pre-fixed number of iterations, the best
optimized tool path is then fed back as the result.
2.1. The Enhanced EM
In this research, a modification on the EM is proposed. This enhanced algorithm is
named as Regulated Step EM (ReSEM). ReSEM is a modified version of EM that
can grant the algorithm the ability to hit a more accurate result without heavily
slowing down the entire convergence process. The idea of ReSEM is to replace the
local search segment of a conventional EM with the procedure as shown in Table 3.
ReSEM applies a nonlinear equation to dynamically adjust the step size as iterations
go. The step λ is calculated using equation (4).

(4)
Figure 2.4 shows the modified workflow and decision making process of the
enhanced ReSEM for the implementation in this research, where D represents the
current solution in a particular dimension of an iteration and λ refers to the search
step calculated using equation (4). The flow systematically checks the direction and
the magnitude of the convergence movement of each iteration and change
accordingly. This ensure the algorithm search in relatively larger steps in the
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
59
beginning of the iterations and move towards a more fine-tuned search as the
iteration goes.
Table 3. Local search procedures for the proposed ReSEM.
ReSEM Procedures
Step 1
Set maximum number of iterations as terminating criteria.
Step 2
Calculate the step size according to equation 4.
Step 3
Tune the current tile angle by adding and subtracting it with λ separately.
Calculate the new output power with the new solutions obtained.
Step 4
Adapt the newfound tilt angle value if a higher output power is achieved.
Step 5
Repeat Steps 3 and 4 until no higher output power is obtained.
Step 6
Exit if the iteration number reaches termination criteria. Otherwise move on to
the next iteration (i = i + 1) and repeat from Step 2.
Figure 2.4. The proposed modification on the local search sequence of the modified EM.
The enhanced algorithm is then implemented to search for the shortest and
quickest path in the simulation runs of a 3D printer to print the bracket. Figure 2.5
shows an example of the printing layers which the experiment is conducted on. The
enhanced algorithm is set to search for the optimized tool path to print the shaded
areas.
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
60
Figure 2.5. Example of the printing layers.
3. EXPERIMENTAL RESULTS
The performance of the enhanced EM is benchmarked with that of the conventional
EM. Also, in order to show a better picture on the performance of the enhance EM
compared to other optimization algorithms, a standard Genetic Algorithm (GA) is
also included in the benchmarking process. Figure 3.1 shows the flow of the GA
used in the benchmarking. The experiment is conducted in 10 individual runs for
each of the algorithms. The results are shown in Table 4 in the form of best distance,
worst distance, average distance, average time and average iteration needed to
reach best optima results of the 10 individual runs.
From Table 4, it can be observed that the enhanced ReSEM shows relatively better
results as it found shorter distance to travel compared to the conventional EM and
the GA. Also, notice that this led to a shorter time needed to travel in order to
complete the task.
In order to investigate the overall convergence performance of the algorithms, some
convergence processes of the experiment are sampled and analyzed. The iteration-
by-iteration comparison of the sampled convergence processes are showed in Table
5. Figure 3.1 provides a better illustration of the iteration movement comparison of
each algorithm.
Table 4. Results benchmarking.
ReSEM
Conventional EM
GA
Best Distance
1.267m
1.282m
1.315m
Worst Distance
1.288m
1.495m
1.580m
Average Distance
1.275m
1.391m
1.507m
Average Time
92.7s
107.6s
114.8s
Average Iteration
5.2
18.1
29.7
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
61
Table 5. Comparison on the examples of the convergence process for ReSEM, Conventional EM
and GA.
Ite.
ReSEM
Conv.
EM
GA
Ite.
ReSEM
Conv.
EM
GA
0
3.975
3.21
2.981
26
1.27
1.387
1.427
1
2.352
2.89
2.875
27
1.27
1.387
1.427
2
1.599
2.67
2.769
28
1.27
1.387
1.427
3
1.416
2.53
2.663
29
1.27
1.387
1.427
4
1.355
1.899
2.502
30
1.27
1.387
1.427
5
1.283
1.899
2.434
31
1.27
1.387
1.427
6
1.27
1.899
2.105
32
1.27
1.387
1.427
7
1.27
1.471
1.988
33
1.27
1.387
1.427
8
1.27
1.471
1.986
34
1.27
1.387
1.427
9
1.27
1.462
1.984
35
1.27
1.387
1.427
10
1.27
1.453
1.982
36
1.27
1.387
1.427
11
1.27
1.453
1.98
37
1.27
1.387
1.427
12
1.27
1.4
1.978
38
1.27
1.387
1.427
13
1.27
1.4
1.806
39
1.27
1.387
1.427
14
1.27
1.4
1.793
40
1.27
1.387
1.427
15
1.27
1.4
1.503
41
1.27
1.387
1.427
16
1.27
1.399
1.486
42
1.27
1.387
1.427
17
1.27
1.387
1.481
43
1.27
1.387
1.427
18
1.27
1.387
1.481
44
1.27
1.387
1.427
19
1.27
1.387
1.481
45
1.27
1.387
1.427
20
1.27
1.387
1.481
46
1.27
1.387
1.427
21
1.27
1.387
1.452
47
1.27
1.387
1.427
22
1.27
1.387
1.45
48
1.27
1.387
1.427
23
1.27
1.387
1.446
49
1.27
1.387
1.427
24
1.27
1.387
1.44
50
1.27
1.387
1.427
25
1.27
1.387
1.43
It can be observed from Figure 3.2 that the modified ReSEM shows rapid
convergence process at the beginning of the iterations. Relatively, the conventional
EM and the GA show slower convergence rates. The enhanced ReSEM also manages
to hit lower distance value compared to that of the conventional EM and the GA.
convergence processes are showed in Figure 3.2.
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
62
Figure 3.1. The general flow of the Genetic Algorithm used in the benchmarking.
Figure 3.2. Convergence process comparison.
4. CONCLUSION
The size of the search steps has been a common issue in the development of
optimization algorithms. Larger search steps enable quicker search, but return with
less accurate solutions. Scrutinized search, on the other hand, can ensure the
algorithm to hit solutions with higher accuracies. The trade-foo, however, is that the
search takes relatively longer time. In this research, an enhanced Electromagnetism-
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
63
Like Mechanism algorithm has been developed for the optimization of the tool path
of a 3D printing system. A regulated search step mechanism has been introduced
into the local search segment of a conventional EM. This regulated search EM
(ReSEM) begins the search with a relatively large search step to speed up the
convergence process. As the search iterations go, the algorithm then automatically
adjust and fine-tunes the search step in order to achieve solutions with higher
accuracies. This provides the search algorithm both the advantages in terms of
speed and accuracies. Experiments have been carried out to verify and examine the
performance of the proposed algorithm. The results indicated that the proposed
ReSEM showed significant improvement over the conventional EM and
outperformed the GA in the search for the shortest and quickest tool path for the
3D printing system. In the future, this enhanced global optimization search
mechanism can also be implemented to solve other engineering optimization and
scheduling problems.
5. REFERENCES
[1] B. Berman, 3-D printing: the new industrial revolution. Bus. Horiz. 55, 155162
(2012).
[2] N. Gershenfeld, How to make almost anythingthe digital fabrication
revolution. Foreign Policy 91 (6), 4257 (2012).
[3] P. Reeves, Additive ManufacturingA Supply Chain Wide Response to
Economic Uncertainty and Environmental Sustainability. Econolyst Ltd.,
Derbyshire, UK (2008).
[4] N. Hopkinson, R.J.M. Hague, P.M. Dickens, Rapid Manufacturing. An industrial
Revolution for the Digital Age. John Wiley and Sons Ltd., Chischester, West
Sussex. UK (2006).
[5] T. Rayna, L. Striukova, Technological Forecasting & Social Change 102 214224
(2016).
[6] B. Berman, 3-D printing: the new industrial revolution. Bus. Horiz. 55 (2), 155
162 (2012).
[7] S.J. Ford, M. Despeisse, Additive manufacturing and sustainability: an
exploratory study of the advantages and challenges. J. Clean. Prod. 137, 1573
1587 (2016).
[8] T. Rayna, L. Striukova, From rapid prototyping to home fabrication: how 3D
printing is changing business model innovation. Tech. Forcasting Soc. Chang.
102, 214224 (2016).
[9] P. Lechowicz, L. Koszalka, I. Pozniak-Koszalka, and A. Kasprzak, Path
Optimization in 3D Printer: Algorithms and Experimentation System, 4th
International Symposium on Computational and Business Intelligence (2016).
[10] M. Ancău, The optimization of printed circuit board manufacturing by
improving the drilling process productivity, Computers & Industrial
Engineering, vol. 55(2), pp. 279-294 (2008).
[11] X. Hong, L. Yuan, Z. Kaifu, Y. Jianfeng, L. Zhenxing, and S. Jianbin, Multi-
objective Optimization Method for Automatic Drilling and Riveting Sequence
Planning, Chinese Journal of Aeronautics, vol. 23(6), pp. 734-742 (2010).
[12] Z. Q. Li, X. Wang, and Y. F. Dong, ACO-Based Holes Machining Path
Optimization Using Helical Milling Operation, Advanced Materials Research,
vols. 834-836, pp. 1386-1390 (2014).
Tool path optimization of a 3D Printer via an enhanced electromagnetism-like mechanism algorithm for solar panel
brackets fabrication
DOI: http://dx.doi.org/10.17993/3ctecno.2019.specialissue.06
64
[13] A. T. Abbas, M. F. Aly, and K. Hamza, Optimum drilling path planning for a
rectangular matrix of holes using ant colony optimisation, International
Journal of Production Research, vol. 49(19), pp. 5877-5891 (2011).
[14] H. Q. Du and J. B. Qi, Application of a Hybrid Algorithm Based on Genetic
Algorithm and Hill-Climbing Algorithm to Tool Path Optimization in CNC
Machining, Advanced Materials Research, vol. 102(104), pp. 681-685 (2010).
[15] A. Kumar and P. P. Pachauri, Optimization Drilling Sequence by Genetic
Algorithm, International Journal of Scientific and Research Publications vol.
2(9), pp. 1-7 (2012).
[16] S.I. Birbil, S.C. Fang, Electromagnetism-like mechanism for global
optimization. Journal of Global Optimization 25: 263282 (2003).
[17] P.T. Wu, Y.Y. Hung, Z.P. Lin Intelligent forecasting system based on
integration of electromagnetism-like mechanism and fuzzy neural network.
Expert Systems with Applications 41: 26602677 (2014).