-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.m
65 lines (47 loc) · 1.56 KB
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
% GENERATIVE TRUSS DESIGN
% FOR SUPPORT-FREE FDM
% * * * * * * * * * * * *
% Developed June 2020
% by Henrik S . Forberg
clear all;
% Program parameters
FDM = 1; % Support-Free (0/1)
v = 0; % Visualize evolution
p = 2; % Specify parpool size
mx = 6; % Number of saved candidates
h = 12; % Model height
s = 100; % Model scale
% NSGA-II Hyperparameters
pop = 10000; % Population size
sel = 1000; % Selection number
gen = 200; % Number of generations
e_m = 0.40; % Edge-mutation rate
n_m = 0.10; % Node-mutation rate
n_g = 0.40; % Node-generation rate
crs = 0.10; % Crossover rate
% MSAA Hyperparameters
tmp = 10; % Temperature
stp = tmp/10; % Step size
% * Initialize half-octahedron seed by matrices N and E
% N: Node coordinate array
% n node indexes, n * [x, y, z]
N = [4.5 4.5 1;
4.5 -4.5 1;
-4.5 -4.5 1;
-4.5 4.5 1;
0 0 h];
N = N.*s;
% E: Edge array
% represents beams (edges) by pairs of node indexes from N
E = [1 2 3 4 1 2 3 4 ;
2 3 4 1 5 5 5 5];
% Start parpool on local
delete(gcp('nocreate'));
parpool('local',p);
warning('off');
clc;
% Start truss topology synthesis and shape optimization model
[N_F, E_F, d_f] = nsga_2(FDM, N, E, s, v,...
pop, gen, sel, e_m, n_m, n_g, crs, mx);
[N_F, E_F] = msaa(FDM, N_F, E_F, tmp, stp, s, d_f);