Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Engineering Design Optimization. Cambridge University Press, Jan 2022

Appendix: Test Problems

D.1 Unconstrained Problems

D.1.1 Slanted Quadratic Function

Slanted quadratic function for \beta=3/2.

Figure D.1:Slanted quadratic function for β=3/2\beta=3/2.

This is a smooth two-dimensional function suitable for a first test of a gradient-based optimizer:

f(x1,x2)=x12+x22βx1x2,f(x_1, x_2) = x_1^2 + x_2^2 - \beta x_1 x_2 ,

where β[0,2)\beta \in [0, 2). A β\beta value of zero corresponds to perfectly circular contours. As β\beta increases, the contours become increasingly slanted. For β=2\beta=2, the quadratic becomes semidefinite, and there is a line of weak minima. For β>2\beta > 2, the quadratic is indefinite, and there is no minimum. An intermediate value of β=3/2\beta=3/2 is suitable for first tests and yields the contours shown in Figure D.1.
Global minimum: f(x)=0f(x^*) = 0 at x=(0,0)x^* = (0, 0).

D.1.2 Rosenbrock Function

Rosenbrock function.

Figure D.2:Rosenbrock function.

The two-dimensional Rosenbrock function, shown in Figure D.2, is also known as Rosenbrock’s valley or banana function. This function was introduced by Rosenbrock,1 who used it as a benchmark problem for optimization algorithms.

The function is defined as follows:

f(x1,x2)=(1x1)2+100(x2x12)2.f(x_1, x_2) = \left( 1-x_1 \right)^2 + 100 \left( x_2-x_1^2 \right)^2 .

This became a classic benchmarking function because of its narrow turning valley. The large difference between the maximum and minimum curvatures, and the fact that the principal curvature directions change along the valley, makes it a good test for quasi-Newton methods.

The Rosenbrock function can be extended to nn dimensions by defining the sum,

f(x)=i=1n1(100(xi+1xi2)2+(1xi)2).f(x) = \sum_{i=1}^{n-1} \left( 100 \left( x_{i+1}-{x_i}^2 \right)^2 + \left( 1-x_i \right)^2 \right) .

Global minimum: f(x)=0.0f(x^*) = 0.0 at x=(1,1,,1)x^* = (1,1,\ldots,1).

Local minimum: For n4n \ge 4, a local minimum exists near x=(1,1,,1)x=(-1,1,\ldots,1).

D.1.3 Bean Function

Bean function.

Figure D.3:Bean function.

The “bean” function was developed in this book as a milder version of the Rosenbrock function: it has the same curved valley as the Rosenbrock function but without the extreme variations in curvature. The function, shown in Figure D.3, is

f(x1,x2)=(1x1)2+(1x2)2+12(2x2x12)2.f \left(x_1, x_2\right) = \left(1 - x_1\right)^2 + \left(1 - x_2\right)^2 + \frac{1}{2} \left(2 x_2 - x_1^2\right)^2 .

Global minimum: f(x)=0.09194f(x^*) = 0.09194 at x=(1.21314,0.82414)x^* = (1.21314, 0.82414).

D.1.4 Jones Function

Jones multimodal function.

Figure D.4:Jones multimodal function.

This is a fourth-order smooth multimodal function that is useful to test global search algorithms and also gradient-based algorithms starting from different points. There are saddle points, maxima, and minima, with one global minimum. This function, shown in Figure D.4 along with the local and global minima, is

f(x1,x2)=x14+x244x133x23+2x12+2x1x2.f(x_1, x_2) = x_1^4 + x_2^4 - 4x_1^3 - 3x_2^3 + 2x_1^2 + 2x_1 x_2.

Global minimum: f(x)=13.5320f(x^*) = -13.5320 at x=(2.6732,0.6759)x^* = (2.6732, -0.6759).
Local minima: f(x)=9.7770f(x) = -9.7770 at x=(0.4495,2.2928)x = (-0.4495, 2.2928).
f(x)=9.0312f(x) = -9.0312 at x=(2.4239,1.9219)x = (2.4239, 1.9219).

D.1.5 Hartmann Function

An x_2-x_3 slice of Hartmann function at x_1 = 0.1148.

