기본 정보
- 저자
- DOI
- 10.1007/s00158-019-02226-6
- 저널
- Structural and Multidisciplinary Optimization
- 발행년도
- 2019
- 발행기관
- Springer Science+Business Media
- 피인용수
- 44
- 라이선스
- cc-by
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.1007/s00158-019-02226-6
- 토픽
- Composite Structure Analysis and Optimization
- OpenAlex ID
- W2922624623
평가 내용
- 관련도
- 사업분야
- 산업용 섬유 · (9) 타이어코드
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '산업용 섬유 > 타이어코드' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
본문 56,532자
본문 펼치기
섹션 본문 107문단 · 41,221자
(제목 없음)
1Numerical layout optimization employing an adaptive 'member adding' solution scheme provides a computationally efficient means of generating (near-)optimum trusses for problems involving single or multiple load cases. To encourage usage of the method, a Python script is presented, allowing medium to large-scale problems to be solved efficiently. As well as handling multiple load cases, the short (98 line) script presented can tackle truss optimization problems involving unequal limiting tensile and compressive stresses, joint costs, and non-convex polygonal domains, with or without holes.Various numerical examples are used to demonstrate the efficacy of the script presented.
Introduction
2Truss layout optimization using the 'ground structure' approach provides a fully automated means of identifying (near-)optimum truss structures. Although first proposed in the 1960s by Dorn et al. (1964), it has not been widely used in practice for various reasons. For example, the solutions generated can appear impractical, at least when conventional manufacturing techniques are envisaged. However, in recent decades new manufacturing techniques have been developing apace, e.g. additive manufacturing, and means of rationalizing the solutions obtained via layout optimization have also been developed (e.g. He and Gilbert 2015). Also, in 2003, an adaptive 'member adding' scheme was proposed by Gilbert and Tyas (2003), which allowed solutions to be obtained more quickly, and also for extremely large problems (e.g. >1,000,000,000 members) to be solved. This means that layout optimization can be used to obtain highly accurate benchmark solutions that can be used to validate analytical solutions (e.g. Sokół 2011b; Sokół and Rozvany 2012), and also to discover new optimum structural forms (e.g. Darwich et al. 2010;Tyas et al. 2011;Fairclough et al. 2018). To increase the practical applicability of solutions, Pritchard et al. (2005) extended the adaptive 'member adding' scheme to solve problems involving multiple load cases whilst Tyas et al. (2006) incorporated structural stability considerations. Also, Smith et al. (2016) utilized layout optimization to design truss-like metallic components suitable for fabrication via additive manufacturing, with the techniques involved recently extended by He et al. (2018). In parallel, the layout optimization technique has been successfully transferred to other applications. For example, Bolbotowski et al. (2018) utilized layout optimization to design (near-)optimum grillages and Smith and Gilbert (2007) and Gilbert et al. (2014) proposed the 'discontinuity layout optimization' (DLO) method to identify critical patterns of discontinuities at collapse for in-plane and out-of-plane plasticity problems.
3However, although interest in numerical layout optimization has grown in recent years, the power of the method still appears under-appreciated in the structural optimization research community. One possible reason for this is that accessible educational resources for use by new researchers have been lacking. Although a script was made available by Sokół (2011a), the Mathematica language employed is not commonly used in the community. Matlab scripts developed by Zegard and Paulino (2014) and Zegard and Paulino (2015) helped in this respect, although these contain relatively complex functions that could potentially reduce uptake. Also, most significantly, although proposed in 2003, the 'member adding' scheme has not yet been incorporated in any of the aforementioned publicly available scripts, potentially leading researchers to underestimate the potential computational efficiency of the layout optimization method. In contrast, the 99-line Matlab script for SIMP (Sigmund 2001) helped pave the way for worldwide research in the field of continuum topology optimization. As an indication of the dominance of SIMP over numerical layout optimization in terms of published educational source codes, only one of the 22 scripts listed by Wei et al. (2018) employ the latter.
4In order to provide an accessible yet computationally efficient educational implementation of numerical layout optimization, this paper introduces a simple Python script. With 98 lines, it incorporates the efficient adaptive 'member adding' scheme for 2D problems subject to multiple load cases, with the potential for unequal limiting tensile and compressive stresses, joint costs, and non-convex polygonal domains (with or without holes). The paper is organized as follows: first, the mathematical layout optimization formulation is introduced; second, important code sections are explained; third, numerical examples are shown to demonstrate the efficacy of the script; finally, conclusions are drawn.
Single-load case problem
5The standard layout optimization process (Dorn et al. 1964;Gilbert and Tyas 2003;Pritchard et al. 2005) involves a number of steps, as shown in Fig. 1. Firstly the design domain, load and support conditions are specified, Fig. 1a; secondly, the design domain is discretized using nodes, Fig. 1 Steps in layout optimization: a specify design domain, loads and supports; b discretize domain using nodes; c interconnect nodes with potential truss members; d use optimization to identify the optimal structural layout (a) (b) (c) (d) Fig. 1b; thirdly, these nodes are interconnected with potential members to create a 'ground structure', Fig. 1c; finally, an optimum layout is identified by solving the optimization problem below (Fig. 1d):
6where, V is the structural volume, a = [a 1 , a 2 , ..., a m ] T is a vector containing member cross-sectional areas, with m denoting the number of members. l = [l 1 , l 2 , ..., l m ] T is a vector of member lengths. B is a 2n × m equilibrium matrix comprising direction cosines, with n denoting the number of nodes and q is vector containing the internal member forces; a simple example of the equilibrium constraint is presented in Fig. 2. f is a vector containing the external forces; σ + and σ − are limiting tensile and compressive stresses respectively.
Multiple load case problem
7Problem (1) can easily be extended to obtain solutions for multiple load case plastic design problems. In this case the equilibrium constraint (1b), stress limits (1c) and (1d) must be satisfied in each load case, e.g. the former gives:
8Bq k = f k , for k = 1, 2, ..., p,
9where, k is the load case identifier and p represents the total number of load cases.
Joint costs
10It was found in previous studies (e.g. Gilbert and Tyas 2003;Pritchard et al. 2005) that layout optimization will often generate structures that are complex in form, containing large numbers of short members. A simple means of addressing this is to include a notional joint cost (Parkes 1978), which has the effect of penalizing short members and hence simplifying the solution in many cases:l = [l 1 + s, l 2 +s, ..., l m +s] T in the objective function (1a), wherel is the augmented member length vector with predefined joint cost (or length) s.
Full problem
11Considering multiple load cases and joint costs, the full problem can now be written as:
12which is, like (1), a linear programming (LP) problem that can be solved efficiently using modern optimization solvers. However, when using the ground structure approach the number of potential numbers grows rapidly with the number of nodes employed, with up to n(n−1) 2 members required. This can lead to extremely large optimization problems that are computationally expensive to solve. To address this, a 'member adding' scheme, which is based on the 'column generation' approach (Dantzig and Wolfe 1960) was proposed by Gilbert and Tyas (2003). This allows problem (3) to be decomposed into a number of smaller subproblems, with information from the dual problem used to guide the process.
Adaptive 'member adding' scheme
13Using the adaptive 'member adding' scheme (Gilbert and Tyas 2003;Pritchard et al. 2005), initially only a reduced set of members are used to solve problem (3), and remaining potential members in the 'ground structure' are gradually added to the set, until the following constraint is satisfied for all potential members (readers who are interested in derivation of Eq. 4 can refer to Appendix A):
14where i is the summed maximum virtual strain of member i in all load cases; u k i is a vector containing virtual displacement of nodes connected by member i, under load case k. Note that, when a primal-dual interior point method is used to solve problem (3), u k i is obtained automatically with no extra cost. Although only a reduced set of members are used in Eq. 3, a full virtual displacement field u k of all nodes can still be generated. If any violation of Eq. 4 is found in the virtual displacement field, the most violated potential members can be added to the reduced set of members. Then (3) can be solved again, this time generating an improved virtual displacement field in which (4) is no longer violated for the newly added members. This adaptive 'member adding' process continues until no violation is detected; according to duality theory, the solution obtained will then be equivalent to that obtained by solving the full problem from the outset. The entire process is shown in Fig. 3.
Python implementation
15Python is an open-source interpreted high-level programming language that is becoming increasingly popular for solving scientific and engineering problems. Unlike Matlab, where built-in toolboxes are automatically loaded when started, in Python such tools are imported using the keyword at the beginning of the script. These extra lines allow dependencies on external tools to be clearly seen.
16In this paper, a number of freely available tools are used, including mathematical tools such as scipy and numpy, the convex optimization tool cvxpy (Diamond and Boyd 2016;Agrawal et al. 2018), and the geometry tool shapely.
17In this section the various functions used to construct and solve the layout optimization problem (3) are first Fig. 3 Flowchart of the adaptive 'member adding' process introduced; then the main workflow is outlined. As Python is, like Matlab, an interpreted language, loop structures are generally inefficient. Therefore, to improve execution speed, vectorized operations are utilized in place of loop structures wherever possible.
Equilibrium matrix B
18For a member i, interconnecting nodes I and I I , its contribution to equilibrium matrix B can be written as:
19where, X i = x I I i − x I i and Y i = y I I i − y I i are the projected length of the member of length l i in the x and y axis directions respectively, and where [x I i , y I i ] and [x I I i , y I I i ] are the co-ordinates of nodes I and I I respectively. If a connected node is supported, then the coefficients of the corresponding row are set to zero (i.e. supported degrees of freedom are removed). Thus, taking into account boundary conditions, the above formulation can be expressed as:
20where d 0 , d 1 , d 2 , d 3 are 0-1 coefficients describing the degree of freedom in the x and y directions for the connected nodes The equilibrium matrix B is then assembled using the B i matrices for all members. B is a sparse matrix, which can be expressed using a row-column-value format comprising only non-zero entries, constructed by concatenating the coefficients calculated in Eq. 6 as well as their corresponding row (degree of freedom at nodes) and column (member) numbers.
Solving the LP problem
21In the script, problem (3) is solved in function solveLP.
22In Python, the use of object oriented programming (OOP) allows problem (3) to be written in a format that is very similar to its natural expression, improving readability. For example, using the optimization tool cvxpy, the stress constraints in Eq. 3b are expressed as q[k] >= -sc * a and q[k] <= st * a.
Check dual violation
23When the primal problem (3) is solved via the primal-dual interior point method, the virtual displacements in u for each load case are obtained from the equilibrium constraints defined in eqn. Therefore, violation of constraint (4) Fig. 4 Cantilever example: problem definition can be calculated for every member in the full 'ground structure' (except for those already present in the reduced set, where this is unnecessary as there will be no violation). All potential members are then sorted by their constraint violation numbers, and the most violating ones are added to the primal problem, with the number of new members calculated using:
24m P and m V are, respectively, the numbers of remaining members in the potential member list (i.e. members not yet included in Eq. 3), and those violating (4). α and β are control parameters, both set to 0.05 in this paper. Using the adaptive 'member adding' scheme, the size of problem (3) gradually increases, with Eq. 7 used to control the growth rate. When number of violations is large, only a small proportion are added into (3); on the other hand, when the number of violations is small, most (or all) are added in a given iteration. This balances problem size with the number of iterations required in order to achieve an efficient iterative process. Various alternative heuristics can be used to determine the priority and number of members to be added at each iteration, e.g. the two-stage high-pass filter in Gilbert and Tyas (2003) and the active member set method described in Sokół (2014). It is important to note that, although a heuristic algorithm is used here to improve computational efficiency, the final solution, obtained when (4) is satisfied for all members in the ground structure, is equivalent to the solution obtained by solving the full problem, due to the strong duality nature of LP problems (Vanderbei 2001).
Visualization
25The solutions are visualized in function plotTrusses. Members with areas greater than a threshold number (e.g. 1 × 10 −3 of the maximum member area) are plotted in red or blue, depending on the sign of their internal forces. When the signs of internal forces vary in different load cases, grey is used instead.
Main workflow
26The main trussopt function contains several steps to define the design domain, load, and support conditions for any given layout optimization problem, to create the 'ground structure', and to solve the LP problem (3c) using the adaptive 'member adding' scheme.
27-Firstly, a polygonal design domain is specified using the Polygon function imported from shapely, and then its convexity checked. (c) (d) -Secondly, a uniformly distributed grid of nodes is created using the meshgrid function, with points lying inside the design domain added to node list Nd; then support and load conditions are added. -Thirdly, the 'ground structure' is created by generating all valid potential members, excluding overlapping lines (checked using the greatest common divider, function gcd, when joint costs are not specified), and lines crossing the polygonal boundary (using function contains from shapely). -Finally, the initial reduced set of members is created by including only short member connections. The adaptive 'member adding' process then starts, in which potential members are added to this reduced set until no violation of Eq. 4 is found in any member in the 'ground structure'.
Numerical examples
28A number of examples serve to demonstrate the efficacy of the script. Firstly, a simple cantilever problem (Fig. 4) can be solved by running the following command in a terminal: Alternatively, the script can be imported as a module in Python using:
29And then function trussopt can be called to perform a layout optimization with the following input arguments: which solves the simple cantilever problem shown in Fig. 4 with width = 20, height = 10, limiting stress in tension = 1, in compression = 1 and joint cost = 0. In this section, all line numbers refer to the script in Appendix C, and all quoted CPU times were obtained using a laptop PC equipped with an Intel I7-7700HQ CPU and running 64-bit Windows 10.
Effect of using the adaptive 'member adding' scheme
30Using the adaptive 'member adding' scheme, a large-scale layout optimization problem is solved as a series of much smaller LP problems solved in succession; e.g. Fig. 5 shows steps in the solution of the cantilever design problem shown in Fig. 4.
31When solving medium or large-scale problems, the adaptive 'member adding' scheme reduces memory consumption and can result in significant speed improvements, as indicated in Table 1. Whilst the resulting structural volumes are identical (to five significant figures), the latter becomes increasingly efficient with increasing problem size, e.g. 8.2 times faster when 60 × 30 nodal divisions are used. Note that 'member adding' can be switched off by increasing the maximum initial member connection distance in line 85, for example changing this to:
32for the purposes of this paper.
Alternative LP solvers
33By default, the LP problem (3c) is solved using the opensource solver ECOS (Domahidi et al. 2013) distributed with cvxpy. Alternatively, a range of other, potentially more efficient, LP solvers such as GUROBI and MOSEK can be used with cvxpy. To use MOSEK, for example, line 29 is replaced with the following (note that this requires MOSEK has already been added to Python environment; if not, guidance can be found in Appendix B):
34The MOSEK parameter "MSK IPAR INTPNT BASIS" is optional; however this disables the unnecessary basis identification step to improve speed. Using MOSEK, the CPU cost required to solve problems is significantly reduced, making the layout optimization process very efficient. Table 2 shows sample solutions for the cantilever
Joint cost
35To approximately account for the costs associated with joints, a joint cost can be directly specified when calling the main function trussopt. For example, a joint cost of s = 1 unit length can be added using the following command; the simpler solution then generated is shown on Fig. 6.
Unequal stress limits
36Unequal stress limits can also be directly specified. For example, a compressive stress limit can be set to σ − = 0.1σ 0 with the following input arguments:
37Alternatively, a different tensile stress limit can be set if desired. The corresponding results are shown in Fig. 7.
Change load and support conditions
38Load and support conditions can be changed by modifying lines 73 and 74. For example, to generate the 'half wheel' example shown in Fig. 8, the pin and roller supports can be applied by replacing line 73 with:
39which locates the two corner nodes at the base of the domain and then sets the appropriate degrees of freedom. Similarly, the point load can be applied by replacing the original line 74 with:
Multiple load cases
40Additional load cases can be included by appending load vector f after line 74. For the two load case cantilever example problem shown in Fig. 9, load case Q is added using the following lines:
41And the point load P is moved to the bottom-right corner by replacing the original line 74 with:
42Initially all load cases are concatenated in vector f, which is then reformatted to a p × 2n array in line 83.
Non-convex domain
43Various polygonal domains can be specified using shapely. For example, to add a hole to the design domain, as shown in Fig. 10, the following lines can be added after line 65: This subtracts a rectangular region from the original design domain in Fig. 4. Note that, when a non-convex domain is used, lines that intersect domain boundary should be excluded from the 'ground structure'. Line 80 checks such intersections using the contains function from shapely. Since this can become computationally expensive when the number of potential connections is large, it is skipped when a convex domain is used.
Conclusions
44A simple Python implementation of truss layout optimization using an adaptive 'member adding' scheme has been presented for educational use. Various examples are used to demonstrate the efficacy of the script for problems involving single and multiple load cases, unequal limiting stresses in tension and compression, joint costs, and non-convex polygonal domains, with or without holes. The solutions obtained are globally optimal for the prescribed nodal discretization and can be used to benchmark other methods or to provide inspiration for structural designers.
45The 98-line Python script described is listed for reference in Appendix B and is also provided in the form of downloadable source code; see Supplementary material section.
46Supplementary material Downloadable Python script, trussopt.py, and installation files: https://doi.org/10.15131/shef.data.7271678.
B.2 Installation with Python 2
47It is possible to run the script with Python 2 (2.6 and later) by making minor modifications to the script, as detailed below.
48First, remove the gcd method from math in the first line:
49And instead import it from fractions instead, by adding the following new line:
50Also, line 47 is replaced with:
51to take into account the fact that function ceil returns a floating point rather than integer value in Python 2.
B.3 Alternative solvers
52To use an alternative solver, as described in Section 4.2, this also needs be installed. For example, MOSEK can be installed using the following command:
53In addition, a licence file is required, which can be freely obtained for academic use from the MOSEK website (https://www.mosek.com).
B.4 Python IDE
54For beginners, the Spyder IDE (Integrated Development Environment) bundled with the Anaconda package provides an easy-to-use means of editing and running the script.
Introduction
55Truss layout optimization using the 'ground structure' approach provides a fully automated means of identifying (near-)optimum truss structures. Although first proposed in the 1960s by Dorn et al. (1964), it has not been widely used in practice for various reasons. For example, the solutions generated can appear impractical, at least when conventional manufacturing techniques are envisaged. However, in recent decades new manufacturing techniques have been developing apace, e.g. additive manufacturing, and means of rationalizing the solutions obtained via layout optimization have also been developed (e.g. He and Gilbert 2015). Also, in 2003, an adaptive 'member adding' scheme was proposed by Gilbert and Tyas (2003), which allowed solutions to be obtained more quickly, and also for extremely large problems (e.g. >1,000,000,000 members) to be solved. This means that layout optimization can be used to obtain highly accurate benchmark solutions that can be used to validate analytical solutions (e.g. Sokół 2011b; Sokół and Rozvany 2012), and also to discover new optimum structural forms (e.g. Darwich et al. 2010;Tyas et al. 2011;Fairclough et al. 2018). To increase the practical applicability of solutions, Pritchard et al. (2005) extended the adaptive 'member adding' scheme to solve problems involving multiple load cases whilst Tyas et al. (2006) incorporated structural stability considerations. Also, Smith et al. (2016) utilized layout optimization to design truss-like metallic components suitable for fabrication via additive manufacturing, with the techniques involved recently extended by He et al. (2018). In parallel, the layout optimization technique has been successfully transferred to other applications. For example, Bolbotowski et al. (2018) utilized layout optimization to design (near-)optimum grillages and Smith and Gilbert (2007) and Gilbert et al. (2014) proposed the 'discontinuity layout optimization' (DLO) method to identify critical patterns of discontinuities at collapse for in-plane and out-of-plane plasticity problems.
56However, although interest in numerical layout optimization has grown in recent years, the power of the method still appears under-appreciated in the structural optimization research community. One possible reason for this is that accessible educational resources for use by new researchers have been lacking. Although a script was made available by Sokół (2011a), the Mathematica language employed is not commonly used in the community. Matlab scripts developed by Zegard and Paulino (2014) and Zegard and Paulino (2015) helped in this respect, although these contain relatively complex functions that could potentially reduce uptake. Also, most significantly, although proposed in 2003, the 'member adding' scheme has not yet been incorporated in any of the aforementioned publicly available scripts, potentially leading researchers to underestimate the potential computational efficiency of the layout optimization method. In contrast, the 99-line Matlab script for SIMP (Sigmund 2001) helped pave the way for worldwide research in the field of continuum topology optimization. As an indication of the dominance of SIMP over numerical layout optimization in terms of published educational source codes, only one of the 22 scripts listed by Wei et al. (2018) employ the latter.
57In order to provide an accessible yet computationally efficient educational implementation of numerical layout optimization, this paper introduces a simple Python script. With 98 lines, it incorporates the efficient adaptive 'member adding' scheme for 2D problems subject to multiple load cases, with the potential for unequal limiting tensile and compressive stresses, joint costs, and non-convex polygonal domains (with or without holes). The paper is organized as follows: first, the mathematical layout optimization formulation is introduced; second, important code sections are explained; third, numerical examples are shown to demonstrate the efficacy of the script; finally, conclusions are drawn.
Single-load case problem
58The standard layout optimization process (Dorn et al. 1964;Gilbert and Tyas 2003;Pritchard et al. 2005) involves a number of steps, as shown in Fig. 1. Firstly the design domain, load and support conditions are specified, Fig. 1a; secondly, the design domain is discretized using nodes, Fig. 1 Steps in layout optimization: a specify design domain, loads and supports; b discretize domain using nodes; c interconnect nodes with potential truss members; d use optimization to identify the optimal structural layout (a) (b) (c) (d) Fig. 1b; thirdly, these nodes are interconnected with potential members to create a 'ground structure', Fig. 1c; finally, an optimum layout is identified by solving the optimization problem below (Fig. 1d):
59where, V is the structural volume, a = [a 1 , a 2 , ..., a m ] T is a vector containing member cross-sectional areas, with m denoting the number of members. l = [l 1 , l 2 , ..., l m ] T is a vector of member lengths. B is a 2n × m equilibrium matrix comprising direction cosines, with n denoting the number of nodes and q is vector containing the internal member forces; a simple example of the equilibrium constraint is presented in Fig. 2. f is a vector containing the external forces; σ + and σ − are limiting tensile and compressive stresses respectively.
Multiple load case problem
60Problem (1) can easily be extended to obtain solutions for multiple load case plastic design problems. In this case the equilibrium constraint (1b), stress limits (1c) and (1d) must be satisfied in each load case, e.g. the former gives:
61Bq k = f k , for k = 1, 2, ..., p,
62where, k is the load case identifier and p represents the total number of load cases.
Joint costs
63It was found in previous studies (e.g. Gilbert and Tyas 2003;Pritchard et al. 2005) that layout optimization will often generate structures that are complex in form, containing large numbers of short members. A simple means of addressing this is to include a notional joint cost (Parkes 1978), which has the effect of penalizing short members and hence simplifying the solution in many cases:l = [l 1 + s, l 2 +s, ..., l m +s] T in the objective function (1a), wherel is the augmented member length vector with predefined joint cost (or length) s.
Full problem
64Considering multiple load cases and joint costs, the full problem can now be written as:
65which is, like (1), a linear programming (LP) problem that can be solved efficiently using modern optimization solvers. However, when using the ground structure approach the number of potential numbers grows rapidly with the number of nodes employed, with up to n(n−1) 2 members required. This can lead to extremely large optimization problems that are computationally expensive to solve. To address this, a 'member adding' scheme, which is based on the 'column generation' approach (Dantzig and Wolfe 1960) was proposed by Gilbert and Tyas (2003). This allows problem (3) to be decomposed into a number of smaller subproblems, with information from the dual problem used to guide the process.
Adaptive 'member adding' scheme
66Using the adaptive 'member adding' scheme (Gilbert and Tyas 2003;Pritchard et al. 2005), initially only a reduced set of members are used to solve problem (3), and remaining potential members in the 'ground structure' are gradually added to the set, until the following constraint is satisfied for all potential members (readers who are interested in derivation of Eq. 4 can refer to Appendix A):
67where i is the summed maximum virtual strain of member i in all load cases; u k i is a vector containing virtual displacement of nodes connected by member i, under load case k. Note that, when a primal-dual interior point method is used to solve problem (3), u k i is obtained automatically with no extra cost. Although only a reduced set of members are used in Eq. 3, a full virtual displacement field u k of all nodes can still be generated. If any violation of Eq. 4 is found in the virtual displacement field, the most violated potential members can be added to the reduced set of members. Then (3) can be solved again, this time generating an improved virtual displacement field in which (4) is no longer violated for the newly added members. This adaptive 'member adding' process continues until no violation is detected; according to duality theory, the solution obtained will then be equivalent to that obtained by solving the full problem from the outset. The entire process is shown in Fig. 3.
Python implementation
68Python is an open-source interpreted high-level programming language that is becoming increasingly popular for solving scientific and engineering problems. Unlike Matlab, where built-in toolboxes are automatically loaded when started, in Python such tools are imported using the keyword at the beginning of the script. These extra lines allow dependencies on external tools to be clearly seen.
69In this paper, a number of freely available tools are used, including mathematical tools such as scipy and numpy, the convex optimization tool cvxpy (Diamond and Boyd 2016;Agrawal et al. 2018), and the geometry tool shapely.
70In this section the various functions used to construct and solve the layout optimization problem (3) are first Fig. 3 Flowchart of the adaptive 'member adding' process introduced; then the main workflow is outlined. As Python is, like Matlab, an interpreted language, loop structures are generally inefficient. Therefore, to improve execution speed, vectorized operations are utilized in place of loop structures wherever possible.
Equilibrium matrix B
71For a member i, interconnecting nodes I and I I , its contribution to equilibrium matrix B can be written as:
72where, X i = x I I i − x I i and Y i = y I I i − y I i are the projected length of the member of length l i in the x and y axis directions respectively, and where [x I i , y I i ] and [x I I i , y I I i ] are the co-ordinates of nodes I and I I respectively. If a connected node is supported, then the coefficients of the corresponding row are set to zero (i.e. supported degrees of freedom are removed). Thus, taking into account boundary conditions, the above formulation can be expressed as:
73where d 0 , d 1 , d 2 , d 3 are 0-1 coefficients describing the degree of freedom in the x and y directions for the connected nodes The equilibrium matrix B is then assembled using the B i matrices for all members. B is a sparse matrix, which can be expressed using a row-column-value format comprising only non-zero entries, constructed by concatenating the coefficients calculated in Eq. 6 as well as their corresponding row (degree of freedom at nodes) and column (member) numbers.
Solving the LP problem
74In the script, problem (3) is solved in function solveLP.
75In Python, the use of object oriented programming (OOP) allows problem (3) to be written in a format that is very similar to its natural expression, improving readability. For example, using the optimization tool cvxpy, the stress constraints in Eq. 3b are expressed as q[k] >= -sc * a and q[k] <= st * a.
Check dual violation
76When the primal problem (3) is solved via the primal-dual interior point method, the virtual displacements in u for each load case are obtained from the equilibrium constraints defined in eqn. Therefore, violation of constraint (4) Fig. 4 Cantilever example: problem definition can be calculated for every member in the full 'ground structure' (except for those already present in the reduced set, where this is unnecessary as there will be no violation). All potential members are then sorted by their constraint violation numbers, and the most violating ones are added to the primal problem, with the number of new members calculated using:
77m P and m V are, respectively, the numbers of remaining members in the potential member list (i.e. members not yet included in Eq. 3), and those violating (4). α and β are control parameters, both set to 0.05 in this paper. Using the adaptive 'member adding' scheme, the size of problem (3) gradually increases, with Eq. 7 used to control the growth rate. When number of violations is large, only a small proportion are added into (3); on the other hand, when the number of violations is small, most (or all) are added in a given iteration. This balances problem size with the number of iterations required in order to achieve an efficient iterative process. Various alternative heuristics can be used to determine the priority and number of members to be added at each iteration, e.g. the two-stage high-pass filter in Gilbert and Tyas (2003) and the active member set method described in Sokół (2014). It is important to note that, although a heuristic algorithm is used here to improve computational efficiency, the final solution, obtained when (4) is satisfied for all members in the ground structure, is equivalent to the solution obtained by solving the full problem, due to the strong duality nature of LP problems (Vanderbei 2001).
Visualization
78The solutions are visualized in function plotTrusses. Members with areas greater than a threshold number (e.g. 1 × 10 −3 of the maximum member area) are plotted in red or blue, depending on the sign of their internal forces. When the signs of internal forces vary in different load cases, grey is used instead.
Main workflow
79The main trussopt function contains several steps to define the design domain, load, and support conditions for any given layout optimization problem, to create the 'ground structure', and to solve the LP problem (3c) using the adaptive 'member adding' scheme.
80-Firstly, a polygonal design domain is specified using the Polygon function imported from shapely, and then its convexity checked. (c) (d) -Secondly, a uniformly distributed grid of nodes is created using the meshgrid function, with points lying inside the design domain added to node list Nd; then support and load conditions are added. -Thirdly, the 'ground structure' is created by generating all valid potential members, excluding overlapping lines (checked using the greatest common divider, function gcd, when joint costs are not specified), and lines crossing the polygonal boundary (using function contains from shapely). -Finally, the initial reduced set of members is created by including only short member connections. The adaptive 'member adding' process then starts, in which potential members are added to this reduced set until no violation of Eq. 4 is found in any member in the 'ground structure'.
Numerical examples
81A number of examples serve to demonstrate the efficacy of the script. Firstly, a simple cantilever problem (Fig. 4) can be solved by running the following command in a terminal: Alternatively, the script can be imported as a module in Python using:
82And then function trussopt can be called to perform a layout optimization with the following input arguments: which solves the simple cantilever problem shown in Fig. 4 with width = 20, height = 10, limiting stress in tension = 1, in compression = 1 and joint cost = 0. In this section, all line numbers refer to the script in Appendix C, and all quoted CPU times were obtained using a laptop PC equipped with an Intel I7-7700HQ CPU and running 64-bit Windows 10.
Effect of using the adaptive 'member adding' scheme
83Using the adaptive 'member adding' scheme, a large-scale layout optimization problem is solved as a series of much smaller LP problems solved in succession; e.g. Fig. 5 shows steps in the solution of the cantilever design problem shown in Fig. 4.
84When solving medium or large-scale problems, the adaptive 'member adding' scheme reduces memory consumption and can result in significant speed improvements, as indicated in Table 1. Whilst the resulting structural volumes are identical (to five significant figures), the latter becomes increasingly efficient with increasing problem size, e.g. 8.2 times faster when 60 × 30 nodal divisions are used. Note that 'member adding' can be switched off by increasing the maximum initial member connection distance in line 85, for example changing this to:
85for the purposes of this paper.
Alternative LP solvers
86By default, the LP problem (3c) is solved using the opensource solver ECOS (Domahidi et al. 2013) distributed with cvxpy. Alternatively, a range of other, potentially more efficient, LP solvers such as GUROBI and MOSEK can be used with cvxpy. To use MOSEK, for example, line 29 is replaced with the following (note that this requires MOSEK has already been added to Python environment; if not, guidance can be found in Appendix B):
87The MOSEK parameter "MSK IPAR INTPNT BASIS" is optional; however this disables the unnecessary basis identification step to improve speed. Using MOSEK, the CPU cost required to solve problems is significantly reduced, making the layout optimization process very efficient. Table 2 shows sample solutions for the cantilever
Joint cost
88To approximately account for the costs associated with joints, a joint cost can be directly specified when calling the main function trussopt. For example, a joint cost of s = 1 unit length can be added using the following command; the simpler solution then generated is shown on Fig. 6.
Unequal stress limits
89Unequal stress limits can also be directly specified. For example, a compressive stress limit can be set to σ − = 0.1σ 0 with the following input arguments:
90Alternatively, a different tensile stress limit can be set if desired. The corresponding results are shown in Fig. 7.
Change load and support conditions
91Load and support conditions can be changed by modifying lines 73 and 74. For example, to generate the 'half wheel' example shown in Fig. 8, the pin and roller supports can be applied by replacing line 73 with:
92which locates the two corner nodes at the base of the domain and then sets the appropriate degrees of freedom. Similarly, the point load can be applied by replacing the original line 74 with:
Multiple load cases
93Additional load cases can be included by appending load vector f after line 74. For the two load case cantilever example problem shown in Fig. 9, load case Q is added using the following lines:
94And the point load P is moved to the bottom-right corner by replacing the original line 74 with:
95Initially all load cases are concatenated in vector f, which is then reformatted to a p × 2n array in line 83.
Non-convex domain
96Various polygonal domains can be specified using shapely. For example, to add a hole to the design domain, as shown in Fig. 10, the following lines can be added after line 65: This subtracts a rectangular region from the original design domain in Fig. 4. Note that, when a non-convex domain is used, lines that intersect domain boundary should be excluded from the 'ground structure'. Line 80 checks such intersections using the contains function from shapely. Since this can become computationally expensive when the number of potential connections is large, it is skipped when a convex domain is used.
Conclusions
97A simple Python implementation of truss layout optimization using an adaptive 'member adding' scheme has been presented for educational use. Various examples are used to demonstrate the efficacy of the script for problems involving single and multiple load cases, unequal limiting stresses in tension and compression, joint costs, and non-convex polygonal domains, with or without holes. The solutions obtained are globally optimal for the prescribed nodal discretization and can be used to benchmark other methods or to provide inspiration for structural designers.
98The 98-line Python script described is listed for reference in Appendix B and is also provided in the form of downloadable source code; see Supplementary material section.
99Supplementary material Downloadable Python script, trussopt.py, and installation files: https://doi.org/10.15131/shef.data.7271678.
B.2 Installation with Python 2
100It is possible to run the script with Python 2 (2.6 and later) by making minor modifications to the script, as detailed below.
101First, remove the gcd method from math in the first line:
102And instead import it from fractions instead, by adding the following new line:
103Also, line 47 is replaced with:
104to take into account the fact that function ceil returns a floating point rather than integer value in Python 2.
B.3 Alternative solvers
105To use an alternative solver, as described in Section 4.2, this also needs be installed. For example, MOSEK can be installed using the following command:
106In addition, a licence file is required, which can be freely obtained for academic use from the MOSEK website (https://www.mosek.com).
B.4 Python IDE
107For beginners, the Spyder IDE (Integrated Development Environment) bundled with the Anaconda package provides an easy-to-use means of editing and running the script.
참고문헌 30건
- Domain-Adversarial Training of Neural Networks Advances in computer vision and pattern recognition · Springer International Publishing · 2017 10.1007/978-3-319-58347-1_10
- Layout optimization of large‐scale pin‐jointed frames Engineering Computations · Emerald Publishing Limited · 2003 10.1108/02644400310503017
- GRAND — Ground structure based topology optimization for arbitrary 2D domains using MATLAB Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2014 10.1007/s00158-014-1085-z
- Linear Programming: Foundations and Extensions Journal of the Operational Research Society · Palgrave Macmillan · 1998 10.1038/sj.jors.2600987
- A 99 line code for discretized Michell truss optimization written in Mathematica Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2010 10.1007/s00158-010-0557-z
- New analytical benchmarks for topology optimization and their implications. Part I: bi-symmetric trusses with two point loads between supports Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2012 10.1007/s00158-012-0786-4
- Application of discontinuity layout optimization to plane plasticity problems Proceedings of the Royal Society A Mathematical Physical and Engineering Sciences · Royal Society · 2007 10.1098/rspa.2006.1788
- Practical plastic layout optimization of trusses incorporating stability considerations Computers & Structures · Elsevier BV · 2005 10.1016/j.compstruc.2005.09.032
- Joints in optimum frameworks International Journal of Solids and Structures · Elsevier BV · 1975 10.1016/0020-7683(75)90044-x
- Optimum structure to carry a uniform load between pinned supports Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2010 10.1007/s00158-009-0467-0
- Decomposition Principle for Linear Programs Operations Research · Institute for Operations Research and the Management Sciences · 1960 10.1287/opre.8.1.101
- Automatic yield-line analysis of slabs using discontinuity layout optimization Proceedings of the Royal Society A Mathematical Physical and Engineering Sciences · Royal Society · 2014 10.1098/rspa.2014.0071
- ECOS: An SOCP solver for embedded systems 2022 European Control Conference (ECC) · 2013 10.23919/ecc.2013.6669541
- A 99 line topology optimization code written in Matlab Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2001 10.1007/s001580050176
- Optimum structure to carry a uniform load between pinned supports: exact analytical solution Proceedings of the Royal Society A Mathematical Physical and Engineering Sciences · Royal Society · 2010 10.1098/rspa.2010.0376
- Michell cantilevers constructed within a half strip. Tabulation of selected benchmark results Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2010 10.1007/s00158-010-0525-7
- Rationalization of trusses generated via layout optimization Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2015 10.1007/s00158-015-1260-x
- Topology optimization of large-scale trusses using ground structure approach with selective subsets of active bars 2011
- Convex Optimization Cambridge University Press eBooks · Cambridge University Press · 2004 10.1017/cbo9780511804441
- Application of layout optimization to the design of additively manufactured metallic components Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2016 10.1007/s00158-016-1426-1
- Design of optimum grillages using layout optimization Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2018 10.1007/s00158-018-1930-6
- An 88-line MATLAB code for the parameterized level set method based topology optimization using radial basis functions Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2018 10.1007/s00158-018-1904-8
- Conceptual design of AM components using layout and geometry optimization Computers & Mathematics with Applications · Elsevier BV · 2018 10.1016/j.camwa.2018.07.012
- Theoretically optimal forms for very long-span bridges under gravity loading Proceedings of the Royal Society A Mathematical Physical and Engineering Sciences · Royal Society · 2018 10.1098/rspa.2017.0726
- CVXPY: A Python-Embedded Modeling Language for Convex Optimization arXiv (Cornell University) · Cornell University · 2016
- A rewriting system for convex optimization problems Journal of Control and Decision · Taylor & Francis · 2018 10.1080/23307706.2017.1397554
- AUTOMATIC DESIGN OF OPTIMAL STRUCTURES 1964
- Damage and contact mechanics CRC Press eBooks · Informa · 2014 10.1201/b16513-4
- GRAND3 — Ground structure based topology optimization for arbitrary 3D domains using MATLAB Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2015 10.1007/s00158-015-1284-2
- Convex Optimization 2004 10.1017/cbo9780511804441