0% found this document useful (0 votes)
33 views

Use of Genetic Algorithms in Topology Optimization

The document discusses using genetic algorithms for topology optimization of truss structures. It defines the optimization problem and describes how genetic algorithms can be applied. Specifically, it discusses: 1) Defining the objective function as minimizing the total mass of the structure. 2) Constraints including force equilibrium, stress limits, and minimum/maximum allowable stresses. 3) Implementing a genetic algorithm to perform the optimization, simulating Darwinian evolution principles like selection, crossover and mutation. 4) Integrating the genetic algorithm with finite element software like ANSYS to efficiently analyze structural properties at each iteration.

Uploaded by

bill
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Use of Genetic Algorithms in Topology Optimization

The document discusses using genetic algorithms for topology optimization of truss structures. It defines the optimization problem and describes how genetic algorithms can be applied. Specifically, it discusses: 1) Defining the objective function as minimizing the total mass of the structure. 2) Constraints including force equilibrium, stress limits, and minimum/maximum allowable stresses. 3) Implementing a genetic algorithm to perform the optimization, simulating Darwinian evolution principles like selection, crossover and mutation. 4) Integrating the genetic algorithm with finite element software like ANSYS to efficiently analyze structural properties at each iteration.

Uploaded by

bill
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/240623182

Use of genetic algorithms in topology optimization of truss structures

Article  in  Mechanika · January 2007

CITATIONS READS

15 619

2 authors:

Dmitrij Šešok Rimantas Belevičius


Vilnius Gediminas Technical University Vilnius Gediminas Technical University
40 PUBLICATIONS   155 CITATIONS    45 PUBLICATIONS   285 CITATIONS   

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Rimantas Belevičius on 10 April 2014.

The user has requested enhancement of the downloaded file.


34

ISSN 1392 - 1207. MECHANIKA. 2007. Nr.2(64)

Use of genetic algorithms in topology optimization of truss structures


D. Šešok*, R. Belevičius**
*Vilnius Gediminas Technical University, Saulėtekio al. 11, 10223 Vilnius, Lithuania, E-mail: [email protected]
**Vilnius Gediminas Technical University, Saulėtekio al. 11, 10223 Vilnius, Lithuania, E-mail: [email protected]

1. Introduction where Le is the length of eth element, ρ e is density, and