Figure D.5:An x2x3x_2-x_3 slice of Hartmann function at x1=0.1148x_1 = 0.1148.

The Hartmann function is a three-dimensional smooth function with multiple local minima:

f(x)=i=14αiexp(j=13Aij(xjPij)2),f(x) = - \sum_{i = 1}^4 \alpha_i \exp\left(-\sum_{j= 1}^3 A_{ij}(x_j - P_{ij})^2\right) \, ,

where

α=[1.0,1.2,3.0,3.2],A=[310300.11035310300.11035],P=104[36891170267346994387747010918732554738157438828].\begin{aligned} \alpha &= [1.0, 1.2, 3.0, 3.2] \, ,\\ A &= \begin{bmatrix} 3 & 10 & 30 \\ 0.1 & 10 & 35\\ 3 & 10 & 30 \\ 0.1 & 10 & 35\\ \end{bmatrix} \, , \quad P = 10^{-4}\begin{bmatrix} 3689 & 1170 & 2673\\ 4699 & 4387 & 7470\\ 1091 & 8732 & 5547\\ 381 & 5743 & 8828\\ \end{bmatrix} \, . \\ \end{aligned}

A slice of the function, at the optimal value of x1=0.1148x_1 = 0.1148, is shown in Figure D.5.
Global minimum: f(x)=3.86278f(x^*) = -3.86278 at x=(0.11480,0.55566,0.85254)x^* = (0.11480, 0.55566, 0.85254).

D.1.6 Aircraft Wing Design

We want to optimize the rectangular planform wing of a general aviation-sized aircraft by changing its wingspan and chord (see Example 1.1). In general, we would add many more design variables to a problem like this, but we are limiting it to a simple two-dimensional problem so that we can easily visualize the results.

The objective is to minimize the required power, thereby taking into account drag and propulsive efficiency, which are speed dependent. The following describes a basic performance estimation methodology for a low-speed aircraft. Implementing it may not seem like it has much to do with optimization. The physics is not important for our purposes, but practice translating equations and concepts into code is an important element of formulating optimization problems in general.

In level flight, the aircraft must generate enough lift to equal the required weight, so

L=W.L = W \, .

We assume that the total weight consists of a fixed aircraft and payload weight W0W_0 and a component of the weight that depends on the wing area SS—that is,

W=W0+WsS.W = W_0 + W_s S \, .

The wing can produce a certain lift coefficient (CLC_L) and so we must make the wing area (SS) large enough to produce sufficient lift. Using the definition of lift coefficient, the total lift can be computed as

L=qCLS,L = q C_L S \, ,

where qq is the dynamic pressure and

q=12ρv2.q = \frac{1}{2}\rho v^2 \, .

If we use a rectangular wing, then the wing area can be computed from the wingspan (bb) and the chord (cc) as

S=bc.S = b c \, .

The aircraft drag consists of two components: viscous drag and induced drag. The viscous drag can be approximated as

Df=kCfqSwet.D_f = k C_f q S_\text{wet} \, .

For a fully turbulent boundary layer, the skin friction coefficient, CfC_f, can be approximated as

Cf=0.074Re0.2.C_f = \frac{0.074}{Re^{0.2}} \, .

In this equation, the Reynolds number is based on the wing chord and is defined as follows:

Re=ρvcμ,Re=\frac{\rho v c }{\mu} \, ,

where ρ\rho is the air density, and μ\mu is the air dynamic viscosity.

The form factor, kk, accounts for the effects of pressure drag. The wetted area, SwetS_\text{wet}, is the area over which the skin friction drag acts, which is a little more than twice the planform area. We will use

Swet=2.05S.S_\text{wet} = 2.05 S \, .

The induced drag is defined as

Di=L2qπb2e,D_i = \frac{L^2}{q \pi b^2 e} \, ,

where ee is the Oswald efficiency factor. The total drag is the sum of induced and viscous drag, D=Di+DfD = D_i + D_f.

Our objective function, the power required by the motor for level flight, is

P(b,c)=Dvη,P(b,c) = \frac{D v}{\eta} \, ,

where η\eta is the propulsive efficiency. We assume that our electric propellers have a Gaussian efficiency curve (real efficiency curves are not Gaussian, but this is simple and will be sufficient for our purposes):

