You are on page 1of 10

DESIGN OPTIMIZATION BY USING

PARTICLE SWARM OPTIMIZATION IN


MATLAB AND APDL IN ANSYS
M.AMRITA
Assistant Professor
Dept of Mechanical Engineering
GITAM Institute of Engineering
GITAM UNIVERSITY
amritraj_vib@yahoo.co.in

SAROJINI Jajimoggala
Assistant Professor
Dept of Mechanical Engineering
GITAM Institute of Engineering
GITAM UNIVERSITY
Sarojini.jaji@gmail.com

Abstract: For optimization of real time problems it is difficult to generate equations which are to be optimized.
Such problems can be optimized by using Design Optimization in ANSYS. But in many cases, it gives an
optimum solution which is slightly infeasible which means it slightly violates the constraints. In this work our
aim is to solve one of such practical problem in ANSYS and optimize it using optimization technique particle
swarm optimization (PSO) run from mat-lab. It was found that the result obtained from this case are more
reliable than that obtained from Design Optimization in ANSYS, as the optimum solution obtained from the
second case is either slightly infeasible or is not the global optimum.

Keywords: APDL language; Particle Swarm optimization; Design Optimization; ANSYS.

1.INTRODUCTION:

Finding an alternative with the most cost effective or highest achievable performance under the given
constraints, by maximizing desired factors and minimizing undesired ones is optimization. A nonlinear
constrained optimization problem can be defined as
Min f(X); X Rn
s.t c
E
(X) =0,
c
I
(X) 0,
l x u, ------------------------( 1 )
where f: RnR is the objective function, c
E
:R
n
R
mE
are m equality constraint functions, c
I
:R
n
R
mI
are m
inequality constraint functions, and l and u are simple bounds on variables x.li = and li= + meaning that
variable xi , ( i = 1, n ) may not have a lower and/or an upper bound.
Optimization is often carried out by conventional methods such as Gradient search or direct search
methods which are computationally efficient but local in nature. Recently nonconventional methods such as
Artificial Neural Networks, Genetic Algorithms (GA) and simulated annealing (SA) have been widely
employed in different optimization applications in the past. Artificial Neural Networks is simplified model of
human brain; Genetic Algorithm is inspired by human evolution based on Darwins principle of survival of the
fittest and simulated annealing is based on the manner in which liquids freeze or metals recrystalize in the
process of annealing. Recently, an other non-conventional optimization procedure based on social system-The
collective behaviours of simple individuals interacting with their environment and each other called swarm
intelligence has gained popularity. It can solve continuous global optimization problem with a non-linear
objective function. There are two popular swarm inspired methods: Ant colony optimization (ACO) and particle
swarm optimization (PSO). ACO is inspired by the behaviours of ants and has many successful applications in
discrete optimization problems. PSO is inspired by behaviour of a bird flock or a school of fish in search of
food. Particle swarm optimization (PSO) is a population based stochastic optimization technique first proposed
by Dr. Eberhart and Dr. Kennedy. It shares several similarities with GA. Both starts with randomly generated
initial values, evaluates the objective function at each initial value and uses it as the basis for selection of best
M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1876
values, updates the initial values, uses random method to search for optimum. Both do not guarantee an
optimum point.PSO has few advantages over GA. PSO does require complex encoding and decoding. It can
work directly with real numbers. It does not require operators such as crossover and mutation. In PSO, the
potential solutions, called particles, fly through the problem space by following the current optimum particles.
Compared to GA, the PSO is easy to implement and there are few parameters to adjust. In GAs, chromosomes
share information with each other. So the whole population moves like a one group towards an optimal area. In
PSO, only gBest (or lBest) gives out the information to others. It is a oneway information sharing mechanism
i.e. the evolution only looks for the best solution. These advantages make PSO to be applied easily to
optimization problems.
Many problems have been optimization using GA and PSO in different fields of application. Ou and
Lin [16] (2006) showed that the performance of PSO is better than that of GA and so is a preferable method to
optimization parameters of PID controller. Braik et al .[6] (2008), confirmed the potential of PSO-based ANN
model to successfully model the TE process. Iswandy and Konig [12] (2006) showed that PSO method provided
superior results of 100% recognition in generalisation for thresholding than GA.Hassan et al.[9] (2005)
compared PSO with GA and claimed that PSO has the same effectiveness as the GA but with significantly better
computational efficiency. Chang [7] (2009) compared GA and PSO in optimisation applied to constructing
equity portfolios and showed that PSO is better than GA.Baedi et al.[5] (2010) has used PSO for optimum
designing of optical thin film. In the field of design of composite structures, Kathiravan and Ganguli [13] (2007)
used both gradient-based and PSO methods for optimal design of composite beam structure. He showed that the
PSO results in somewhat better design than gradient-based methods. Apalak et al. [2] (2007) used GA for
optimizing laminated composite plate for maximum fundamental frequency. Suresh et al.[18] (2007) used PSO
for multi-objective composite box-beam design. Ananda Rao et al.[3] (2002) used SA for optimum design of
multilayer composite plate. Diaconu et al.[8] (2002)found the optimum lay up for thick plates to maximise the
fundamental frequencies using a mathematical programming method. M.Amrita and N Mohan Rao [14] (2011)
showed that GA performs better than PSO and pattern search method and so is the preferable method in design
of composite plate structures.
In all the above cases, the objective function and constraints has been developed in the form of
equations which are further used for optimization. Till date, less work has been done in investigating the
effectiveness of PSO when applied to practical problems where generation of equations for the objective
function and constraints are difficult. In such cases, the problem can be analysed in ANSYS, which generates
the equation for objective variable. Then optimization problem from Matlab can be linked with the ANSYS file
for optimization purpose. In this work, an attempt has been made to solve one of such practical problem in
ANSYS and optimize it using optimization technique particle swarm optimization (PSO) run from mat-lab.