Ae is cross-sectional area of the same eth element.
Topology optimization of truss or frame systems
is relevant and together complex technical problem, be- The most important property of any structure, e.g.
cause the objective function is nonlinear and nonconvex. a truss or other is its stability. Therefore the first set of con-
The algorithms of variant calculations for the straints on the problem consists of nodal forces balance
problems of practical size are not capable due to huge equation for all nodes of the structure
amount of calculations. For example, for truss structure
k r
consisting of 4 nodes (1+3)*0.5*3 = 6 different connection
variants are possible. For more realistic problem, suppose
∑ Fij = 0 (2)
j =1
having 100 nodes, there are (1+99)*0.5*99 = 4950 possi-
ble connections or about 1.25*101490 different truss struc- r
where Fij is jth force at ith node. This set of constraints for
ture patterns. This is not acceptable for the design of opti-
mal structure, because besides topology optimization the all applied external forces, internal forces arising in ele-
shape and sizing optimization is required here, i.e. the to- ments and reactive forces at supports is ensured by statical
pology optimization procedure will be repeated several analysis with ANSYS.
times. In order to avoid meaningless solutions from en-
The structure topology may be naturally described gineering point of view, the constraints on maximum
using discrete variables, therefore here the genetic algo- stresses in trusses of the structure have to be introduced
rithms are widely used [1, 2]. However, customizing and
implementing genetic algorithm for the optimization of σ e ≤ σ max (3)
mechanical structure requires a lot of efforts of program-
mer [3]. where σ e is the stress in eth truss, and σ max is maximum
Presently researchers have at their disposal a
number of finite element packages (for example, ANSYS, allowable stress.
ALGOR), which allow obtaining all mechanical character- We start the topology optimization from “exces-
istics of the structure: nodal displacements, stresses, reac- sive-connected” truss structure, thus covering all possible
tive forces at supports, etc. The use of these standard pack- topologies of the structure. During optimization procedure
ages in optimization program would considerably reduce the superfluous elements have to be excluded. Let the
the programming costs: now only the genetic algorithm has threshold value for this be
to be implemented and connected to the finite element
package. One of the possible technologies how to link ge- σ e ≥ σ min (4)
netic algorithm with the package ANSYS in geometry op-
timization of frame structures is shown in [4]. The aim of where σ min is minimum allowable stress.
this paper is twofold: first, to show the original implemen-
The constraints (3) and (4) are merged into one
tation of genetic algorithm for topology optimization of
set
truss or frame systems, and second, to show the technology
of connection of genetic algorithm and standard finite ele-
ment package ANSYS. σ min ≤ σ e ≤ σ max (5)
In the first part of the paper we define the optimi-
zation problem and describe it in terms of genetic algo- 3. Genetic algorithm
rithms. Later on the technology, which allows integrating
the advantages of low-level programming language C++ As the genetic algorithm will be used for the
and advantages of finite element package ANSYS thus minimization of objective function, let us shortly describe
reducing the programming costs, is described. the concept of genetic algorithms suggested by Holland in
1975 [5]. The main ideas of genetic algorithms simulate
2. Problem formulation the ideas of Darwin theory: if a population of animals or
plants lives in some ecosystem, a better chances to survive
As the objective function for topology optimiza- and to leave descendants have the individuals more
tion total mass of the structure is taken adapted to the environment. The genes of individuals are
influenced by crossover and mutation, and the worst indi-
n viduals are eliminated during selection.
M = ∑ Le ρ e Ae (1) Genetic algorithms interpret “individual” as the
e =1
string of bits, representing the design parameters for objec-
35

tive function. Additionally, the individual may contain nodes and search for optimal connection of the nodes
other information, for example, on his parents. The superi- (Fig. 2).
ority of individuals is estimated by their objective values.
Schematically the genetic algorithm is shown in Node 1 Truss 1 Node 2
Fig. 1. The algorithm is illustrated by the following simple
example. Let four individuals form the initial population:
11111111 Truss 3
00000000 Truss 2 Truss 4
10101010
01010101 Truss 5
For instance, during selection for reproduction the sets of
individuals 1 - 2, and 3 - 1 are taken. Then the following Node 3 Truss 6 Node 4
results of crossover will be obtained (Table 1).
The operator of mutation reverses the value of bit. Fig. 2 Possible connections of the nodes
Thus, if the individual is 11111111 and we know the third
bit from the right side has to mutate, resulting individual The external loads and supports are given as ini-
will be 11111011. The probability of mutation is usually tial data and therefore, for the sake of simplification, will
low. Say, if we have a population consisting of 10 indi- not be considered here.
viduals of 20 bits each, and the probability of mutation is As shown in Fig. 2, six possible trusses can con-
0.01, then during mutation only the values of nect the 4 nodes. Let us assign for a possible truss code “1”
10*20*0.01=2 bits will be reversed. – if the element is presented in the structure, and “0” – if
not. Then, after numbering the trusses (Fig. 2), the fully
Start linked structure will be denoted by the following string of
bits: 111111. The structures in Fig. 3 are coded 110010
and 011001 accordingly.
Generation of initial population

Selection

Fig. 3 Examples of truss structures


Crossover
In terms of genetic algorithms, the string of bits is
the chromosome, and every its bit is a gene. The whole
Mutation truss structure is thus an individual. The essential property
of an individual is that it includes also additional informa-
tion necessary for the algorithm (Table 2); it is similar to
Obtaining the new population one suggested in [6]). The individual data is rendered in
C++ terms as the struct object (Fig. 4).