η=ηmaxexp((vv)22σ2).\eta = \eta_\text{max} \exp\left(\frac{-(v-\overline{v})^2}{2\sigma^2}\right) \, .

In this problem, the lift coefficient is provided. Therefore, to satisfy the lift requirement in (8), we need to compute the velocity using (11) and (10) as

v=2LρCLS.v = \sqrt{\frac{2L}{\rho C_L S}} \, .
Wing design problem with power requirement contour.

Figure D.6:Wing design problem with power requirement contour.

This is the same problem that was presented in Example 1.2 of Chapter 1. The optimal wingspan and chord are b=25.48b = 25.48 m and c=0.50c = 0.50 m, respectively, given the parameters. The contour and the optimal wing shape are shown in Figure D.6.

Because there are no structural considerations in this problem, the resulting wing has a higher wing aspect ratio than is realistic. This emphasizes the importance of carefully selecting the objective and including all relevant constraints.

The parameters for this problem are given as follows:

ParameterValueUnitDescription
ρ\rho1.2kg/m3^3Density of air
μ\mu1.8×1051.8\times10^{-5}kg/(m sec)Viscosity of air
kk1.2Form factor
CLC_L0.4Lift coefficient
ee0.80Oswald efficiency factor
W0W_01,000NFixed aircraft weight
WsW_s8.0N/m2^2Wing area dependent weight
ηmax\eta_\text{max}0.8Peak propulsive efficiency
vˉ\bar{v}20.0m/sFlight speed at peak propulsive efficiency
σ\sigma5.0m/sStandard deviation of efficiency function

D.1.7 Brachistochrone Problem

The brachistochrone problem is a classic problem proposed by Johann Bernoulli (see Section 2.2 for the historical background). Although this was originally solved analytically, we discretize the model and solve the problem using numerical optimization. This is a useful problem for benchmarking because you can change the number of dimensions.

A bead is set on a wire that defines a path that we can shape. The bead starts at some yy-position hh with zero velocity. For convenience, we define the starting point at x=0x=0.

From the law of conservation of energy, we can then find the velocity of the bead at any other location. The initial potential energy is converted to kinetic energy, potential energy, and dissipative work from friction acting along the path length, yielding the following:

mgh=12mv2+mgy+0xμkmgcosθds0=12v2+g(yh)+μkgxv=2g(hyμkx).\begin{aligned} m g h &= \frac{1}{2} m v^2 + m g y + \int_0^x \mu_k m g \cos\theta \mathrm{d} s \\ 0 &= \frac{1}{2} v^2 + g (y - h) + \mu_k g x \\ v &= \sqrt{2g (h - y - \mu_k x)} \, . \end{aligned}

Now that we know the speed of the bead as a function of xx, we can compute the time it takes to traverse an differential element of length ds\mathrm{d} s:

Δt=xixi+dxdsv(x)\begin{aligned} \Delta t &= \int_{x_i}^{x_i + \mathrm{d} x}\frac{\mathrm{d} s}{v(x)}\\ \end{aligned}
Δt=xixi+dxdx2+dy22g(hy(x)μkx)=xixi+dx1+(dydx)2dx2g(hy(x)μkx).\begin{aligned} \Delta t &= \int_{x_i}^{x_i + \mathrm{d} x}\frac{\sqrt{\mathrm{d} x^2 + \mathrm{d} y^2}}{\sqrt{2g (h - y(x) - \mu_k x)}}\\ &= \int_{x_i}^{x_i + \mathrm{d} x}\frac{\sqrt{1 + \left(\frac{\mathrm{d} y}{\mathrm{d} x}\right)^2} \mathrm{d} x}{\sqrt{2g (h - y(x) - \mu_k x)}} \, . \end{aligned}
A discretized representation of the brachistochrone problem.

Figure D.7:A discretized representation of the brachistochrone problem.

To discretize this problem, we can divide the path into linear segments. As an example, Figure D.7 shows the wire divided into four linear segments (five nodes) as an approximation of a continuous wire. The slope si=(Δy/Δx)is_i = (\Delta y/\Delta x)_i is then a constant along a given segment, and y(x)=yi+si(xxi)y(x) = y_i + s_i (x - x_i). Making these substitutions results in