2. PARTICLE SWARM OPTIMIZATION:

Particle swarm optimization (PSO) is a population based stochastic optimization technique, inspired by
social behavior of bird flocking or fish schooling .If a problem is given, and there is some way to find a
solution to it in the form of a fitness function, then this method can be used. A population of individuals defined
as random guesses of the problem solution is initialized. These individuals are also known as the particles, hence
the name particle swarm. Value of the objective function for these individuals represents their positions. An
iterative process to improve these positions is then started. The particles iteratively evaluate the positions and
remember the location where they had their best success. The individual's best solution is called the particle best
or the local best. Each particle makes this information available to their neighbors. They are also able to see
where their neighbors have had success. The best solution among all the neighbors is called global best.
Movements through the search space are guided by these successes, with the population usually converging, by
the end of a trial, on a problem solution better than that of non-swarm approach using the same methods as this
algorithm uses the global best and local bests. Many modifications has been made in the basic PSO. Parsopoulos
and Vrahatis[17],(2002) proposed a penalty framework for constrained optimization based on a Particle Swarm
Paradigm (PSP) for solving the resulting unconstrained subproblems.Hu and Eberhart,[10] (2002) and later Hu
et al., [11] (2003) also proposed an algorithm based on PSP for nonlinear constrained optimization. The
algorithm finds initial feasible population and ensures feasibility during the entire optimization process.
However, for small feasible regions (in particular when equality constraints are present), obtaining of initial
feasible population can be a difficult task with too many constraint evaluations. Ismael F. Vaz [1] (2006)
proposed an algorithm to find the global optimum of problem (1) that uses a relaxed dominance concept adapted
from the multi-objective optimization, to be able to assess progress towards feasibility and optimality.




M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1877
2.1.The particle swarm algorithm for constrained optimization
Ismael F. Vaz[1] proposed an algorithm to find the global optimum of problem (1) that uses a relaxed
dominance concept adapted from the multiobjective optimization, to be able to assess progress towards
feasibility and optimality. To measure the infeasibility of a particle he proposed the following function:

H(x) = e
( lug(1+|
t
E
(x)|)+
mE
t=1
lug[1+j
t
l
(x)[
+
)
mE
t=1

where [c]+ = max{0, c} . The infeasibility function H : Rn [1,+ ] does not account for the simple bound
constraints as they are addressed by the projection of the particle position.
For infeasibility function H(x)
H=1 if x is feasible
>1 if x is infeasible.
Thus, problem (1) can then be replaced by the equivalent problem
Min f(x) ; x Rn
s.t H(x) =1
l x u
The dominance concept is adapted to this constrained uniobjective function problem

2.2Algorithm for non linear constrained PSO algorithm (2006)
1. Randomly initialize the swarm positions and velocities
x ={x
1
(0) ,., x
s
(0)}
v ={v
1
(0) ,., v
s
(0)}

2. Let t = 0 and y
p
(t) = x
p
(t),p=1,,s

3. For all p in {1, ... ,s} do:

If H(y
p
(t)) > H(x
p
(t)) or H(y
p
(t)) H(x
p
(t)) or H(x
p
(t)) 1+ and f(y
p
(t)) > f(x
p
(t)) then set y
p
(t+1) = x
p
(t) else
set y
p
(t+1) = y
p
(t)

4. For all p in {1,, s} do,compute v
p
(t +1) and x
p
(t +1) using

x
p
(t+1) = x
p
(t) + v
p
(t+1)
v
p
(t+1)=v
p
(t)+c
1
r
1
(lbest-x
p
(t))+c
2
r
2
(gbest - xp(t))
where lbest is particle position with the best objective function value so far and gbest is a best solution among
all neighbours.
The new particle is projected onto the region defined by the simple bounds using the following procedure:

x
t
p
_
x
t
p
tI l
t
x
t
p
u
t
l
t
tI x
t
p
l
t
u
t
tI x
t
p
> u
t
_

5. If the stopping criterion is true, then stop. Otherwise set t = t +1 go to step 3.

There are several guidelines about the selection of the parameters in PSO as available from the literature of
Yuhui Shi and Russell C. Eberhart[19],(1998) .

3.ANSYS Parametric Design Language (APDL)

ANSYS Parametric Design Language (APDL) is a language that is used to build the model and automate tasks
by using parameters (variables)[4]. A sequence of ANSYS commands can be recorded in a macro file which
enables the user to create a customized ANSYS command that executes all of the commands required for a
particular analysis. APDL is the foundation for sophisticated features such as design optimization and adaptive
meshing. APDL is a powerful language for optimizing the FEM workflow.




M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1878
3.1.Steps For Linking Matlab With Ansys:
1. Create an ansys file for the problem to be solved by initializing the design variables using scalar parameters
from utility menu.
2. Write the log file for the ansys file created.
3.Write the program for constrained pso in matlab to minimize the objective function.
4.In the main matlab file, give a command to run ansys in batch mode.Initialize the design variables in ansys by
sending the arguments from matlab and then read the solution from Ansys

4. PROBLEM DESCRIPTION:

Two practical optimization problems are taken and they are optimized by using two methods. One method is by
using Design Optimization in ANSYS. In the other method, ANSYS input file is generated and is merged with
MATLAB optimization program to obtain the optimum result. Both the problems are taken from Ansys
Tutorial.

4.1. PROBLEM 1: Minimize the weight of a stiffened beam shown in figure. Part 1 is a beam of rectangular
cross sections and part 2 is a bar of circular cross section both made of structural steel. The allowable stress in
the elements is assumed to be 0.5Sy. The tip displacement is constrained to be not greater than 10-4 L. Let the
yield strength and length of the beam be Sy =250 Mpa and length = 3m respectively.



4.1.1. Problem Formulation:
Let L,W,H be length,width and height of the beam and R be radius of circular cross section of the bar.
Volume of the structure (objective variable): V = L(WH +2R
2
)
Allowable stress: 0.5Sy= (0.5)(25010
6
)
= 125 10
6
Pa
Allowable tip displacement: 10
4
L = (10
4
)(3)=310
4

Subject to
0 max 125106
0 u1 3 10-4
0.01 R 0.25
0.02 W 0.5
0.02 H 0.5
Where max is the maximum absolute value of stress.

4.1.2.RESULTS:
a)Results Obtained Using Design Optimization: The problem has been solve by using Design Optimization in
ANSYS and the results are shown in fig 1.Variation of height(H) and width (W),maximum stress, displacement
and volume with the number of iterations are shown in figures 2 to 5.

b) Results Obtained Using PSO program in Matlab Linked With Ansys: An ansys file is created for the
problem and it is run from matlab using PSO constrained algorithm. The results obtained are given below:
Best = 0.16119384702341 0.50000000000000 0.28454580448995(R,W,H)
Volume = 0.77313364363710
gbestinfes = 1
Stress Maximum = 4.988741193486000e+006
Deflection = 1.596100653792000e-004

M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1879
Variation of infesibility function, displacement, maximum stress and volume with the number of iterations are
shown in figures 6 to 9.




























































Fig 1: Results from Design Optimization in ANSYS Fig 2: Variation of H and W with iterations




Fig 3: Variation of max stress with iterations Fig 4: Variation of Displacement with iterations



Fig 5: Variation of Volume with number of iterations

