Skip to article frontmatterSkip to article content

1.1Introductory example

Problem statement

To motivate first definitions, let us consider the following practical shape optimization problem.

A can producer wants to optimize his consumption of raw material.

They formulate one explicit constraint: the volume of the can must be V0=1V_0 = 1 L.

We assume objects of constant thickness ee. Therefore, the quantity of raw material is simply given by

quantity of raw material = area of cylinder ×e\text{quantity of raw material } = \text{ area of cylinder } \times e

Since the goal is to optimize (i.e., in this case, minimize) the consumption of raw material, the optimization problems can be formulated in layman’s terms as follows:

Mathematical formulation

Expression of the area AA (objective function or criterion)

A(r,h)=Acylinder(r,h)+Alids(r,h)=2πrh+2πr2A(r, h) = A_{\text{cylinder}}(r, h) + A_{\text{lids}}(r, h) = 2\pi r h + 2 \pi r^2

The dimensions rr and hh are the variables of the optimization problem.

Constraints We have explicit and implicit constraints:

The constrained optimization problem is finally written as

Find (r,h) such that A(r,h) is minimal and {r0 and h0πr2h=V0\text{Find } (r^\star, h^\star) \text{ such that } A(r^\star, h^\star) \text{ is minimal and } \begin{cases}r\geq 0 \text{ and } h\geq 0\\ \pi r^2 h = V_0\end{cases}

Simplification

Notice that hh and rr are related by the constraint V0=πr2hV_0 = \pi r^2 h. Therefore, the area A(r,h)A(r, h) can be rewritten as a function of rr only. Using

h(r)=V0πr2(h0OK!)h(r) = \frac{V_0}{\pi r^2} \quad (h\geq 0 \quad \text{OK!})

and substituting this into the expression for A(r,h)A(r, h), one obtains

A(r,h)=2πrh+2πr2=2πrV0πr2+2πr2=2V0r+2πr2:=A~(r)\begin{align*} A(r, h) &= 2\pi r h + 2\pi r^2\\ & = 2 \pi r \frac{V_0}{\pi r^2} + 2 \pi r^2\\ &= \frac{2V_0}{r} + 2\pi r^2\\ &:= \tilde{A}(r) \end{align*}

The volume constraint is directly taken into account in the new objective function A~(r)\tilde{A}(r). We consider the constraint r0r\geq 0 when searching for the minimum of A~(r)\tilde{A}(r) over R+\mathbb{R}_+;

Visualization using Python

Let us plot the objective function using basic Python commands.

# import libraries
import numpy as np # for manipulation of arrays
import matplotlib.pyplot as plt # for plotting

# function definitions
def h(r, V0=1000):
    return V0 / (np.pi * r**2)

def A_lids(r):
    return 2 * np.pi * r**2

def A_cylinder(r):
    return 2 * np.pi * r * h(r)

def A(r):
    return A_couvercle(r) + A_cylindre(r)

# define variables and constraints
V0 = 1000  # volume in cm^3 (=1 L)
r = np.linspace(1, 15, 100)  # vector of 100 values linearly spaced between 1 and 15

# do the plotting
plt.plot(r, A_lids(r), label="lids area", linewidth=2, linestyle='--')
plt.plot(r, A_cylinder(r), label="cylinder area", linewidth=2, linestyle=':')
plt.plot(r, A_lids(r) + A_cylinder(r), label="total area", linewidth=2)
plt.xlabel("radius r [cm]")
plt.ylabel("objective value [cm^2]")
plt.legend()
plt.show()
<Figure size 640x480 with 1 Axes>

The plot suggests a minimizer exists, somewhere between r=4r=4 cm and r=6r = 6 cm. Quite naturally, the minimum area value is obtained when the derivative of A~(r)\tilde{A}(r) vanishes. Let us do the explicit computation.

Explicit solutions

The derivative of the objective function vanishes at its minimum.

dA~(r)dr=4πr2V0r2\frac{\mathrm{d}\tilde{A}(r)}{\mathrm{d}r} = 4\pi r - \frac{2 V_0}{r^2}

We solve

dA~(r)drr=r=0    4πr=2V0(r)2    r=[V02π]1/3\left.\frac{\mathrm{d}\tilde{A}(r)}{\mathrm{d}r}\right|_{r = r^\star} = 0 \iff 4\pi r^\star = \frac{2V_0}{(r^\star)^2} \iff r^\star = \left[\frac{V_0}{2\pi}\right]^{1/3}

In summary, the solutions to the optimization problem are

r=[V02π]1/3h^=V0π(r)2=2rr^\star = \left[\frac{V_0}{2\pi}\right]^{1/3} \qquad \hat{h} = \frac{V_0}{\pi (r^\star)^2}= 2r^\star

We can also check that our computations are correct using Python, by modifying the previous code.

# optimal value
r_star= (V0/(2*np.pi))**(1/3)

# do the plotting
plt.plot(r, A_lids(r), label="lids area", linewidth=2, linestyle='--')
plt.plot(r, A_cylinder(r), label="cylinder area", linewidth=2, linestyle=':')
plt.plot(r, A_lids(r) + A_cylinder(r), label="total area", linewidth=2)
plt.axvline(r_star, label="optimal radius", linewidth=2, color="black")
plt.axhline(A_lids(r_star) + A_cylinder(r_star), label="optimal area", linewidth=2, color="black", linestyle='--')
plt.xlabel("radius r [cm]")
plt.ylabel("objective value [cm^2]")
plt.legend()
plt.show()

print(f"Optimal value of r minimizing A(r): r_opt = {r_star:.2f} cm")
print(f"Minimal area A(r_opt): A_min = {A_lids(r_star) + A_cylinder(r_star):.2f} cm^2")
print(f"Associated optimal height value h(r_opt): h_opt = {h(r_star):.2f} cm")
<Figure size 640x480 with 1 Axes>
Optimal value of r minimizing A(r): r_opt = 5.42 cm
Minimal area A(r_opt): A_min = 553.58 cm^2
Associated optimal height value h(r_opt): h_opt = 10.84 cm

You can play around with this code snippets and see how the solution changes as we modify the value of V0V_0.