Δti=1+si22gxixi+1dxhyisi(xxi)μkx.\Delta t_i = \frac{\sqrt{1 + s_i^2}}{\sqrt{2g}} \int_{x_i}^{x_{i+1}}\frac{\mathrm{d} x}{\sqrt{h - y_i - s_i (x - x_i) - \mu_k x}}.

Performing the integration and simplifying (many steps omitted here) results in

Δti=2gΔxi2+Δyi2hyi+1μkxi+1+hyiμkxi,\Delta t_i = \sqrt{\frac{2}{g}} \frac{ \sqrt{\Delta x_i^2 + \Delta y_i^2}} {\sqrt{h - y_{i+1} - \mu_k x_{i+1}} + \sqrt{h - y_i - \mu_k x_i}},

where Δxi=(xi+1xi)\Delta x_i = (x_{i+1} - x_i), and Δyi=(yi+1yi)\Delta y_i = (y_{i+1} - y_i). The objective of the optimization is to minimize the total travel time, so we need to sum up the travel time across all of our linear segments:

T=i=1n1Δti.T = \sum_{i = 1}^{n -1} \Delta t_i .

Minimization is unaffected by multiplying by a constant, so we can remove the multiplicative constant for simplicity (we see that the magnitude of the acceleration of gravity has no effect on the optimal path):

minimizef=i=1n1Δxi2+Δyi2hyi+1μkxi+1+hyiμkxiby varyingyi,i=1,,n.\begin{aligned} \text{minimize} & \quad f = \sum_{i = 1}^{n-1} \frac{ \sqrt{\Delta x_i^2 + \Delta y_i^2}} {\sqrt{h - y_{i+1} - \mu_k x_{i+1}} + \sqrt{h - y_i - \mu_k x_i}} \\ \text{by varying} & \quad y_i, \quad i = 1, \ldots, n. \end{aligned}

The design variables are the n2n-2 positions of the path parameterized by yiy_i. The endpoints must be fixed; otherwise, the problem is ill-defined, which is why there are n2n-2 design variables instead of nn. Note that xx is a parameter, meaning that it is fixed. We could space the xix_i any reasonable way and still find the same underlying optimal curve, but it is easiest to just use uniform spacing. As the dimensionality of the problem increases, the solution becomes more challenging. We will use the following specifications:

  • Starting point: (x,y)=(0,1)(x, y) = (0, 1) m.

  • Ending point: (x,y)=(1,0)(x, y) = (1, 0) m.

  • Kinetic coefficient of friction μk=0.3.\mu_k = 0.3.

The analytic solution for the case with friction is more difficult to derive, but the analytic solution for the frictionless case (μk=0\mu_k = 0) with our starting and ending points is as follows:

x=a(θsin(θ))y=a(1cos(θ))+1,\begin{aligned} x &= a(\theta - \sin(\theta)) \\ y &= -a(1 - \cos(\theta)) + 1 \, ,\\ \end{aligned}

where a=0.572917a = 0.572917 and θ[0,2.412]\theta \in [0, 2.412].

D.1.8 Spring System

Consider a connected spring system of two springs with lengths of l1l_1 and l2l_2 and stiffnesses of k1k_1 and k2k_2, fixed at the walls as shown in Figure D.8. An object with mass mm is suspended between the two springs. It will naturally deform such that the sum of the gravitational and spring potential energy, EpE_p, is at the minimum.

Two-spring system with no applied force (top) and with applied force (bottom).

Figure D.8:Two-spring system with no applied force (top) and with applied force (bottom).

The total potential energy of the spring system is

Ep(x1,x2)=12k1(Δl1)2+12k2(Δl2)2mgx2,E_p(x_1,x_2) = \frac{1}{2} k_1 (\Delta l_1)^2 + \frac{1}{2} k_2 (\Delta l_2)^2 - mgx_2 \, ,

where Δl1\Delta l_1 and Δl2\Delta l_2 are the changes in length for the two springs. With respect to the original lengths, and displacements x1x_1 and x2x_2 as shown, they are defined as

