









Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!










Academic year 202 5 - 2026
INDEX
ST
ND
RD
TH
The design variables are the cross-sectional areas of the truss elements. These variables are subjected to
explicit bounds (box constraints) to ensure physical feasibility and prevent numerical singularities:
𝑙𝑏
): 0.001mm
2
(A non-zero minimum area).
𝑢𝑏
): 800mm
2
From an operational perspective, the problem involves evaluating four distinct scenarios. In each case, the
maximum permissible volume 𝑉 0
is defined as a fraction 𝛼 of the upper-bound volume, namely the volume
attained when 𝑥 = 800 mm
2
. Accordingly, each scenario is characterised by a specific value of 𝛼, as
outlined below:
0
𝑚𝑎𝑥
𝑚𝑎𝑥
𝑢𝑏
st
scenario 𝛼 = 0. 05
nd
scenario 𝛼 = 0. 10
rd
scenario 𝛼 = 0. 15
th
scenario 𝛼 = 0. 20
Table 1 : alpha values for each scanerio
For each scenario, the following aspects must be examined:
constraint during the iterations of the algorithm.
stresses of elements 64, 77 and 82.
Figure 1 : Geometry and boundary conditions
Figure 2 : target beam
FORMULAS AND MATLAB
IMPLEMENTATION
Analytically, the minimum-compliance problem under consideration can be expressed through the
following system, which encapsulates both the objective function and the associated constraint.
min
𝑥
0
𝑇
1
0
𝑗
2
The first function to be implemented in MATLAB in order to run the simulation is the routine responsible
for computing the gradient of the constraint function. The required gradient vector is obtained by evaluating
the partial derivative of the total volume with respect to each cross-sectional area 𝑥 𝑗
1
0
𝑇
0
1
𝑗
𝑗
Accordingly, the function gradConstr computes the gradient of the volume constraint simply by returning
the vector of all element lengths.
function grad_constr = gradConstr(nodes, elements)
% INPUTS:
% nodes, matrix of node coordinates
% elements, matrix of nodes constituting elements
% OUTPUTS:
% grad_constr, vector of the gradient of the constraint (volume) computed
% with respect to x (cross sectional areas)
n_el = size(elements,1);
lengths = zeros(n_el,1);
for ii = 1:n_el
x1 = nodes(elements(ii,1),1);
x2 = nodes(elements(ii,2),1);
y1 = nodes(elements(ii,1),2);
y2 = nodes(elements(ii,2),2);
lengths(ii) = sqrt((y2-y1)^2 + (x2-x1)^2);
end
grad_constr = lengths;
end
function grad_constr = gradConstr(nodes, elements)
% INPUTS:
% nodes, matrix of node coordinates
% elements, matrix of nodes constituting elements
% OUTPUTS:
% grad_constr, vector of the gradient of the constraint (volume) computed
% with respect to x (cross sectional areas)
The analytical solution 𝜆
∗
The function implements the analytical solution obtained from the CONLIN approximation. By setting the
derivative of the approximate Lagrangian ℒ
appr
(x, 𝜆) with respect to 𝑥
𝑗
equal to zero, the unconstrained
optimal cross-sectional area 𝑥
𝑗
0
is obtained with this formulation.
𝑗
0
𝑘
𝑗
𝑗
Subsequently, the function enforces the explicit lower and upper bounds (𝑥 𝑙𝑏
𝑢𝑏
) to transform each
unconstrained value 𝑥
𝑗
0
into the final admissible design variable x
∗
The implementation accounts for all four possible sign combinations of the compliance gradient 𝑐 𝑗
and the
volume gradient 𝑎
𝑗
The Dual Derivative 𝑔(𝑥
∗
The second task of the function is to evaluate the derivative of the dual function 𝜑(𝜆), denoted 𝑔(𝜆). This
quantity is defined as
∗
= 𝑉(x
∗
0
The function first computes the volume 𝑉(x
∗
) corresponding to the updated design x
∗
(𝜆) and then subtracts
the prescribed target volume 𝑉
0
. The resulting value 𝑔(𝜆) is subsequently employed within the outer loop,
which iterates on 𝜆 until this derivative becomes zero. Reaching 𝑔(𝜆) = 0 ensures satisfaction of the
necessary optimality condition, confirming that the design x
∗
complies with the imposed volume constraint.
function [g, x_star] = gradPhi(lambda, x_k, problem)
% INPUTS:
% lambda, value of Lagrange multiplier
% x_k, point with respect to which the problem is linearised (x at the
previous iteration)
% problem, struct with problem data (gradients, bounds, V_target, etc.)
% OUTPUTS:
% x_star, vector of the optimal cross-sectional areas computed as a
% function of the supplied lambda (x*(lambda))
% g, value of the constraint evaluated at x_star (V(x*) - V_target). This is
% the derivative of the dual function phi(lambda), and must be zero at
optimality.
% -------------------------
% Impose consistency on lambda (LM must be non-negative)
lambda = max(lambda, 0);
% Collect gradients and constraints from problem data
grad_of = problem.grad_of; % Compliance gradient (c_j)
grad_constr = problem.grad_constr; % Volume gradient (a_j = L_j)
x_lb = problem.x_lb;
x_ub = problem.x_ub;
V0 = problem.V0; % V0 is the target volume V_target
x_ub = problem.x_ub;
function [g, x_star] = gradPhi(lambda, x_k, problem)
%Initialize x_star vector
x_star = zeros(problem.n_el,1);
% Compute x_star(lambda) depending on the sign of the gradients
for ii = 1:problem.n_el
c_j = grad_of(ii);
a_j = grad_constr(ii);
x_k_j = x_k(ii);
x_lb_j = x_lb(ii);
x_ub_j = x_ub(ii);
% Case 1: c_j > 0 and a_j > 0 (Minimizing C and increasing V)
if c_j > 0 && a_j > 0
x_star(ii) = x_lb_j;
% Case 2: c_j > 0 and a_j < 0 (Minimizing C and decreasing V)
elseif c_j > 0 && a_j < 0
x_star(ii) = x_ub_j;
% Case 3: c_j < 0 and a_j > 0 (Typical case)
elseif c_j < 0 && a_j > 0
if lambda == 0
x_star(ii) = x_ub_j;
else
% Analytical solution for CONLIN (x_j^0)
x_j0 = x_k_j * sqrt(-c_j / (lambda * a_j));
% Apply box constraints: max(lb, min(ub, x_j0))
x_star(ii) = max(x_lb_j, min(x_ub_j, x_j0));
end
% Case 4: c_j < 0 and a_j < 0 (Decreasing C and decreasing V)
elseif c_j < 0 && a_j < 0
x_star(ii) = x_ub_j;
% Handle edge cases (e.g., zero gradients)
else
x_star(ii) = x_lb_j;
end
end
% -------------------------
% Compute g(lambda)
[V_star, ~] = computeVolume(x_star, problem.nodes, problem.elements);
g = V_star - V0; % This must be solved for g=
end
%Initialize x_star vector
x_star = zeros(problem.n_el,1);
% Compute x_star(lambda) depending on the sign of the gradients
for ii = 1:problem.n_el
c_j = grad_of(ii);
a_j = grad_constr(ii);
x_k_j = x_k(ii);
x_lb_j = x_lb(ii);
x_ub_j = x_ub(ii);
2
nd
scenario (𝛼 = 0. 10 )
Element Area [mm
2
] Stress [MPa]
Table 3 : Optimized values for selected truss (alpha = 0. 10 )
Figure 6: Optimized topology for alpha = 0. 10
Figure 8: Total truss volume for alpha = 0.
Figure 7: Compliance optimization for alpha = 0. 10
3
rd
scenario (𝛼 = 0. 15 )
Element Area [mm
2
] Stress [MPa]
Table 4 : Optimized values for selected truss (alpha = 0.1 5 )
Figure 9 : Optimized topology for alpha = 0.1 5
Figure 11 : Total truss volume for alpha = 0.1 5
Figure 10 : Compliance optimization for alpha = 0.1 5
CONCLUSIONS
The developed programme successfully performs a topology optimisation analysis on the truss structure,
effectively addressing the minimum compliance problem. In particular, the solutions associated with
𝛼 = 0. 05 and 𝛼 = 0. 10 exhibit identical layouts (Figures 3 and 6), whereas the configurations obtained for
higher values of 𝛼 (Figures 9 and 12) display a markedly different topology.
A closer examination reveals that increasing 𝛼 prompts the optimiser to introduce secondary truss members
alongside the primary load-bearing path identified at 𝛼 = 0. 05. This reflects the natural tendency of the
optimisation algorithm to exploit the additional volume by reinforcing the structural layout and enhancing
its overall robustness.
The compliance histories (Figures 4, 7, 10 , and 13) highlight two notable features. First, compliance
decreases monotonically with increasing 𝛼, an expected outcome given that compliance is inversely related
to stiffness, which in turn depends directly on the cross-sectional area of the truss elements (always
maximum as denoted in Figure 4, 8, 11 and 14). Second, all scenarios reach a stable convergence value
after approximately 40 iterations, confirming that the prescribed limit of 100 iterations is appropriate, albeit
somewhat conservative.
Among the various structural members, the trusses selected for detailed analysis (Figure 2) display the most
distinctive behaviour across the different volume constraints. These elements consistently act as the primary
load-carrying members.
This trend is clearly reflected in the evolution of their cross-sectional areas. As the value of 𝛼 increases, the
available volume constraint becomes less restrictive, enabling the optimiser to enlarge these members.
Since the axial stiffness of a truss element is defined by
𝑒
Figure 15: Truss area comparison
an increase in 𝐴 directly enhances stiffness and therefore reduces structural deformations, leading to a lower
compliance, in line with the optimisation objective.
Conversely, the corresponding axial stresses in these trusses decrease with increasing 𝐴. For a fixed internal
axial force 𝑁, the stress is governed by
which explains the monotonic reduction of stress observed in the results. This inverse dependence
demonstrates that these members are mechanically critical: when additional material becomes available,
the optimisation process reinforces precisely the structural paths that contribute most effectively to global
stiffness improvement.
Overall, the behaviour of the selected trusses provides clear insight into the internal logic of the optimisation
algorithm. Their evolution with respect to 𝛼 illustrates how the solver identifies and strengthens the
dominant load paths, ensuring that the limited material is distributed where it offers the greatest mechanical
benefit.
Figure 16. Truss stress comparison