A computer-lab course project applying Genetic Algorithm (GA) and Particle Swarm Optimization (PSO) — powered by scikit-opt — to the section optimization of three typical structural members. All designs strictly follow Chinese national codes (GB 50010 / GB 50017), minimizing cost or steel weight under capacity, detailing, and stiffness constraints, handled with the penalty-function method.
| Task | Algorithm | Member | Variables | Objective | Optimum |
|---|---|---|---|---|---|
| Task 1 | GA | RC simply-supported beam | b, h, A_s | Total cost | ¥492.55 |
| Task 2 | PSO | H-section steel column | h, b, t_w, t_f | Steel weight | 395.64 kg |
| Task 3 | GA | Circular CFST short column | D, t | Unit cost | ¥383.28 /m |
Common methodology:
- Penalty-function constraint handling — each violated constraint contributes
M·g²(M = 10⁶) to the objective, guiding the search into the feasible region - Engineering modularization — dimensions rounded to practical construction modules (beam 50 mm, H-section 5 mm, tube 10 mm / 1 mm)
- Automatic code verification — every optimum is re-checked against the full code requirements (capacity, slenderness, local stability, reinforcement ratio) and reported
A single-reinforced rectangular RC beam, span L = 6.0 m, uniform design load q = 30 kN/m. Find the section (b, h) and tensile steel area (A_s) minimizing total cost (concrete ¥400/m³ + rebar ¥6000/t).
| Item | Value |
|---|---|
| Concrete / Steel | C30 (f_c = 14.3 N/mm²) / HRB400 (f_y = 360 N/mm²) |
| Cover a_s | 40 mm |
| Design moment M_max | qL²/8 = 135.00 kN·m |
| Variables | b ∈ [200, 400] mm, h ∈ [400, 800] mm, A_s ∈ [100, 8000] mm² |
| GA settings | pop = 1000, max_iter = 500, prob_mut = 0.05 |
Constraints: bending capacity M_u ≥ M_max · min/max reinforcement ratio (0.2% ≤ ρ ≤ 2.5%) · depth-span ratio h ≥ L/15 · ductile failure x ≤ ξ_b·h₀
| Optimum | Cost | Capacity check | Ductility | ρ | ρ_h0 | h ≥ L/15 |
|---|---|---|---|---|---|---|
| b = 200 mm, h = 600 mm, A_s = 730 mm² | ¥492.55 | M_u = 135.09 ≥ 135.00 kN·m ✅ | x = 91.9 ≤ 290.1 mm ✅ | 0.608% ✅ | 0.652% ✅ | 600 ≥ 400 ✅ |
GA convergence curve (left) & optimal beam section diagram (right)
An axially loaded H-section column, effective height H = 4.0 m (pinned-pinned), design axial force N = 2000 kN. Find the section (h, b, t_w, t_f) minimizing total steel weight.
| Item | Value |
|---|---|
| Steel | Q355 (f = 310 N/mm², f_y = 355 N/mm²), E = 2.06×10⁵ N/mm² |
| Variables | h ∈ [200, 500], b ∈ [150, 200], t_w ∈ [6, 16], t_f ∈ [8, 20] mm |
| PSO settings | pop = 500, max_iter = 300, w = 0.8, c1 = c2 = 1.5 |
Constraints: overall stability φAf ≥ N (class-b buckling curve per GB 50017-2017) · weak-axis slenderness λ_y ≤ 150 · web h₀/t_w ≤ 65√(235/f_y) · flange b/t_f ≤ 13√(235/f_y)
| Optimum | Weight | Stability N_u | λ_y | Web h₀/t_w | Flange b/t_f |
|---|---|---|---|---|---|
| H 500×200×10×20 | 395.64 kg | 2000.6 ≥ 2000 kN ✅ | 86.9 ≤ 150 ✅ | 46.0 ≤ 52.9 ✅ | 10.0 ≤ 10.6 ✅ |
The optimum is constraint-active: the stability capacity N_u = 2000.6 kN just satisfies the 2000 kN demand — the PSO drove the section to the theoretical lightest weight.
PSO convergence curve (left) & optimal H-section diagram (right)
A circular concrete-filled steel tube (CFST) short column, length L = 1.0 m, design axial force N = 4000 kN. Find the outer diameter D and wall thickness t minimizing unit-length cost (steel ¥6500/t + concrete ¥450/m³).
| Item | Value |
|---|---|
| Steel / Concrete | Q355 (f_s = 310 N/mm²) / C30 (f_c = 26.8 N/mm²) |
| Variables | D ∈ [300, 800] mm, t ∈ [6, 20] mm |
| GA settings | pop = 1000, max_iter = 500, prob_mut = 0.1 |
Constraints: axial capacity N_u = 0.9(f_c·A_c + f_s·A_s) ≥ N · diameter-thickness ratio D/t ≤ 100
| Optimum | Unit cost | Capacity N_u | D/t |
|---|---|---|---|
| D = 360 mm, t = 6 mm | ¥383.28 /m | 4155.9 ≥ 4000 kN ✅ | 60 ≤ 100 ✅ |
GA convergence curve (left) & optimal CFST section diagram (right)
| Technique | Detail |
|---|---|
| Penalty function | Quadratic penalty M·g² with M = 10⁶ for each violated normalized constraint; infeasible geometries return 10⁹ directly |
| Normalized constraints | Every constraint scaled by its design value so all violations are comparable |
| Engineering modularity | b/h → multiples of 50 mm; H-section → multiples of 5 mm, integer thicknesses; tube D → multiples of 10 mm |
| Full verification output | Each script re-runs every code check (capacity / slenderness / local stability / ratio) on the optimum and prints pass/fail with margin |
structure-design-optimization/
├── src/
│ ├── task1.py # Task 1: GA — RC beam section optimization
│ ├── task2.py # Task 2: PSO — H-section column optimization
│ └── task3.py # Task 3: GA — CFST column optimization
├── results/
│ ├── Task1.png # GA convergence curve + optimal beam section
│ ├── Task2.png # PSO convergence curve + optimal H-section
│ └── Task3.png # GA convergence curve + optimal CFST section
├── requirements.txt
├── LICENSE
└── README.md / README_zh.md
# 1. Install dependencies (conda or venv recommended)
pip install -r requirements.txt
# 2. Run each task (saves figures to results/ and prints the full verification report)
python src/task1.py # RC beam — GA, ~1 min
python src/task2.py # H column — PSO, ~30 s
python src/task3.py # CFST — GA, ~1 minScripts resolve the
results/path relative to their own location, so they run from any working directory. A laptop CPU is sufficient.
| Package | Purpose |
|---|---|
| numpy | Numerical computation |
| matplotlib | Convergence curves & section diagrams |
| scikit-opt | GA / PSO implementations |
MIT © 2026 Ke Yang (杨珂)