Table 2
Structure of individual data
More
Yes generations No INDIVIDUAL
needed ? Parameter Value
String of bits Coded design parameter for objective
function
End
Objective Value of objective function
Parent 1 Number of the 1st parent in previous
Fig. 1 Scheme of genetic algorithm generation
Parent 2 Number of the 2nd parent in previous
Table 1 generation
Operation of crossover Xsite Position of crossover
Stresses Stresses in each element (i.e., in gene)
Selected Position of Crossover Resulting
Individuals Crossover Individuals Struct individual
11111111 3 11111|111 11111000 {
00000000 3 00000|000 00000111 int A[lchrom]; // string of 0 and 1 (design parameter)
10101010 4 1010|1010 10101111 double B[lchrom]; // stresses in each element
11111111 4 1111|1111 11111010 double fitness; // value of merit function
int parent1;
4. Genetic algorithm for truss structures int parent2;
int xsite; // position of crossover
Here we explain our coding of truss (or frame) };
structures for genetic algorithms. Let us have 4 immovable Fig. 4 C++ structure for individual
36

All the necessary information for the algorithm ate code in APDL. APDL stands for ANSYS Parametric
(total mass of truss structure, stresses in elements) is ob- Design Language, a scripting language that can be used to
tained with finite element package ANSYS; the interface build finite element models in terms of parameters (vari-
rendering truss structure from individual data is written in ables). APDL also encompasses a wide range of other fea-
C++. The scheme below shows the connection of genetic tures such as repeating a command, macros, if-then-else
algorithm in C++ and package ANSYS trough intermedi- branching, do-loops, etc. [7].

Start

1. Tuning of algorithm parameters: sizes of popula-


tion and chromosome, probabilities of mutation and 2. Random formation of initial population
crossover, minimum and maximum allowable ele-
ment stresses

3. Creation of truss structure model for each indivi- APDL.mac


dual of population depending on individual chromo-
some (in form of APDL code) /batch
/clear
TEMP.dat /PREP7
max_stress = 0
4. Interpreting of APDL code with ANSYS. min_stress = 0
Obtaining mass of structure and stresses in elements Overall_length = …
! Nodes
K,11,0,0
Stress1 = …
K,12,200,0
Stress2 = …
...

...
5. Obtaining the value of objective function and valu- StressN = …
es of stresses for each chromosomes

6. Initial readjustment of the population: 7. Final readjustment of the population:


if there are individuals rendering stresses exceeding if the individual renders stresses less than minimum
maximum allowable stresses, they are replaced by allowable, it’s gene values are reversed: 1 -> 0
the best remaining individuals

RESULTS.dat
8. Obtaining values of objective function and stresses
for readjusted population: repeating steps 3 to 5
Number of generation 1:
11010001000110001...
01111001010111101...
...
10101111001110011...
More
Yes generations No Number of generation 2:
needed? 10010100000110001...
01111001010111100...
...
10101111011110000...

Number of generation N:
...
9. Selection of individuals. Crossover and mutation.
Creation of new population

End

Fig. 5 Genetic algorithm: interface between C++ and ANSYS


37

5. Numerical results and discussion

For the sake of transparency of expected results


the proposed technology was applied to the cantilever
structure possessing 20 immovable nodes, three of them
supported. The structure is loaded with concentrated load
at the center (Fig. 6). The optimal shape of expected dis-
crete structure is well known.

Fig. 7 The best individual of initial population

The best individual of the first generation has the


objective value 19405 mm (Fig. 8).

Fig. 6 Initial data of the structure

When the external force F = 280 kN, all trusses


