You are on page 1of 13

International Journal of Engineering Research in Africa Submitted: 2017-03-07

ISSN: 1663-4144, Vol. 35, pp 185-197 Revised: 2017-09-28


doi:10.4028/www.scientific.net/JERA.35.185 Accepted: 2017-10-06
© 2018 Trans Tech Publications, Switzerland Online: 2018-03-30

An Improved Harmony Search Algorithm for a Planar Parallel Robot


Synthesis
Badreddine ABOULISSANEa*, Dikra EL HAIEKb and Larbi EL BAKKALIc
Team Modeling and Simulation of Mechanical Systems, Abdelmalek Essaadi University,
Faculty of Sciences, Tetouan, Morocco
a b c
b.aboulissane@gmail.com, dikra.elhaiek@gmail.com, elbakkali.larbi@gmail.com

Keywords: Trajectory synthesis; Parallel mechanism; Heuristic algorithms; Mechanism synthesis

Abstract. The objective of kinematic synthesis is to determine the mechanism dimensions such as
link lengths, positions or joint coordinates, in order to approximate its output parameters such as
link positions, trajectory points, and displacement angles. Kinematic synthesis is classified into
three categories: function generation, path generation, and motion generation. This paper is
dedicated only to path generation. As the number of trajectory points increases, analytical methods
are limited to obtain precisely mechanism solutions. In that case, numerical methods are more
efficient to solve such problems. Our study proposes an improved heuristic algorithm applied to
four-bar mechanism path-generation. The objective of this work is to find optimum dimensions of
the mechanism and minimize the error between the generated trajectory and the desired one, taking
into consideration constraints such as: Grashof condition, transmission angle, and design variables
constraints. Finally, our results are compared with those found by other evolutionary algorithms in
the literature.

Introduction
A mechanism is a set of rigid elements connected in a specific arrangement, to produce a desired
motion or to transfer the energy from the inputs of the mechanism to its outputs. During the design
stage, mechanisms are either analyzed or synthesized [1,2,3]. In the instance of kinematic synthesis,
which is classified into three categories: function generation, path generation, and motion
generation. This work is dealing with path synthesis problem of four bar linkage, where synthesis is
performed by trajectory generation with the coupler point using precision points. The analytical
technique is limited to five precision points [4]. For more than five points the problem can be solved
by using an optimization approach to find mechanism’s parameters such as length of links, and
angles, in order to minimize the error between the desired path represented by the precision points
and the traced path generated by the four bar mechanism, considering constraints that have to be
fulfilled during the optimization of the linkage.

Different optimization approaches used to synthesis mechanisms are reported in the literature. A
hybrid multi-objective Genetic Algorithms (GAs) are used for Pareto optimum synthesis of four-bar
mechanism [5]. Cabrera introduced a Genetic Algorithm (GA) for optimal synthesis of four bar
linkages [6]. Wen-Yi Lin [7] used a Genetic Algorithm and a Differential Evolution (GA-DE)
hybrid evolutionary algorithm. Artificial Bee Colony (ABC) algorithm have been adopted for path
synthesis of the same mechanism [8]. Acharyya et al. [9] presented a comparative study to find out
performances of three evolutionary algorithms: (GA), Particle Swarm Optimization (PSO) and (DE)
with a new improvement technique applied on mechanism design. A combined Genetic Algorithm–
Fuzzy Logic method (GA–FL) in mechanisms synthesis have been proposed by Laribi et al. [10].
Recently researchers have become interested in solving various problems with heuristic
optimization methods, which are relatively fast and precise. In this paper, trajectory synthesis
problem of four bar linkages has been considered and formulated as an optimization problem using
the Improved Harmony Search algorithm (IHS) [11,12,13,14,15] so that the coupler of the