M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1880


































4.2. PROBLEM 2: A beam has a force of 1000N applied as shown below. Minimize the weight of the beam
without exceeding the allowable stress. It is necessary to find the cross sectional dimensions of the beam in
order to minimize the weight of the beam. The width and height of the beam cannot be smaller than 10mm. The
maximum stress anywhere in the beam cannot exceed 200 MPa. The beam is to be made of steel with a modulus
of elasticity of 200 GPa.

4.2.1 Problem Formulation:
Let W, H be width and height of the beam.
Weight of the beam (Objective Variable), W= g * Volume of the beam
As g is constant, volume of beam is Objective variable, V = LWH
Subject to
0 max 20010
6

0 W 10 mm
0 H 10 mm
Where max is the maximum absolute value of stress.





Fig 6: Variation of Infesibility with number of iterations Fig 7: Variation of displacement with iterations



Fig 8: Variation of Volume with number of iterations Fig 9: Variation of Stress with number of iterations
M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1881
4.2.2. RESULTS:
a)Results Obtained Using Design Optimization: The problem has been solve by using Design Optimization in
ANSYS and the results are shown in fig 10.Variation of height(H) and width (W),maximum stress and volume
with the number of iterations are shown in figures 11 to 13.







































b) Results Obtained Using Matlab Linked With Ansys: An ansys file is created for the problem and it is run
from matlab using PSO constrained algorithm. The results obtained are given below:
Best=10.0000000 33.54109420633 (W,H)
Volume = 335411
gbestinfes = 1
Stress Maximum = 1.999990419228000e+002(Maximum Stress)
Variation of infeasibility, volume and maximum stress and with the number of iterations is shown in figures 14
to 16











Fig 10: Results from Design Optimization in ANSYS Fig 11: Variation of H and W with iterations



Fig 12: Variation of Stress with iterations Fig 13: Variation of Volume with iterations

M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1882
































5. CONCLUSION:

The two problems are optimized by using two methods. One method is by using Design Optimization in
ANSYS. In the other method, ANSYS input file is generated and is merged with MATLAB optimization
program to obtain the optimum result .The results obtained from both the methods are compared.
It was found that the result obtained from the second case is better than that obtained from the first case, as the
optimum solution obtained from the first case is either slightly infeasible which means it slightly violates the
constraints, so not reliable (as in case of problem 1) or is not the global optimum (as in case of problem 2).





















Fig 14: Variation of Infeasibility with iterations Fig 15: Variation of Volume with iterations



Fig 16: Variation of Maximum stress with number of iterations
M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1883
P
r
o
b
l
e
m


Software used

R

W

H

a

u
a


Vol
0.01 R0.25
(meters)
0.02W0.5
(meters)
0.02 W
0.5(meters)
12510
6
(Pa) 0.3(mm)
Min(m
3
)



1

Ansys


0.1797266


0.2793173


0.2819962

914.33 10
4

0.3015 ( > 0.3)
Infeasible sol
0.6668
Ansys + Matlab
Optimization
0.16119384 0.50000 0.28454580 498.77 10
4
.15961 0.77313
2
Software used
W H
max
- - Vol
W>10(meters) H >10(meters)
200 10
6

Pa

-
-
Min(m
3
)

Ansys

13.140769 29.263169 199.948896 - -
384540.5
( Local
Minimum)
Ansys +Matlab
Optimization
10.00000 33.5410942 199.999041 - - 335411

6. FUTURE SCOPE:

In design, construction and maintenance of any engineering system, engineers have to take technological and
managerial decisions at several steps. The ultimate goal of these decisions is to either minimize the effort
required or to maximize the desired benefit which is optimization of the given resources. But for many real time
problems it is difficult to generate equations which can be optimized. Such problems can be solved by using the
second method proposed in this work i.e by generating an ANSYS input file and merging it with MATLAB
optimization program to obtain the optimum result.
*The values in italic and bold in Table indicates the cause where Design optimization in ANSYS fails.
** Processor specifications-INTEL(R) Pentium(R)4 CPU 1.80GHz,504 Mb RAM

7. REFERENCES :