have the same cross-section area A = 3200 mm2 and the
same material with Young’s modulus E = 200 GPa. Mini-
mum allowable stresses in the elements are 2 N/mm2,
while maximum ones are 40 N/mm2.
Experimentally tuning the genetic algorithm, the
following control parameters were taken: the population
size is 21 individuals, the size of each individual is 190 bits
(i.e. the number of possible connections between all nodes),
and the probability of mutation is 0.01. The individuals of
initial population are created randomly, taking values 0 and
1 with equal probability. The number of generations is 10.
The life of each generation consists of 3 stages.
In the first stage the current population is obtained from
previous generation via selection, crossover and mutation.
During the second stage the obtained individuals are ana- Fig. 8 The best individual of the first generation
lyzed and the best ones are selected for reproduction. If
there are individuals with stresses exceeding maximum During the second run of the algorithm any better
allowable stress, they are replaced by the best individual of solution is found; during the next three runs objective func-
the population. Finally, the elements with stresses below tion value diminishes to 13679, 6058 and 5387 mm respec-
the minimum allowable stress are updated: the value of tively. This best value remains through the whole 10 gen-
gene is reversed from 1 to 0. erations.
The best individual of initial population (Fig. 7) Inert character of objective function value is de-
has the chromosome termined by the following peculiarity of the algorithm:
00110010010010000101110000001000000000000100110 always the best individual of previous generation becomes
10000000001000000001000100000101000000110000000 the first individual of the next generation.
10000100000000000000110110100000000100110010000 The structures after third and fourth generations
00000000110000101101000010010010000111010010010 are depicted in Fig. 9.
01. The best individual found has the objective value
The value of objective function is 26316 mm (the of 5387 mm and chromosome
total length of all structure elements; it is proportional to 00000100001001000000000000000000000000000000000
total mass of the structure). 00000000000000000000000000000000000000000000000
00000000010000100000000000000000000000000000000
38

00000000000000010100000000000000000100000000000 Table 3
00. Only 8 genes of this chromosome have the value 1, i.e. Objective values of the best individual and all population
only 8 elements remained in the truss structure (Fig. 10).
Average objec-
Number of Objective of best tive of all gen-
population individual, mm eration, mm
0 26316 31206
1 19405 25768
2 19405 21048
3 13679 16821
4 6058 13536
5 5387 10534
6 5387 5387
7 5387 5387
8 5387 5411
9 5387 5427
10 5387 5500

35000

30000 best individual


25000 average value

objective function
20000

15000

10000

5000
Fig. 9 The best individuals of the third and fourth genera- 0
tions 0 1 2 3 4 5 6 7 8 9 10
population number

Fig. 11 Optimization history

tions yields to the objective function value 1697 mm and


the chromosome of only two nonzeroes genes (Fig. 12).
This result coincides with theoretically known global solu-
tion of topology optimization of cantilever structure.

Fig. 10 The best solution

As shown in Table 3, the best individual is found


already in 5th generation. Later on, also the average value
of objective values of all generation stabilizes: all indi- Fig. 12 The best solution with increased maximum allow-
viduals approach the best solution. All individuals become able stresses
nearly the same, therefore the crossover does not bring any
improvements. Only the mutation operation brings small 6. Concluding remarks
alterations on average objective value of the whole popula-
tion. However, the probability of mutation is 0.01: 100 Genetic algorithms may be easily adapted to the
iterations are needed to change a required gene. topology optimization of truss and frame structures. Ge-
Graphically the history of objective value altera- netic algorithm cannot assure global solution of the prob-
tion is shown in Fig. 11. lem, however, compared with other global optimizers, it
Solution of the same problem with increased yields to a reasonable solution in short time. For instance,
maximum allowable stresses (110 N/mm2) after 8 itera- for the given numerical example all the calculation of 10
39