All rights reserved. No part of contents of this paper may be reproduced or transmitted in any form or by any means without the written permission of Trans
Tech Publications, www.scientific.net. (#107683262, Swinburne University, Hawthorn, Australia-30/03/18,18:46:06)
186 International Journal of Engineering Research in Africa Vol. 35

mechanism generates the desired path. The rest of this paper is organized as follows. Kinematics of
the planar four-bar mechanism is presented in section 2. Section 3 describes the objective function
and its constraints. In section 4, the improved optimization algorithm is presented. A case study is
given in section 5. Discussion and concluding remarks are presented in the last section.

Problem Formulation
Kinematics of the planar four-bar mechanism

Fig. 1: Four-bar mechanism


Fig. 1 illustrates all geometric parameters and design variables of a four bar mechanism. The
input angle is θ 2 , the design variables are: R1 , R2 , R3 , R4 , Rcx , Rcy , θ 0 , x0 ,and y0 then the unknowns
are: θ 3 and θ 4 .
Vector loop equation of four bar mechanism can be written as:
   
0
− R1 + R2 + R3 − R4 = (1)
Using the complex number form for each vector the equation becomes:

− R1eiθ1 + R2eiθ2 + R3eiθ3 − R4eiθ4 =


0 (2)
Separating real and imaginary parts of Eq. 2 and putting θ1 = 0 :

 − R1 + R2 cos θ 2 + R3 cos θ 3 − R4 cos θ 4 =


0
 (3)
 R2 sin θ 2 + R3 sin θ 3 − R4 sin θ 4 =
0

The unknown angles θ 3 and θ 4 can be calculated as a function of the input θ 2 by the equation of
Freudenstein [4]:

 K1 cos θ 4 − K 2 cos θ 2 + K=
3 cos(θ 2 − θ 4 )
 (4)
 K1 cos θ 3 − K 4 cos θ 2 + K=
5 cos(θ 2 − θ 3 )
International Journal of Engineering Research in Africa Vol. 35 187

Where K1 , K 2 , K 3 , K 4 and K5 are:

R1 R1 R22 − R32 + R42 + R12 R1 R42 − R12 − R22 − R32


=K1 = , K2 = , K3 = , K4 = , K5
R2 R4 2 R2 R4 R3 2 R2 R3
From Eq. 4 θ 3 and θ 4 are given by Eq. 5 and Eq. 6 for open and crossed configuration:

 − B ± B 2 − 4 AC 
θ3 = 2 tan −1   (5)
 2A 

 − E ± E 2 − 4 DF 
θ 4 = 2 tan −1   (6)
 2D 

Where:
A = − K1 + (1 − K 2 ) cos θ 2 + K 3 D = − K1 + (1 + K 4 ) cos θ 2 + K5
 
B = −2sin θ 2 and  E = −2sin θ 2
C = K − (1 + K ) cos θ + K  F = K + ( K − 1) cos θ + K
 1 2 2 3  1 4 2 5

Position of the Coupler


The position of the point C in the system OR X RYR as represented in Fig. 1 is:

C X R = R2 cos θ 2 + Rcx cos θ 3 − Rcy sin θ 3


 (7)
CYR = R2 sin θ 2 + Rcx sin θ 3 + Rcy cos θ 3

The vector loop is given in Fig. 1 is written as:


  
OC OOR + ORC
= (8)
In matrix form, the coordinates of the coupler point are defined by:

C X  cos θ 0 − sin θ 0  C X R   x0 


   sin θ  +  (9)
CY   0 cos θ 0  CYR   y0 

Objective Function
In this work the objective function to minimize is defined as the position error, which is the sum
of squared Euclidean distances between each desired points given by the designer
Cdi = [C x ,di , C y ,di ] and generated points Ci = [C xi , C yi ] . The objective function can be expressed by:
n

∑ (C ) + (C )
2 2
f= − CXi − CYi  (10)
obj
i =1
X ,d i Y ,d i 

Where n is the number of precision points.


Constraints
The four-bar mechanism in this study, is under the following constraints:

- Law of Grashof, to allow complete mobility for at least one link on the mechanism. This law
is given by:
188 International Journal of Engineering Research in Africa Vol. 35

2  max ( R1 , R2 , R3 , R4 ) + min ( R1 , R2 , R3 , R4 ) 
1
−1 ≤ 0 (11)
∑R
n =4
n

- Ranges of the design parameters, such as links length, coordinates of the tracer and angles
are limited between a low and high value.
- The sequence of input angles, either clockwise or anticlockwise. This constraint is written
as:
 sign(θ 2i +1 − θ=
2 )
i
sign(θ 2 2 − θ 21 )

1, 2,3...,( N − 1)  sign(θ ) =
for i = +1 if θ ≥ 0 (12)
 sign(θ ) = −1 otherwise

To satisfy the 1st and the 3rd conditions, a function called penalty function have been added to the
initial objective function and is expressed as follows:

 n 
( ) + (C )
2 2
f obj  ∑  C X ,di − C X i
= − CYi  + W ( g1 + g 2 )  (13)
 i =1  
Y ,d i

Where
g=
1 0 → Grashof law issatisfied
g=
1 1 → Grashof law is not satisfied
g=
2 0 → Order of angles θ2 true
g=
2 1 → Order of angles θ2 false
In Eq. 13, g1 and g2 are zero or one and W is a high value such as 1000 that penalize the objective
function when the conditions are not satisfied.

Optimization Algorithm
The Improved Harmony Search Algorithm was first introduced by Geem [14]. This algorithm
inspired from a simulation of music composition, where musicians adjust the pitch of one or many
instruments to improve harmony. It is simple, easy to execute and requires few parameters namely
the Harmony Memory Size (HMS), the Harmony Memory Consideration Rate (HMCR), the Pitch
Adjusting Rate (PAR), Band Width (BW) number of variables (nv) and the number of iterations
(iter).
Improved Harmony Search Algorithm
The original optimization problem is modified using the new enhanced parameters namely: HMCR,
PAR and BW.
HMCR: This parameter bounded by 0 and 1, defines whether the value of a decision variable is to
be selected from HM. In order to confirm that the algorithm can rapidly find local optima in the
early operation and the solutions obtained in the later are diverse. This work adopts the following
linear decreasing approach to update HMCR [12]:

( HMCRmax − HMCRmin ) × iter


HMCR
= (iter ) HMCRmax − (14)
max iter
International Journal of Engineering Research in Africa Vol. 35 189

Where iter denotes number of iterations, max iter is the maximum total number of iterations,
HMCRmax and HMCRmin are maximum and minimum harmony memory considering rate,
respectively.
PAR: plays a role in controlling local search. The correct PAR can avoid the search being trapped
in local optimum efficiently. The smaller PAR is advantageous to rapidly find the local optimal
solution in early search stage, while a large PAR can make the search jump out the local optimal in
the later stage [12]. Therefore, dynamic change method for PAR is integrated into the algorithm in
this work, the expression for PAR is:

( PARmax − PARmin )
PAR(iter ) =
PARmin + × arctan(iter ) (15)
π
2
Where PAR (iter ) denotes pitch adjusting rate for the tth generation, PARmax and PARmin maximum
and minimum pitch adjusting rate, respectively.
BW: The better value of BW can be potentially useful in adjusting convergence rate of algorithm to
optimal solution [12]. In this work, BW changes from large to small. BW changes dynamically with
iterations as expressed in Eq. (16):

( BWmax − BWmin ) × iter


(iter ) BWmax −
BW = (16)
max iter
Where BW (iter ) denotes band width for the tth generation, BWmax and BWmin maximum and
minimum band width, respectively.
The optimization approach after the improvement follows five key steps:
- Step 1. Initialize algorithm parameters: The objective function f obj ( X ) and decision
variables are defined in this step as well as parameters of the algorithm. The HMCR, PAR
and BW defined earlier are used to improve the solution vector in each iteration.
- Step 2. Initialize the harmony search memory HM: The first Harmony Memory (HM) matrix
is represented by a number of solution vectors generated randomly. A Harmony Memory
with the size of HMS is shown below:
 x11 x21  xn1
 2 
x x22  xn2
HM =  1  (17)
     
 HMS 
 x1 x2HMS  xnHMS 

Where X
= {=
x , x ,..., x }, i
i
1
i
2
i
n 1, 2, ..., HMS is the solution candidate.

- Step 3. Improvise (generate) a new harmony (solution) vector X ' = {x1' , x2' ,..., xn' } : The
elements of X’ are obtained based on the HMCR. The HMCR parameter is the probability of
selecting an element from the present Harmony Memory matrix component, accordingly
1 − HMCR is the probability of generating it randomly. Each element obtained by memory
consideration can be mutated in accordance with the PAR . The PAR parameter is defined
as the probability of a candidate from the HM matrix to be mutated.
- Step 4. Update the harmony memory: If X’ gives a better fitness than the worst harmony in
the matrix HM, it will be included in it. Otherwise, it will be excluded.
190 International Journal of Engineering Research in Africa Vol. 35