[1] A. Ismael F. Vaz ir kt. , Optimization Of Nonlinear Constrained Particle Swarm,(2006), KIO TECHNOLOGINIS IR
EKONOMINIS VYSTYMAS , Vol XII, No 1, 30. 31
[2] Apalak, M.K., Yildirm, M. and Ekic, R. Layer optimisation for maximum fundamental frequency of laminated composite plates for
different edge conditions, (2007) Composites Science and Technology, doi:10.1016/j.compscitech. 2007.06.031
[3] Ananda Rao, M., Ratnam, Ch., Srinivas, J. and Prem Kumar, A. Optimum design of multilayer composite plate using simulated
annealing, (2002)Proceedings of the I MECH E Part L Journal of Materials: Design and Applications, August,Vol. 216, No. 3,
pp.193197(5).
[4] ANSYS Parametric Design language Guide Release 12.0 , SASIP,Inc (2009) ANSYS Tutorial Release 7
[5] Baedi, J., Arabshahi, H., Gordi Armaki, M. and Hosseini, E. Optical design of multilayer filter by using PSO algorithm, (2010)
Research Journal of Applied Sciences, Engineering and Technology, Vol. 2, No. 1, pp.5659, ISSN: 2040-7467 Maxwell Scientific
Organization, 2009
[6] Braik, M. and Sheta, A. and Arieqat, A A Comparison between GAs and PSO in Training ANN to Model the TE Chemical Process
Reactor, (2008), AISB 2008 Convention on Communication, Interaction and Social Intelligence in the University of Aberdeen.
[7] Chang, J-F. A performance comparison between genetic algorithms and particle swarm optimization applied to constructing equity
portfolios, (2009), International Journal of Innovative Computing, Information and Control ICIC International c 2009, December,
Vol. 5, No. 12(B),pp.50695079, ISSN 1349-4198.
[8] Diaconu, C.G., Sato, M. and Sekine, H. Layup Optimization of Symmetrically Laminated Thick Plates for Fundamental Frequencies
using Lamination Parameters Structural and Multidisciplinary Optimization(2002), Vol. 24, No. 4, pp.302311.
[9] Hassan, R., Cohanim, B., de Weck, O. and Venter, G. A Comparison of Particle Swarm Optimization and the
Genetic Algorithm, (2005), American Institute of Aeronautics and Astronautics.
[10] Hu, X. and Eberhart, R. Solving constrained nonlinear optimization problems with particle swarm optimization,(2002). Proceedings
of the Sixth World Multiconference on Systemics, Cybernetics and Informatics (SCI 2002), Orlando, USA.
[11] Hu, X.; Eberhart, R. and Shi, Y. Engineering optimization with particle swarm. In: Proceedings of the IEEE Swarm Intelligence
Symposium (SIS 2003), Indianapolis, Indiana,USA, , p. 53.57. (2003)
[12] Iswandy, K. and Konig, A. Comparison of PSO-based optimized feature computation for automated configuration of multi-sensor
systems, (2006) Proc. of 11th Online World Conference on Soft Computing in Industrial Applications WSC11, 18 September6
October.
[13] Kathiravan, R. and Ganguli, R. Strength design of composite beam using gradient and particle swarm optimization, (2007) Science
direct, Composite Structures, Vol. 81, pp.471479.
[14] M. Amrita , N. Mohan Rao Optimal design of multilayered composite plate using bio-inspired optimisation techniques(2011), Int. J.
Bio-Inspired Computation, Vol. 3, No. 5, 2011
[15] MATLAB (ver 7.0) The MathWorks Inc., 3 Apple Hill Drive, Natick, M.A 01760 2008.
M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1884
[16] Ou, C. and Lin, W. Comparison between PSO and GA for parameters optimization of PID controller, (2006) Proceedings of the 2006
IEEE International Conference on Mechatronics and Automation.
[17] Parsopoulos, K. E. and Vrahatis, M. N. Particle swarm optimization method for constrained optimization problems, (2002).. In
Proceedings of the Euro-International Symposium on Computational Intelligence.
[18] Suresh, S., Sujit, P.B. and Rao, A.K. Particle swarm optimization approach for multi-objective composite box-beam design, (2007)
Composite Structures, December, Vol. 81, No. 4, pp.598605..
[19] Yuhui Shi and Russell C. Eberhart Parameter Selection in Particle Swarm Optimization,(1998) . Lecture Notes In
ComputerScience;Vol.1447 Proceedings of the 7th International Conference on Evolutionary Programming VII Pages: 591 600.
M.Amrita et al. / International Journal of Engineering Science and Technology (IJEST)
ISSN : 0975-5462 Vol. 4 No.05 May 2012 1885

You might also like