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 [email protected]
SAROJINI Jajimoggala
Assistant Professor Dept of Mechanical Engineering GITAM Institute of Engineering
GITAM UNIVERSITY [email protected]
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 cE(X) =0,
cI(X) ≤0,
l≤ x≤ u, ---( 1 )
where f: Rn→R is the objective function, cE:Rn→RmE are m equality constraint functions, cI:Rn→RmI 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.
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 one–way 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:
2.1.The particle swarm algorithm for constrainedoptimization
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:
∑ ∑
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 ={x1(0) ,…., xs(0)}
v ={v1(0) ,…., vs(0)}
2. Let t = 0 and yp(t) = xp(t),p=1,…,s
3. For all p in {1, ... ,s} do:
If H(yp(t)) > H(xp(t)) or H(yp(t)) ≤ H(xp(t)) or H(xp(t)) ≤ 1+ε and f(yp(t)) > f(xp(t)) then set yp(t+1) = xp(t) else
set yp(t+1) = yp(t)
4. For all p in {1,…, s} do,compute vp(t +1) and xp(t +1) using
xp(t+1) = xp(t) + vp(t+1)
vp(t+1)=ωvp(t)+c1r1(lbest-xp(t))+c2r2(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:
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)
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 +√2πR2)
Allowable stress: 0.5Sy= (0.5)(250×106) = 125 ×106 Pa
Allowable tip displacement: 10¯4L = (10¯4)(3)=3×10¯4 Subject to
0 ≤σmax ≤ 125×106 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
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
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 ≤ 200×106 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
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
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
Problem
Software used
R W H σa ua Vol
0.01 ≤ R≤0.25 (meters)
0.02≤W≤0.5 (meters)
0.02≤ W ≤
0.5(meters) 125×10
6
(Pa) 0.3(mm) Min(m
3
)
1
Ansys 0.1797266 0.2793173 0.2819962 914.33 ×104 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(m3)
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.193–197(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.56–59, 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.5069–5079, 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.302–311.
[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 September–6 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.471–479.
[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.598–605..
[19] Yuhui Shi and Russell C. Eberhart “Parameter Selection in Particle Swarm Optimization”,(1998) . Lecture Notes In