- Step 5. Termination criterion: Step 3 and step 4 are repeated until the meeting of
Termination criterion, in that case by reaching the maximal number of iterations.
The process flow of the improved algorithm is shown in Fig. 2.

Fig. 2: The Processing Flow of the Improved Harmony Search Algorithm


Case Study
Case 1: 6 target points, 15 design variables
The first case is a problem of generating six target points arranged in a vertical line, from Ettefagh
et al. [8].
Design variables are:
X = [ R1 , R2 , R3 , R4 , Rcx , Rcy , x0 , y0 , θ 0 , θ 21 , θ 22 , θ 23 , θ 24 , θ 25 , θ 26 ]

Where ( R1 , R2 , R3 , R4 ) are the lengths of the four-bar mechanism bars, ( Rcx , Rcy ) are the set of
coordinates of the coupler point C, ( x0 , y0 , θ 0 ) represent the orientation between the coordinate
systems and (θ 21 , θ 22 , θ 23 , θ 24 , θ 25 , θ 26 ) are the input angle sequence.
International Journal of Engineering Research in Africa Vol. 35 191

Target points are defined in Table 1 as follows:

Table 1: Target points


Cdi C X ,di CY ,di

1 20 20
2 20 25
3 20 30
4 20 35
5 20 40
6 20 45
Limits of design variables:
R1 , R2 , R3 , R4 ∈ [5,60]
Rcx , Rcy , x0 , y0 ∈ [ −60,60]
θ 21 , θ 22 , θ 23 , θ 24 , θ 25 , θ 26 ∈ [0, 2π ]
The simulations and the implementation of the Improved Harmony Search (IHS) algorithm were
programmed in MATLAB R2014b on a computer with the following specifications:
Intel Core i7 @ 2.10 GHz, 8Go RAM, and windows 10 operating system. Parameters of the
Improved Harmony search algorithm are shown in Table 2.