Δl1=(l1+x1)2+x22l1Δl2=(l2x1)2+x22l2.\begin{aligned} \Delta l_1 &= \sqrt{\left(l_1 + x_1\right)^2 + x_2^2} - l_1 \\ \Delta l_2 &= \sqrt{\left(l_2 - x_1\right)^2 + x_2^2} - l_2 \, . \end{aligned}

This can be minimized to determine the final location of the object.

Total potential energy contours for two-spring system.

Figure D.9:Total potential energy contours for two-spring system.

With initial lengths of l1=12l_1 = 12 cm, l2=8l_2 = 8 cm; spring stiffnesses of k1=1.0k_1 = 1.0 N\cdotcm, k2=10.0k_2 = 10.0 N\cdotcm; and a force due to gravity of mg=7Nmg = 7\text{N}, the minimum potential energy is at (x1,x2)=(2.7852,6.8996)(x_1, x_2) = (2.7852, 6.8996). The contour of EkE_k with respect to x1x_1 and x2x_2 is shown in Figure D.9.

The analytic derivatives can also be computed for use in a gradient-based optimization. The derivative of EpE_p with respect to x1x_1 is

Epx1=12k1(2Δl1(Δl1)x1)+12k2(2Δl2(Δl2)x1)mg,\frac{\partial {E_p}}{\partial {x_1}}= \frac{1}{2} k_1 \left(2 \Delta l_1 \frac{\partial {(\Delta l_1)}}{\partial {x_1}}\right) + \frac{1}{2} k_2 \left(2 \Delta l_2 \frac{\partial {(\Delta l_2)}}{\partial {x_1}}\right) - mg \, ,

where the partial derivatives of Δl1\Delta l_1 and Δl2\Delta l_2 are

(Δl1)x1=l1+x1(l1+x1)2+x22(Δl2)x2=l2x1(l2x1)2+x22.\begin{aligned} \frac{\partial {(\Delta l_1)}}{\partial {x_1}}= \frac{l_1 + x_1}{\sqrt{\left(l_1 + x_1\right)^2 + x_2^2}} \\ \frac{\partial {(\Delta l_2)}}{\partial {x_2}}= \frac{l_2 - x_1}{\sqrt{\left(l_2 - x_1\right)^2 + x_2^2}} \, . \end{aligned}

By letting L1=(l1+x1)2+x22\mathcal{L}_1 = \sqrt{\left(l_1 + x_1\right)^2 + x_2^2} and L2=(l2x1)2+x22\mathcal{L}_2 = \sqrt{\left(l_2 - x_1\right)^2 + x_2^2}, the partial derivative of EpE_p with respect to x1x_1 can be written as

Epx1=k1(L1l1)(l1+x1)L1+k2(L2l2)(l2x1)L2mg.\frac{\partial {E_p}}{\partial {x_1}}= \frac{k_1 (\mathcal{L}_1 - l_1) (l_1 + x_1)}{\mathcal{L}_1} + \frac{k_2 (\mathcal{L}_2 - l_2) (l_2 - x_1)}{\mathcal{L}_2} - mg.

Similarly, the partial derivative of EpE_p with respect to x2x_2 can be written as

Epx2=k1x2(L1l1)L1+k2x2(L2l2)L2.\frac{\partial {E_p}}{\partial {x_2}}= \frac{k_1 x_2 (\mathcal{L}_1 - l_1)}{\mathcal{L}_1} + \frac{k_2 x_2 (\mathcal{L}_2 - l_2)}{\mathcal{L}_2} \, .

D.2 Constrained Problems

D.2.1 Barnes Problem

The Barnes problem was devised in a master’s thesis2 and has been used in various optimization demonstration studies. It is a good starter problem because it only has two dimensions for easy visualization while also including constraints.

The objective function contains the following coefficients:

a1a_{1} = 75.196a2a_{2} = -3.8112
a3a_{3} = 0.12694a4a_{4} = 2.0567×103-2.0567 \times 10^{-3}
a5a_{5} = 1.0345×1051.0345 \times 10^{-5}a6a_{6} = -6.8306
a7a_{7} = 0.030234a8a_{8} = 1.28134×103-1.28134 \times 10^{-3}
a9a_{9} = 3.5256×1053.5256 \times 10^{-5}a10a_{10} = 2.266×107-2.266 \times 10^{-7}
a11a_{11} = 0.25645a12a_{12} = 3.4604×103-3.4604 \times 10^{-3}
a13a_{13} = 1.3514×1051.3514 \times 10^{-5}a14a_{14} = -28.106
a15a_{15} = 5.2375×106-5.2375 \times 10^{-6}a16a_{16} = 6.3×108-6.3 \times 10^{-8}
a17a_{17} = 7.0×10107.0 \times 10^{-10}a18a_{18} = 3.4054×1043.4054 \times 10^{-4}
a19a_{19} = 1.6638×106-1.6638 \times 10^{-6}a20a_{20} = -2.8673
a21a_{21} = 0.0005

For convenience, we define the following quantities:

y1=x1x2,y2=y1x1,y3=x22,y4=x12y_1 = x_1x_2,\quad y_2 = y_1x_1,\quad y_3 = x_2^2,\quad y_4 = x_1^2

The objective function is then:

f(x1,x2)=a1+a2x1+a3y4+a4y4x1+a5y42+a6x2+a7y1+a8x1y1+a9y1y4+a10y2y4+a11y3+a12x2y3+a13y32+a14x2+1+a15y3y4+a16y1y4x2+a17y1y3y4+a18x1y3+a19y1y3+a20exp(a21y1).\begin{aligned} f(x_1, x_2) &= a_{1} + a_{2}x_1 + a_{3}y_4 + a_{4}y_4x_1 + a_{5}y_4^2 + a_{6}x_2 + a_{7}y_1 +\\ & a_{8}x_1y_1 + a_{9}y_1y_4 + a_{10}y_2y_4 + a_{11}y_3 + a_{12}x_2y_3 + a_{13}y_3^2 + \\ & \frac{a_{14}}{x_2+1} + a_{15}y_3y_4 + a_{16}y_1y_4x_2 + a_{17}y_1y_3y_4 + a_{18}x_1y_3 + \\ & a_{19}y_1y_3 + a_{20}\exp(a_{21}y_1). \end{aligned}

There are three constraints of the form g(x)0g(x) \le 0:

g1=1y1700g2=y4252x25g3=x15000.11(x2501)2.\begin{aligned} g_1 &= 1 - \frac{y_1}{700} \\ g_2 &= \frac{y_4}{25^2} - \frac{x_2}{5} \\ g_3 &= \frac{x_1}{500} - 0.11 - \left(\frac{x_2}{50}-1\right)^2. \end{aligned}
Barnes function.

Figure D.10:Barnes function.

The problem also has bound constraints. The original formulation is bounded from [0,80][0, 80] in both dimensions, in which case the global optimum occurs in the corner at x=[80,80]x^* = [80, 80], with a local minimum in the middle. However, for our usage, we preferred the global optimum not to be in the corner and so set the bounds to [0,65][0, 65] in both dimensions. The contour of this function is plotted in Figure D.10.
Global minimum: f(x)=31.6368f(x^*) = -31.6368 at x=(49.5263,19.6228)x^* = (49.5263, 19.6228).
Local minimum: f(x)=17.7754f(x) = -17.7754 at x=(65,65)x = (65, 65).

D.2.2 Ten-Bar Truss

The 10-bar truss is a classic optimization problem.3 In this problem, we want to find the optimal cross-sectional areas for the 10-bar truss shown in Figure D.11. A simple truss finite-element code set up for this particular configuration is available in the book code repository.

The function takes in an array of cross-sectional areas and returns the total mass and an array of stresses for each truss member.

Ten-bar truss and element numbers.

Figure D.11:Ten-bar truss and element numbers.

The objective of the optimization is to minimize the mass of the structure, subject to the constraints that every segment does not yield in compression or tension. The yield stress of all elements is 25×10325 \times 10^3 psi, except for member 9, which uses a stronger alloy with a yield stress of 75×10375 \times 10^3 psi. Mathematically, the constraint is

σiσyifor i=1,,10,|\sigma_i| \le {\sigma_y}_i \quad \text{for } i = 1, \ldots, 10 ,