populations on AMD Athlon 1.09 GHz processor, 1 GB įtempiai strypuose neviršytų leistinųjų ir nebūtų mažesni
RAM took 20 min, while the best solution is obtained after už tam tikrą slenkstinę vertę). Tikslo funkcijos reikšmė
12 min. (truss structure has about 1,57*1057 different pos- apskaičiuojama naudojant ANSYS paketą, o genetinis al-
sible patterns). goritmas ir programos sąsaja su vartotoju sudaryti C++
Solving the topology optimization problem with kalba. Duomenimis tarp C++ ir ANSYS programų keičia-
the proposed technology, it is necessary only to code the masi per tarpines rinkmenas. Pateikiama skaitinių pavyz-
design parameters as string of bits; no additional informa- džių.
tion on objective function (sensitivity, continuity) is re-
quired. Moreover, it greatly reduces the costs of program-
ming, as all the mechanical responses of constructed struc- D. Šešok, R. Belevičius
ture are obtained with commercially available finite ele-
ment packages. USE OF GENETIC ALGORITHMS IN TOPOLOGY
OPTIMIZATION OF TRUSS STRUCTURES
References
Summary
1. Lingyun, W., Mei, Z., Guangming, W., Guang, M. In this paper, a technology enabling to optimize
Truss optimization on shape and sizing with frequency the topology of truss or frame structures with genetic algo-
constraints based on genetic algorithm.-Comput. Mech., rithms is presented. The objective function is total mass of
2005, v.35, p.361-368. the structure elements. Constrains consist of equilibrium
2. Chaman, C., Saitou, K., Jakiela, M. Genetic algo- equations and conditions on stresses in the elements:
rithms as an approach to configuration and topology stresses cannot exceed allowable value and must be above
design.-In Advances and Design Automation, ASME, some threshold value. The values of the objective function
1993, v.65, p.485-498. are calculated with package ANSYS. Genetic algorithm
3. Smith, J., Hodgins, J., Oppenheim, I. Creating mod- with interface is implemented in C++. Exchange of data
els of truss structures with optimization.-ACM Tracsac- between ANSYS and C++ goes through temporary files.
tions on Graphics (SIGGRAPH 2002), 2002, 21(3), Numerical examples are presented.
p.295-301.
4. Puiša, R. The adaptive stochastic algorithms for CAD-
based structure optimization of mechanical parts.-Doc- Д. Шешок, Р. Белявичюс
toral dissertation, Vilnius, 2005, p.129-144.
5. Holland, J.H. Adaptation in Natural and Artificial Sys- ИСПОЛЬЗОВАНИЕ ГЕНЕТИЧЕСКИХ
tems.-Ann Arbor: The University of Michigan Press, АЛГОРИТМОВ ДЛЯ ОПТИМИЗАЦИИ ТОПОЛОГИИ
1975.-211p. СТЕРЖНЕВЫХ КОНСТРУКЦИЙ
6. Goldberg, D. Genetic algorithms in search, optimiza-
tion and machine learning.-Addison-Wesley, New- Резюме
York, 1989, p.59-70.
7. ANSYS Release 8.0 Documentation. APDL Program- В статье описана технология, позволяющая
mer’s Guide. - http://www.ansys.com/ services/ss- оптимизировать топологию стержневых конструкций
documentation-manuals.asp. (ферм), используя генетические алгоритмы. За целе-
вую функцию взята общая масса стержней фермы, а
граничные условия включают в себя требования рав-
D. Šešok, R. Belevičius новесия и ограничения напряжений (т. е. требуется,
чтобы напряжения в стержнях фермы не превышали
GENETINIŲ ALGORITMŲ TAIKYMAS допустимых и не были бы меньше определенного зна-
OPTIMIZUOJANT STRYPINIŲ SISTEMŲ чения). Значение целевой функции вычисляется с по-
TOPOLOGIJĄ мощью пакета ANSYS, а генетический алгоритм и
диалог программы с пользователем реализованы на
Reziumė языке C++. Обмен данными между C++ и ANSYS про-
граммами осуществляется посредством промежуточ-
Straipsnyje aprašyta technologija, leidžianti opti- ного файла. В статье также приведены численные при-
mizuoti strypinių sistemų (santvarų arba rėmų) topologiją меры.
taikant genetinius algoritmus. Kaip tikslo funkcija imama
visa santvaros strypų masė, o apribojimų sistemą sudaro Received January 10, 2007
pusiausvyros ir įtempių sąlygos (t. y. reikalaujama, kad

View publication stats

You might also like