Table 2: Parameters of the optimization method


IHS parameter Value
Maximal number of iterations 10000/15000
Harmony search size 30
Harmony memory consideration rate Max=0.95, Min=0.90
Pitch adjustment rate Min=0.99, Max=0.01
Band width Min=0.0001, Max=1

Case 2: 10 target points, 19 design variables


The second case is a problem of generating an elliptical path of ten target points. Thus for this
problem:
Design variables are:
X = [ R1 , R2 , R3 , R4 , Rcx , Rcy , x0 , y0 , θ 0 , θ 21 , θ 22 , θ 23 , θ 24 , θ 25 , θ 26 , θ 27 , θ 28 , θ 29 , θ 210 ]
Target points:
192 International Journal of Engineering Research in Africa Vol. 35

Table 3: Target points


Cdi C X ,di CY ,di

1 20 10
2 17.66 15.142
3 11.736 17.878
4 5 16.928
5 0.60307 12.736
6 0.60307 7.2638
7 5 3.0718
8 11.736 2.1215
9 17.66 4.8577
10 20 10
Limits of the variables:
R1 , R2 , R3 , R4 ∈ [5,80]
Rcx , Rcy , x0 , y0 ∈ [ −80,80]
θ0 , θ 21 , θ 22 ,... θ 210 ∈ [0, 2π ]

Results and Discussion


Case 1:
The optimization results of the first case are presented in Table 4 as well as results of previous
studies done with Differential evolution (DE) Binary Genetic Algorithm (BGA) and Particle swarm
optimization (PSO) [9]
Table 4: The comparison results
Parameters IHS PSO DE BGA
R1 49.7336 31.15501 35.02074 25.2613
R2 8.7846 5.00000 6.404196 8.3871
R3 34.0384 23.84561 31.60722 16.1828
R4 33.6379 45.803561 50.59949 30.2151
Rcx -31.9327 39.00066 20.80324 22.5806
Rcy 5.9402 18.50846 41.54364 -22.4633
θ1
2 2.0207 4.842412 6.283185 3.18152
θ2
2 2.4434 0.404684 0.264935 4.18879
θ2
3
2.8764 0.657415 0.500377 4.717
θ4
2 3.3664 0.922086 0.735321 5.08551
θ2
5
3.8694 1.247066 0.996529 5.50316
θ6
2 4.5888 2.298727 1.333549 6.08664
θ0 2.6082 0.419837 0.000000 5.65057
x0 16.4971 59.99999 60.00000 -3.57771
y0 -11.0395 17.91696 18.07791 24.5902
Error 1.5497 0.546461 0.122738 2.3319
International Journal of Engineering Research in Africa Vol. 35 193