where the absolute value is needed to handle tension and compression (with the same yield strength for tension and compression). Absolute values are not differentiable at zero and should be avoided in gradient-based optimization if possible. Thus, we should put this in a mathematically equivalent form that avoids absolute value.

Each element should have a cross-sectional area of at least 0.1 in2^2 for manufacturing reasons (bound constraint). When solving this optimization problem, you may need to scale the objective and constraints.

A truss element oriented at some angle \phi, where \phi is measured from a horizontal line emanating from the first node, oriented in the positive x direction.

Figure D.12:A truss element oriented at some angle ϕ\phi, where ϕ\phi is measured from a horizontal line emanating from the first node, oriented in the positive xx direction.

Although not needed to solve the problem, an overview of the equations is provided. A truss element is the simplest type of structural finite element and only has an axial degree of freedom. The theory and derivation for truss elements are simple, but for our purposes, we skip to the result. Given a two-dimensional element oriented arbitrarily in space (Figure D.12), we can relate the displacements at the nodes to the forces at the nodes through a stiffness relationship.

In matrix form, the equation for a given element is Ked=qK_{e} d = q. In detail, the equation is

EAL[c2csc2cscss2css2c2csc2cscss2css2][u1v1u2v2]=[X1Y1X2Y2]\frac{EA}{L} \begin{bmatrix} c^2 & cs & -c^2 & -cs \\ cs & s^2 & -cs & -s^2 \\ -c^2 & -cs & c^2 & cs \\ -cs & -s^2 & cs & s^2 \end{bmatrix} \begin{bmatrix} u_1 \\ v_1 \\ u_2 \\ v_2 \end{bmatrix} = \begin{bmatrix} X_1 \\ Y_1 \\ X_2 \\ Y_2 \end{bmatrix}

where the displacement vector is d=[u1,v1,u2,v2]d = [u_1, v_1, u_2, v_2]. The meanings of the variables in the equation are described in Table 1.

Table 1:The variables used in the stiffness equation.

VariableDescription
XiX_iForce in the xx-direction at node ii
YiY_iForce in the yy-direction at node ii
EEModulus of elasticity of truss element material
AAArea of truss element cross section
LLLength of truss element
cccosϕ\cos\phi
sssinϕ\sin\phi
uiu_iDisplacement in the xx-direction at node ii
viv_iDisplacement in the yy-direction at node ii

The stress in the truss element can be computed from the equation σ=Sed\sigma = S_e d, where σ\sigma is a scalar, dd is the same vector as before, and the element SeS_e matrix (really a row vector because stress is one-dimensional for truss elements) is

Se=EL[cscs].S_e = \frac{E}{L} \begin{bmatrix} -c & -s & c & s \end{bmatrix} \, .

The global structure (an assembly of multiple finite elements) has the same equations, Kd=qK d = q and σ=Sd\sigma = S d, but now dd contains displacements for all of the nodes in the structure, d=[x1,x2,,xn]d = [x_1, x_2, \ldots, x_n]. If we have nn nodes and mm elements, then qq and dd are 2n2n-vectors, KK is a (2n×2n)(2n \times 2n) matrix, SS is an (m×2n)(m \times 2n) matrix, and σ\sigma is an mm-vector. The elemental stiffness and stress matrices are first computed and then assembled into the global matrices. This is straightforward because the displacements and forces of the individual elements add linearly.

After we assemble the global matrices, we must remove any degrees of freedom that are structurally rigid (already known to have zero displacement). Otherwise, the problem is ill-defined, and the stiffness matrix will be ill-conditioned.

Given the geometry, materials, and external loading, we can populate the stiffness matrix and force vector. We can then solve for the unknown displacements from

Kd=q.K d = q \, .

With the solved displacements, we can compute the stress in each element using

σ=Sd.\sigma = S d \,.
References
  1. Rosenbrock, H. H. (1960). An automatic method for finding the greatest or least value of a function. The Computer Journal, 3(3), 175–184. 10.1093/comjnl/3.3.175
  2. Barnes, G. K. (1967). A comparative study of nonlinear optimization codes [Mathesis]. University of Texas at Austin.
  3. Venkayya, V. B. (1971). Design of optimum structures. Computers & Structures, 1(1–2), 265–309. 10.1016/0045-7949(71)90013-7