Fig. 3 shows the six target points and the path traced by the mechanism and Fig. 4 depicts the best,
worst and average cases of the objective function.
60

Traced by 4 bar mechanism


Prescribed coupler points

50

40

30
y-axis

20

10

0
-60 -40 -20 0 20 40 60 80 100

x-axis

Figure 3: Trajectory generated by the best solution in case study 1


1400

Best case

Average case
1200
Worst case

1000

800
Best Objective Function

600

400

200

0
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

Iterations

Figure 4: Solution convergence for best, worst and average cases in case study 1
194 International Journal of Engineering Research in Africa Vol. 35

The results thus obtained in the first case are tabulated in Table 4. Fig 3 shows prescribed coupler
points and the trajectory generated by the coupler points obtained by final solution. Fig 4 shows the
evolution of the best, average and worst case of the objective function.
The first example deals with a design domain of medium size of prescribed points, six points. The
best solution was found by Differential Evolution algorithm for an error=0.122738. It is found that
Improved Harmony Search algorithm have produced an average solution (error=1.5497) less than
Binary Genetic Algorithm (error=2.3319).
Case 2:
The synthesized parameters with the Improved Harmony search optimization are presented in
Table 5 as well as results of previous studies done with Genetic Algorithm, Particle Swarm
Optimization and Differential Evolution [9].
Fig. 5 shows the ten target points and the path traced by the mechanism, Fig. 6 depicts the best,
worst, and average cases of the objective function for the second case.
Table 5: The comparison results
Parameters IHS GA PSO DE
R1 16.7197 79.981513 52.535162 54.360893
R2 64.5989 9.109993 52.535162 8.683351
R3 68.6569 72.936511 36.155078 34.318634
R4 46.1913 80 80 79.996171
Rcx 45.0847 0 0 0.000187
Rcy 51.1248 0 1.481055 1.46525
θ2
1
4.9530 6.283185 6.282619 6.283185
θ2
2
5.2911 0.600745 0.615302 0.616731
θ2
3
5.6060 1.372812 1.305421 1.310254
θ2
4
5.8507 2.210575 2.188053 2.19357
θ2
5
6.0500 2.862639 2.913049 2.91717
θ2
6
6.2232 3.420547 3.499313 3.490746
θ2
7
6.2832 4.072611 4.125586 4.132017
θ2
8
4.1110 4.910373 4.919977 4.922075
θ2
9
4.5627 5.68244 5.685021 5.695372
θ10
2 4.8854 6.283185 6.282323 6.28297
θ0 2.6919 0.026149 1.403504 2.12965
x0 -3.2512 10.155966 11.002124 10.954397
y0 31.2571 10 11.095585 11.074534
Error 1.9207 2.281273 1.971004 1.952326
International Journal of Engineering Research in Africa Vol. 35 195

25

Traced by 4 bar mechanism

Prescribed coupler points


20

15

10
y-axis

-5
-5 0 5 10 15 20 25

x-axis

Figure 5: Trajectory generated by the best solution in case study 2

3000

Best case
2800 Average case

Worst case

2600

2400

2200
Best Objective Function

2000

1800

1600

1400

1200

1000
0 5000 10000 15000
Iterations

Figure 6: Solution convergence for best, worst and average cases in case study 2
196 International Journal of Engineering Research in Africa Vol. 35

The second case is a trajectory synthesis problem for increased design variables due to high number
of given target points, ten points. The results thus obtained by IHS algorithm are shown in Table 5,
Fig. 5 and Fig 6.
It is observed that the IHS algorithm produced the best solution (error=1.9207) than the GA, PSO
and DE algorithms. Fig. 6 shows that the convergence rate is fast for the best case within
6000 iterations.

Conclusion
This work presents an approach to find out the parameters of a planar parallel robot for a given
trajectory using Improved Harmony Search algorithm with an enhancement applied to the
algorithm. Constraints are satisfied using penalty term in objective function. A new technique has
been developed using IHS algorithm to design the four-bar mechanism with prescribed target points.
A comparative study of the results based on different evolutionary algorithms for trajectory
synthesis of planar parallel robot is also presented. This approach offers the advantage of being easy
to implement.
An algorithm is presented to enhance the position error between the target points chosen by the
designer for the coupler point and the points traced by the mechanism, based on two cases:
- First case, deals with six prescribed points. The best solution was found by Differential
Evolution algorithm for an error=0.122738. We note that Improved Harmony Search
algorithm gives an average solution, error=1.5497, less than Binary Genetic Algorithm,
error=2.3319.
- Second case, which is a ten points problem, the IHS algorithm provides the best solution,
error=1.9207, compared to GA, PSO and DE algorithms.
It was observed that the IHS shows fast convergence to the optimal result for the second case and a
minimal error between prescribed points and generated once by the mechanism.

References
[1] V. Dolga and L. Dolga, “Elements of Synthesis and Experiment for Parallel Robots,” in
Mechanisms, Mechanical Transmissions and Robotics, 2012, vol. 162, pp. 549–558.
[2] C. E. Moldovan and C. Sticlaru, “On the Synthesis of a Five Bar Linkage for Linear
Trajectory Using a CAD Analysis,” in Advanced Concepts in Mechanical Engineering I,
2014, vol. 658, pp. 95–98.
[3] P. S. Shiakolas, D. Koladiya, and J. Kebrle, “On the optimum synthesis of six-bar linkages
using differential evolution and the geometric centroid of precision positions technique,”
Mech. Mach. Theory, vol. 40, no. 3, pp. 319–335, 2005.
[4] F. Freudenstein, “Approximate synthesis of four-bar linkages,” Resonance, vol. 15, no. 8, pp.
740–767, 2010.
[5] N. Nariman-Zadeh, M. Felezi, A. Jamali, and M. Ganji, “Pareto optimal synthesis of four-bar
mechanisms for path generation,” Mech. Mach. Theory, vol. 44, no. 1, pp. 180–191, 2009.
[6] J. a. Cabrera, a. Simon, and M. Prado, “Optimal synthesis of mechanisms with genetic
algorithms,” Mech. Mach. Theory, vol. 37, no. 10, pp. 1165–1177, 2002.
[7] W. Y. Lin, “A GA-DE hybrid evolutionary algorithm for path synthesis of four-bar linkage,”
Mech. Mach. Theory, vol. 45, no. 8, pp. 1096–1107, 2010.
[8] M. M. Ettefagh, “Path synthesis of the four-bar mechanism using ABC algorithm and
comparing with BGA,” vol. 0, no. 1, pp. 2–6, 2013.
International Journal of Engineering Research in Africa Vol. 35 197

[9] S. K. Acharyya and M. Mandal, “Performance of EAs for four-bar linkage synthesis,” Mech.
Mach. Theory, vol. 44, no. 9, pp. 1784–1794, 2009.
[10] M. A. Laribi, L. Romdhane, A. Mlika, and S. Zeghloul, “A Combined Genetic Algorithm-
Fuzzy Logic Method (GA-FL) to Design a 6 Bars Planar Mechanism,” no. 41731. pp. 733–
738, 2004.
[11] E. Vega-alvarado and E. A. Portilla-flores, “Synthesis of a Four-Bar Mechanism for Position
Control Using the Harmony Search Algorithm,” 2014.
[12] W. Sun and X. Chang, “An Improved Harmony Search Algorithm for Power Distribution
Network Planning,” vol. 2015, 2015.
[13] Z. W. Geem, Recent advances in harmony search algorithm, vol. 270. 2010.
[14] K. S. Lee and Z. W. Geem, “A new meta-heuristic algorithm for continuous engineering
optimization: Harmony search theory and practice,” Comput. Methods Appl. Mech. Eng., vol.
194, no. 36–38, pp. 3902–3933, 2005.
[15] Z. Kong, L. Wang, Z. Wu, S. Qi, and D. Zou, “An Improved Adaptive Harmony Search
Algorithm *,” no. Iccse, pp. 743–747, 2012.

You might also like