-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathGA.nb
More file actions
1219 lines (1189 loc) · 47 KB
/
GA.nb
File metadata and controls
1219 lines (1189 loc) · 47 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 11.2' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 48017, 1211]
NotebookOptionsPosition[ 45784, 1169]
NotebookOutlinePosition[ 46162, 1185]
CellTagsIndexPosition[ 46119, 1182]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
RowBox[{"Clear", "[", "\"\<Global`*\>\"", "]"}]], "Input",
CellChangeTimes->{{3.7287332911102266`*^9,
3.7287332969867706`*^9}},ExpressionUUID->"2610f62e-af66-410a-afb4-\
8a4d13991f57"],
Cell[BoxData[{
RowBox[{"<<", "NDSolve`FEM`"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"op", "=",
RowBox[{"{",
RowBox[{
RowBox[{
TemplateBox[{RowBox[{"(",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"0", ",",
RowBox[{"-",
FractionBox[
RowBox[{"Y", " ", "\[Nu]"}],
RowBox[{"1", "-",
SuperscriptBox["\[Nu]", "2"]}]]}]}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"-",
FractionBox[
RowBox[{"Y", " ",
RowBox[{"(",
RowBox[{"1", "-", "\[Nu]"}], ")"}]}],
RowBox[{"2", " ",
RowBox[{"(",
RowBox[{"1", "-",
SuperscriptBox["\[Nu]", "2"]}], ")"}]}]]}], ",", "0"}],
"}"}]}], "}"}], ".",
TemplateBox[{
RowBox[{"v", "[",
RowBox[{"x", ",", "y"}], "]"}],
RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}], "Inactive"}, "InactiveGrad",
SyntaxForm -> Del]}], ")"}],RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}],"Inactive"},
"InactiveDiv"], "+",
TemplateBox[{RowBox[{"(",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"-",
FractionBox["Y",
RowBox[{"1", "-",
SuperscriptBox["\[Nu]", "2"]}]]}], ",", "0"}], "}"}], ",",
RowBox[{"{",
RowBox[{"0", ",",
RowBox[{"-",
FractionBox[
RowBox[{"Y", " ",
RowBox[{"(",
RowBox[{"1", "-", "\[Nu]"}], ")"}]}],
RowBox[{"2", " ",
RowBox[{"(",
RowBox[{"1", "-",
SuperscriptBox["\[Nu]", "2"]}], ")"}]}]]}]}], "}"}]}],
"}"}], ".",
TemplateBox[{
RowBox[{"u", "[",
RowBox[{"x", ",", "y"}], "]"}],
RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}], "Inactive"}, "InactiveGrad",
SyntaxForm -> Del]}], ")"}],RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}],"Inactive"},
"InactiveDiv"]}], ",",
RowBox[{
TemplateBox[{RowBox[{"(",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"0", ",",
RowBox[{"-",
FractionBox[
RowBox[{"Y", " ",
RowBox[{"(",
RowBox[{"1", "-", "\[Nu]"}], ")"}]}],
RowBox[{"2", " ",
RowBox[{"(",
RowBox[{"1", "-",
SuperscriptBox["\[Nu]", "2"]}], ")"}]}]]}]}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"-",
FractionBox[
RowBox[{"Y", " ", "\[Nu]"}],
RowBox[{"1", "-",
SuperscriptBox["\[Nu]", "2"]}]]}], ",", "0"}], "}"}]}],
"}"}], ".",
TemplateBox[{
RowBox[{"u", "[",
RowBox[{"x", ",", "y"}], "]"}],
RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}], "Inactive"}, "InactiveGrad",
SyntaxForm -> Del]}], ")"}],RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}],"Inactive"},
"InactiveDiv"], "+",
TemplateBox[{RowBox[{"(",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"-",
FractionBox[
RowBox[{"Y", " ",
RowBox[{"(",
RowBox[{"1", "-", "\[Nu]"}], ")"}]}],
RowBox[{"2", " ",
RowBox[{"(",
RowBox[{"1", "-",
SuperscriptBox["\[Nu]", "2"]}], ")"}]}]]}], ",", "0"}],
"}"}], ",",
RowBox[{"{",
RowBox[{"0", ",",
RowBox[{"-",
FractionBox["Y",
RowBox[{"1", "-",
SuperscriptBox["\[Nu]", "2"]}]]}]}], "}"}]}], "}"}], ".",
TemplateBox[{
RowBox[{"v", "[",
RowBox[{"x", ",", "y"}], "]"}],
RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}], "Inactive"}, "InactiveGrad",
SyntaxForm -> Del]}], ")"}],RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}],"Inactive"},
"InactiveDiv"]}]}], "}"}]}], ";"}], "\n",
RowBox[{
RowBox[{"a", "=", "1.0"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"reg1", "=",
RowBox[{"Rectangle", "[",
RowBox[{
RowBox[{"{",
RowBox[{"0", ",", "0"}], "}"}], ",",
RowBox[{"{",
RowBox[{"30", ",", "10"}], "}"}]}], "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"mesh", "=",
RowBox[{"ToElementMesh", "[",
RowBox[{"reg1", ",",
RowBox[{"\"\<MaxCellMeasure\>\"", "\[Rule]", "1"}], ",",
RowBox[{"\"\<MeshOrder\>\"", "\[Rule]", "1"}], ",",
RowBox[{"\"\<MeshElementType\>\"", "\[Rule]", "TriangleElement"}], ",",
RowBox[{
"\"\<BoundaryMeshGenerator\>\"", "\[Rule]", "\"\<RegionPlot\>\""}]}],
"]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.712389939624528*^9, 3.7123899645091257`*^9}, {
3.7222619541961575`*^9, 3.7222619545776377`*^9}, {3.7287208844999633`*^9,
3.72872092891903*^9}, 3.728721102439046*^9, {3.728741604767667*^9,
3.7287416339079185`*^9}, {3.728741712692164*^9, 3.7287417134501123`*^9}, {
3.728805158843395*^9,
3.7288051761880255`*^9}},ExpressionUUID->"0fc6a1c9-b5eb-4020-8eca-\
7c024bc196d4"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Show", "[",
RowBox[{
RowBox[{"mesh", "[", "\"\<Wireframe\>\"", "]"}], ",",
RowBox[{"Axes", "->", "True"}], ",",
RowBox[{"AxesLabel", "\[Rule]",
RowBox[{"{",
RowBox[{"\"\<X\>\"", ",", "\"\<Y\>\""}], "}"}]}]}], "]"}]], "Input",Expre\
ssionUUID->"a7d899b0-33f5-4fd4-a555-6749f8288142"],
Cell[BoxData[
GraphicsBox[
{EdgeForm[GrayLevel[0]], FaceForm[None], GraphicsComplexBox[CompressedData["
1:eJyNl3k81Pkfx90UJoY5MBhjECZmhmEOzKv70KHbJtF9Lm3bVorowGaXyqYt
pfRoK3SxlRSbjk3XVq5sqzspSY6yiNRvjK/v+s5fv8/D4/F9PL1f7+Pz/ny+
n898HeZFTlmoo6WlxdfW0up5jk3lq/60oUWMXm5Rav1fo1VDpwcq0zTYUoOt
NNiOynEOGnY+wY3KIAp/oXKcAah2GpUv06kcx6QyrDX87aj8nKsRj0flTL5G
fGcqhw/WyOdGZa5AI7+HRn5PDRZSuVSkUZ+YyrleGvV6U3mHRKN+Hyqv9NWY
j5TKQTKN+cmpLFRozNePymb+JEvUzwCS1xHcW5cDlVXrRGUrDbbUYJoG62lw
3/7uYy0t9evh4E9yD44d5kdy/reP8r+dryBZ/T5tlZP8uEdwREZyhEr+qERK
snrU+VLzDfiP1fncfKj5AiUkj+lxWOFNck/4/GQvar5TYmo+1X6h5GsRUvPR
/+MVPf6LPEje2SPIFlDreedGcnXPP4a4kvy1Z0S6UOP/7kStv9WR5J5wj3x4
1PqiuNR61thS83f9d66o88UyqfH1LDTmN4jqb2NEsnpk6qFbdtvGMK9Dqfb3
toeRvJf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dZaHZY0B
1JiejiN39q7iTucNQI3pKj+7W3PoT9dHyI2sQ4yvkHPwbYdcrHU+fWpsjdxD
9wL1w8eyJr4hB5vIz27uN939e6nv/1T67kw=
"]]]},
Axes->True,
AxesLabel->{
FormBox["\"X\"", TraditionalForm],
FormBox["\"Y\"", TraditionalForm]}]], "Output",
CellChangeTimes->{
3.728805070312895*^9, {3.728805160888959*^9,
3.7288051775056744`*^9}},ExpressionUUID->"555b43f2-36ff-48c8-997c-\
3d96dc099ac6"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
SubscriptBox["\[CapitalGamma]", "Du"], "=",
RowBox[{"DirichletCondition", "[",
RowBox[{
RowBox[{
RowBox[{"u", "[",
RowBox[{"x", ",", "y"}], "]"}], "\[Equal]", "0."}], ",",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"y", "\[Equal]", "10."}], "&&",
RowBox[{"5.", ">", "x", ">", "0."}]}], ")"}], "||",
RowBox[{"(",
RowBox[{
RowBox[{"y", "\[Equal]", "10."}], "&&",
RowBox[{"30.", ">", "x", ">", "25."}]}], ")"}]}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
SubscriptBox["\[CapitalGamma]", "Dv"], "=",
RowBox[{"DirichletCondition", "[",
RowBox[{
RowBox[{
RowBox[{"v", "[",
RowBox[{"x", ",", "y"}], "]"}], "\[Equal]", "0."}], ",",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"y", "\[Equal]", "10."}], "&&",
RowBox[{"5.", ">", "x", ">", "0."}]}], ")"}], "||",
RowBox[{"(",
RowBox[{
RowBox[{"y", "\[Equal]", "10."}], "&&",
RowBox[{"30.", ">", "x", ">", "25."}]}], ")"}]}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
SubscriptBox["\[CapitalGamma]", "Nv"], "=",
RowBox[{"NeumannValue", "[",
RowBox[{
RowBox[{"-", "1."}], ",",
RowBox[{
RowBox[{"16.", ">=", "x", "\[GreaterEqual]", "14."}], "&&",
RowBox[{"y", "\[Equal]", "10."}]}]}], "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"op1", "=",
RowBox[{"op", "/.",
RowBox[{"{",
RowBox[{
RowBox[{"Y", "\[Rule]", "3000."}], ",",
RowBox[{"\[Nu]", "\[Rule]", "0.33"}]}], "}"}]}]}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"{", "state", "}"}], "=",
RowBox[{"NDSolve`ProcessEquations", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"op1", "\[Equal]",
RowBox[{"{",
RowBox[{"0.", ",",
SubscriptBox["\[CapitalGamma]", "Nv"]}], "}"}]}], ",",
SubscriptBox["\[CapitalGamma]", "Du"], ",",
SubscriptBox["\[CapitalGamma]", "Dv"]}], "}"}], ",",
RowBox[{"{",
RowBox[{"u", ",", "v"}], "}"}], ",",
RowBox[{
RowBox[{"{",
RowBox[{"x", ",", "y"}], "}"}], "\[Element]", "mesh"}]}], "]"}]}],
";"}], "\n",
RowBox[{
RowBox[{"femdata", "=",
RowBox[{"state", "[", "\"\<FiniteElementData\>\"", "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"pded", "=",
RowBox[{"femdata", "[", "\"\<PDECoefficientData\>\"", "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"bcd", "=",
RowBox[{"femdata", "[", "\"\<BoundaryConditionData\>\"", "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"md", "=",
RowBox[{"femdata", "[", "\"\<FEMMethodData\>\"", "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"sd", "=",
RowBox[{
RowBox[{"state", "[", "\"\<SolutionData\>\"", "]"}], "[",
RowBox[{"[", "1", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"vd", "=",
RowBox[{"state", "[", "\"\<VariableData\>\"", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"discretePDE", "=",
RowBox[{"DiscretizePDE", "[",
RowBox[{"pded", ",", "md", ",", "sd"}], "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{"load", ",", "stiffness", ",", "damping", ",", "mass"}], "}"}],
"=",
RowBox[{"discretePDE", "[", "\"\<SystemMatrices\>\"", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"discreteBCs", "=",
RowBox[{"DiscretizeBoundaryConditions", "[",
RowBox[{"bcd", ",", "md", ",", "sd"}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"ele", "=",
RowBox[{"DiscretizePDE", "[",
RowBox[{"pded", ",", "md", ",", "sd", ",",
RowBox[{"\"\<SaveFiniteElements\>\"", "\[Rule]", "True"}]}], "]"}]}],
";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{"stiffnessElements", ",", "nonzeroPos"}], "}"}], "=",
RowBox[{"ele", "[", "\"\<StiffnessElements\>\"", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"density", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"\[Rho]", "[", "i", "]"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"Length", "@", "stiffnessElements"}]}], "}"}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"modifiedElements", "=",
RowBox[{
RowBox[{"(",
RowBox[{"density", "^", "1"}], ")"}], "*", "stiffnessElements"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{"Length", "@", "stiffnessElements"}], "\n",
RowBox[{
RowBox[{"dof", "=",
RowBox[{"md", "[", "\"\<DegreesOfFreedom\>\"", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"inci", "=",
RowBox[{"Join", "@@",
RowBox[{"md", "[", "\"\<Incidents\>\"", "]"}]}]}], ";"}], "\n",
RowBox[{
RowBox[{"modifiedstiffness", "=",
RowBox[{"AssembleMatrix", "[",
RowBox[{
RowBox[{"{",
RowBox[{"inci", ",", "inci"}], "}"}], ",", "modifiedElements", ",",
RowBox[{"{",
RowBox[{"dof", ",", "dof"}], "}"}], ",",
RowBox[{"\"\<Sparse\>\"", "\[Rule]", "nonzeroPos"}]}], "]"}]}],
";"}], "\n",
RowBox[{
RowBox[{"displacement", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"\[Delta]", "[", "i", "]"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"Length", "[", "stiffness", "]"}]}], "}"}]}], "]"}]}],
";"}], "\n",
RowBox[{
RowBox[{"coords", "=",
RowBox[{"mesh", "[", "\"\<Coordinates\>\"", "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"elems", "=",
RowBox[{"mesh", "[", "\"\<MeshElements\>\"", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"DeployBoundaryConditions", "[",
RowBox[{
RowBox[{"{",
RowBox[{"load", ",", "stiffness"}], "}"}], ",", "discreteBCs"}], "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"DeployBoundaryConditions", "[",
RowBox[{
RowBox[{"{",
RowBox[{"load", ",", "modifiedstiffness"}], "}"}], ",", "discreteBCs"}],
"]"}], ";"}], "\n",
RowBox[{
RowBox[{"loadF", "=",
RowBox[{"mloadF", "=",
RowBox[{"Flatten", "[", "load", "]"}]}]}], ";"}], "\n",
RowBox[{
RowBox[{"square", "=",
RowBox[{"Join", "@@",
RowBox[{"mesh", "[", "\"\<MeshElementMeasure\>\"", "]"}]}]}], ";"}], "\n",
RowBox[{
RowBox[{"goalFunction", "=",
RowBox[{"loadF", ".", "displacement"}]}], ";"}], "\n",
RowBox[{
RowBox[{"massEquation", "=",
RowBox[{
RowBox[{
UnderoverscriptBox["\[Sum]",
RowBox[{"k", "=", "1"}],
RowBox[{"Length", "[", "square", "]"}]],
RowBox[{
RowBox[{
"square", "\[LeftDoubleBracket]", "k", "\[RightDoubleBracket]"}], " ",
RowBox[{
"density", "\[LeftDoubleBracket]", "k", "\[RightDoubleBracket]"}]}]}],
"\[LessEqual]",
RowBox[{
RowBox[{"(",
RowBox[{
UnderoverscriptBox["\[Sum]",
RowBox[{"k", "=", "1"}],
RowBox[{"Length", "[", "square", "]"}]],
RowBox[{
"square", "\[LeftDoubleBracket]", "k", "\[RightDoubleBracket]"}]}],
")"}], " ", "0.5"}]}]}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"densityEq", "=",
RowBox[{"Thread", "[",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"0.", "\[LessEqual]", "#1", "\[LessEqual]", "1."}], "&"}],
")"}], "[", "density", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{"densityEq", "=",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"0.9", "\[LessEqual]", "#1", "\[LessEqual]", "1"}], "||",
RowBox[{"0.0", "\[LessEqual]", "#1", "\[LessEqual]", "0.1"}]}],
")"}], "&"}], "/@", "density"}]}], ";"}], "*)"}]}], "\n",
RowBox[{
RowBox[{"equation", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{
"modifiedstiffness", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], ".", "displacement"}], "\[Equal]",
RowBox[{
"loadF", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}]}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"Length", "[", "displacement", "]"}]}], "}"}]}], "]"}]}],
";"}], "\n",
RowBox[{
RowBox[{"sysOfEq", "=",
RowBox[{"Flatten", "[",
RowBox[{"{",
RowBox[{
"goalFunction", ",", "massEquation", ",", "equation", ",", "densityEq"}],
"}"}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"sysOfEq", "//", "Length"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"variables", "=",
RowBox[{"Flatten", "[",
RowBox[{"{",
RowBox[{"density", ",", "displacement"}], "}"}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"variables", "//", "Length"}], ";"}], "\n",
RowBox[{
RowBox[{"initDis", "=",
RowBox[{"Thread", "[",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{"#", ",", "0"}], "}"}], "&"}], "[", "displacement", "]"}],
"]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"initDen", "=",
RowBox[{"Thread", "[",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{"#", ",", "0.5"}], "}"}], "&"}], "[", "density", "]"}],
"]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"initCond", "=",
RowBox[{"Flatten", "[",
RowBox[{
RowBox[{"{",
RowBox[{"initDen", ",", "initDis"}], "}"}], ",", "1"}], "]"}]}],
";"}], "\[IndentingNewLine]"}], "Input",
CellChangeTimes->{{3.712413614563281*^9, 3.7124136380346756`*^9}, {
3.7124153413655424`*^9, 3.712415346456874*^9}, {3.712488429985041*^9,
3.7124884413616447`*^9}, {3.7125989052122765`*^9, 3.712598911808919*^9}, {
3.714285022166212*^9, 3.7142850312456536`*^9}, {3.7143049808837204`*^9,
3.7143050233208923`*^9}, {3.7143068291511054`*^9, 3.714306892424056*^9}, {
3.714306932797784*^9, 3.714306949629737*^9}, {3.7155083602707653`*^9,
3.7155083854457827`*^9}, {3.71779070286635*^9, 3.7177907804450073`*^9}, {
3.719503705121543*^9, 3.719503733755872*^9}, {3.7223513900717287`*^9,
3.7223515198306513`*^9}, 3.7223518743312254`*^9, {3.7223520056510754`*^9,
3.7223520350018835`*^9}, {3.7223523312974453`*^9,
3.7223523330005765`*^9}, {3.7226970785053453`*^9, 3.722697103160796*^9}, {
3.722771005467366*^9, 3.722771060536585*^9}, {3.722773237136078*^9,
3.7227732388642397`*^9}, {3.7227740615924025`*^9,
3.7227740633360925`*^9}, {3.7227748737239227`*^9, 3.722774882498906*^9}, {
3.7227776226707983`*^9, 3.7227776255003405`*^9}, {3.722778257391071*^9,
3.722778261778558*^9}, 3.7287210046248193`*^9, {3.728721069399888*^9,
3.72872108839266*^9}, {3.7287213979658422`*^9, 3.7287214027448215`*^9}, {
3.7288050618663125`*^9,
3.7288050622938504`*^9}},ExpressionUUID->"2f97ae77-6ad9-42ff-916f-\
964b27a613e0"],
Cell[BoxData["500"], "Output",
CellChangeTimes->{{3.7288051625340185`*^9,
3.728805179173874*^9}},ExpressionUUID->"5004f430-7396-49d6-b744-\
4c4ae96e1bca"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"NMinimize", "[",
RowBox[{"sysOfEq", ",", "variables", ",",
RowBox[{"Method", "->", "\"\<NelderMead\>\""}]}], "]"}]], "Input",
CellChangeTimes->{{3.728805077704158*^9, 3.7288051489129543`*^9}, {
3.72880535116226*^9, 3.728805354185046*^9}, {3.728805417935913*^9,
3.728805421935769*^9}, {3.7288113065771513`*^9, 3.7288113100224667`*^9}, {
3.7288125463536696`*^9,
3.7288125492422876`*^9}},ExpressionUUID->"ef2173b4-e452-4a82-b7f0-\
a92afa33496e"],
Cell[BoxData["$Aborted"], "Output",
CellChangeTimes->{3.7288053475186944`*^9, 3.728811300912052*^9,
3.728812543970682*^9,
3.728813105331592*^9},ExpressionUUID->"c9d0a334-e15c-46bd-80b4-\
092f035d6022"]
}, Open ]],
Cell[CellGroupData[{
Cell["Darwinistic Algorithm", "Subsubsection",
CellChangeTimes->{{3.7288041343914576`*^9,
3.7288041469674034`*^9}},ExpressionUUID->"156dc4af-6623-4bcb-907a-\
d9bf8eb7b733"],
Cell[BoxData[
RowBox[{
RowBox[{"(*",
RowBox[{"Seed", " ", "the", " ", "population"}], "*)"}], "\n",
RowBox[{
RowBox[{
RowBox[{"amount", "=", "30"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"count", "=",
RowBox[{"Length", "@", "stiffnessElements"}]}], ";"}], "\n",
RowBox[{
RowBox[{"pop", "=",
RowBox[{"RandomReal", "[",
RowBox[{
RowBox[{"{",
RowBox[{"0", ",", "1"}], "}"}], ",",
RowBox[{"{",
RowBox[{"amount", ",", "count"}], "}"}]}], "]"}]}], ";"}], "\n",
RowBox[{"(*", "Crossover", "*)"}], "\n",
RowBox[{
RowBox[{
RowBox[{"cross", "[",
RowBox[{"list1_List", ",", "list2_List"}], "]"}], ":=",
RowBox[{
RowBox[{
RowBox[{"RandomChoice", "[",
RowBox[{"{",
RowBox[{
RowBox[{"list1", "[",
RowBox[{"[", "#", "]"}], "]"}], ",",
RowBox[{"list2", "[",
RowBox[{"[", "#", "]"}], "]"}]}], "}"}], "]"}], "&"}], "/@",
RowBox[{"Range", "[", "count", "]"}]}]}], ";"}], "\n",
RowBox[{
RowBox[{"geneData", "=",
RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"mut", ":=",
RowBox[{"RandomReal", "[",
RowBox[{"{",
RowBox[{"0.", ",", "0.5"}], "}"}], "]"}]}], ";"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"mutn", ":=",
RowBox[{"RandomInteger", "[",
RowBox[{
RowBox[{"{",
RowBox[{"1", ",", "count"}], "}"}], ",", "2"}], "]"}]}],
";"}]}]}]], "Input",
CellChangeTimes->{{3.7287215484088306`*^9, 3.728721553200827*^9}, {
3.7287266021793776`*^9, 3.7287266050089197`*^9}, 3.728726656551982*^9,
3.7287267903917947`*^9, {3.7287268234461637`*^9, 3.7287269079768076`*^9},
3.72872696243697*^9, {3.7287270182998877`*^9, 3.728727036590705*^9}, {
3.7287270703008957`*^9, 3.728727129710144*^9}, {3.728727530424677*^9,
3.728727532162853*^9}, {3.7287275734024687`*^9, 3.7287275796182485`*^9}, {
3.728727744049049*^9, 3.7287277530245295`*^9}, {3.728727801760527*^9,
3.7287278035282555`*^9}, 3.728727964760606*^9, {3.728728348925788*^9,
3.7287283866979637`*^9}, {3.7287284188356795`*^9, 3.7287284266825*^9}, {
3.728728459365909*^9, 3.7287284857329082`*^9}, {3.7287286338751616`*^9,
3.7287286520334616`*^9}, {3.7287287273597383`*^9, 3.7287287426894927`*^9},
3.7287287876560335`*^9, {3.72872885606415*^9, 3.7287289159295125`*^9}, {
3.728728958532835*^9, 3.728728964900722*^9}, 3.7287290180945683`*^9, {
3.728733409460539*^9, 3.728733410113356*^9}, {3.7287416468287287`*^9,
3.728741647036991*^9}, {3.7287418344719777`*^9,
3.7287418356424437`*^9}},ExpressionUUID->"de394f3c-7fea-4ae5-bc70-\
c9aa47139f38"],
Cell[BoxData[
RowBox[{"For", "[",
RowBox[{
RowBox[{"k", "=", "1"}], ",",
RowBox[{"k", "\[LessEqual]", "3000"}], ",",
RowBox[{"k", "++"}], ",", "\n",
RowBox[{"(*", "Mutation", "*)"}], "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{"popn", "=",
RowBox[{"RandomInteger", "[",
RowBox[{"{",
RowBox[{"1", ",", "amount"}], "}"}], "]"}]}], ";"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{"Divisible", "[",
RowBox[{
RowBox[{"RandomInteger", "[",
RowBox[{"{",
RowBox[{"1", ",", "5"}], "}"}], "]"}], ",", "5"}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"For", "[",
RowBox[{
RowBox[{"n", "=", "1"}], ",",
RowBox[{"n", "\[LessEqual]",
RowBox[{
RowBox[{"amount", "/", "2"}], "-", "1"}]}], ",",
RowBox[{"n", "++"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"pop", "[",
RowBox[{"[",
RowBox[{
RowBox[{"n", "+",
RowBox[{"Floor", "[",
RowBox[{"amount", "/", "2"}], "]"}]}], ",",
RowBox[{"mutn", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "]"}], ",",
RowBox[{"pop", "[",
RowBox[{"[",
RowBox[{
RowBox[{"n", "+",
RowBox[{"Floor", "[",
RowBox[{"amount", "/", "2"}], "]"}]}], ",",
RowBox[{"mutn", "[",
RowBox[{"[", "2", "]"}], "]"}]}], "]"}], "]"}]}], "}"}], "=",
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{"pop", "[",
RowBox[{"[",
RowBox[{
RowBox[{"n", "+",
RowBox[{"Floor", "[",
RowBox[{"amount", "/", "2"}], "]"}]}], ",",
RowBox[{"mutn", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "]"}], "+",
"mut"}], ",",
RowBox[{
RowBox[{"pop", "[",
RowBox[{"[",
RowBox[{
RowBox[{"n", "+",
RowBox[{"Floor", "[",
RowBox[{"amount", "/", "2"}], "]"}]}], ",",
RowBox[{"mutn", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "]"}], "-",
"mut"}]}], "}"}]}], ";"}]}], "\[IndentingNewLine]", "]"}],
";"}]}], "\[IndentingNewLine]", "]"}], ";", "\n",
RowBox[{"(*", "Selection", "*)"}], "\n",
RowBox[{"rules", "=",
RowBox[{
RowBox[{
RowBox[{"Thread", "[",
RowBox[{"density", "\[Rule]",
RowBox[{"pop", "[",
RowBox[{"[", "#", "]"}], "]"}]}], "]"}], "&"}], "/@",
RowBox[{"Range", "[", "amount", "]"}]}]}], ";", "\n",
"\[IndentingNewLine]",
RowBox[{"sel", "=",
RowBox[{"Reap", "[", "\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{"j", "=", "1"}], ",",
RowBox[{"j", "\[LessEqual]", "amount"}], ",",
RowBox[{"j", "++"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"Evaluate", "[",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"\[Rho]", "[", "i", "]"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"Length", "@", "stiffnessElements"}]}], "}"}]}], "]"}],
"]"}], "=",
RowBox[{"density", "/.",
RowBox[{"rules", "[",
RowBox[{"[", "j", "]"}], "]"}]}]}], ";", "\[IndentingNewLine]",
RowBox[{"sol", "=",
RowBox[{"LinearSolve", "[",
RowBox[{"modifiedstiffness", ",", "load"}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Sow", "[",
RowBox[{"Abs", "[",
RowBox[{
RowBox[{"Flatten", "[", "load", "]"}], ".",
RowBox[{"Flatten", "[", "sol", "]"}]}], "]"}], "]"}], ";",
"\[IndentingNewLine]",
RowBox[{"Clear", "[", "\[Rho]", "]"}]}]}], "\[IndentingNewLine]",
"]"}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"objpop", "=",
RowBox[{"Transpose", "[",
RowBox[{"{",
RowBox[{
RowBox[{"sel", "[",
RowBox[{"[",
RowBox[{"2", ",", "1"}], "]"}], "]"}], ",", "pop"}], "}"}], "]"}]}],
";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"Divisible", "[",
RowBox[{"k", ",", "10"}], "]"}], ",",
RowBox[{"Print", "[",
RowBox[{"Min", "[",
RowBox[{"sel", "[",
RowBox[{"[",
RowBox[{"2", ",", "1"}], "]"}], "]"}], "]"}], "]"}]}], "]"}], ";",
"\[IndentingNewLine]",
RowBox[{"newpop", "=",
RowBox[{
RowBox[{"Transpose", "[",
RowBox[{"TakeSmallestBy", "[",
RowBox[{"objpop", ",", "First", ",",
RowBox[{"Round", "[",
RowBox[{"amount", "/", "2"}], "]"}]}], "]"}], "]"}], "[",
RowBox[{"[", "2", "]"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"newpop", "=",
RowBox[{"Select", "[",
RowBox[{"newpop", ",",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"Max", "[", "#", "]"}], "<=", "1.01"}], "&&",
RowBox[{
RowBox[{"Min", "[", "#", "]"}], ">", "0"}]}], "&"}]}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"newpop", "=",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"#", "/",
RowBox[{"Mean", "[", "#", "]"}]}], ")"}], "&"}], "/@", "newpop"}],
")"}], "*", "0.5"}]}], ";", "\[IndentingNewLine]",
RowBox[{"newpop2", "=",
RowBox[{
RowBox[{"Apply", "[",
RowBox[{
RowBox[{"cross", "[",
RowBox[{"#1", ",", "#2"}], "]"}], "&"}], "]"}], "/@",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"RandomChoice", "[",
RowBox[{"newpop", ",", "2"}], "]"}], ",",
RowBox[{"amount", "-",
RowBox[{"Length", "[", "newpop", "]"}]}]}], "]"}]}]}], ";",
"\[IndentingNewLine]",
RowBox[{"pop", "=",
RowBox[{"Join", "[",
RowBox[{"newpop", ",", "newpop2"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"AppendTo", "[",
RowBox[{"geneData", ",", "pop"}], "]"}], ";"}]}], "\[IndentingNewLine]",
"]"}]], "Input",
CellChangeTimes->{{3.7287215484088306`*^9, 3.728721553200827*^9}, {
3.7287266021793776`*^9, 3.7287266050089197`*^9}, 3.728726656551982*^9,
3.7287267903917947`*^9, {3.7287268234461637`*^9, 3.7287269079768076`*^9},
3.72872696243697*^9, {3.7287270182998877`*^9, 3.728727036590705*^9}, {
3.7287270703008957`*^9, 3.728727129710144*^9}, {3.728727530424677*^9,
3.728727532162853*^9}, {3.7287275734024687`*^9, 3.7287275796182485`*^9}, {
3.728727744049049*^9, 3.7287277530245295`*^9}, {3.728727801760527*^9,
3.7287278035282555`*^9}, 3.728727964760606*^9, {3.728728348925788*^9,
3.7287283866979637`*^9}, {3.7287284188356795`*^9, 3.7287284266825*^9}, {
3.728728459365909*^9, 3.7287284857329082`*^9}, {3.7287286338751616`*^9,
3.7287286520334616`*^9}, {3.7287287273597383`*^9, 3.7287287426894927`*^9},
3.7287287876560335`*^9, {3.72872885606415*^9, 3.7287289179610558`*^9}, {
3.7287289767725787`*^9, 3.728729002958626*^9}, {3.728729064895277*^9,
3.7287290879031053`*^9}, {3.7287292279780693`*^9, 3.728729228525751*^9}, {
3.7287294680543404`*^9, 3.7287294719001513`*^9}, 3.728729584726367*^9, {
3.7287299583982325`*^9, 3.7287299848792305`*^9}, {3.7287304804492493`*^9,
3.7287305181560974`*^9}, {3.7287305510795426`*^9,
3.7287305517313585`*^9}, {3.728731565081108*^9, 3.7287316170707846`*^9}, {
3.7287316492700863`*^9, 3.7287316578037653`*^9}, {3.728731712789806*^9,
3.7287317160188465`*^9}, {3.728732405442728*^9, 3.728732406829463*^9},
3.7287324737902713`*^9, 3.7287333542574453`*^9, {3.72873342568184*^9,
3.7287334280653644`*^9}, {3.7287334919433146`*^9, 3.728733520495778*^9},
3.7287335613439035`*^9, {3.7287336666435966`*^9, 3.7287336954979863`*^9}, {
3.728733993031863*^9, 3.7287340104712696`*^9}, {3.7287342039586*^9,
3.728734247553917*^9}, 3.7287355721891737`*^9, {3.728741740826374*^9,
3.7287417935878344`*^9}, {3.728741832049949*^9, 3.7287418332033925`*^9},
3.7287418687088327`*^9, {3.72874200464814*^9, 3.7287420053219805`*^9}, {
3.7287460388524723`*^9, 3.7287460730010123`*^9}, {3.7287470404360657`*^9,
3.7287470407543697`*^9}, {3.7287471278102803`*^9, 3.7287471747396708`*^9},
3.728748968493466*^9},ExpressionUUID->"536700bb-9004-4fd5-bd29-\
22e7b01616ef"],
Cell[BoxData[
RowBox[{"newpop2", "//", "Length"}]], "Input",
CellChangeTimes->{{3.728741939013402*^9,
3.728741966785748*^9}},ExpressionUUID->"d95f0915-3254-4041-8c3a-\
dfc34834d461"],
Cell[BoxData[
RowBox[{"geneData", "//", "Length"}]], "Input",
CellChangeTimes->{{3.7287432636398644`*^9,
3.728743278086831*^9}},ExpressionUUID->"1077c491-4b5c-4e7e-af6e-\
f17bc91c7aae"],
Cell[BoxData[{
RowBox[{
RowBox[{"imagedata", "=",
RowBox[{
RowBox[{"Transpose", "[", "geneData", "]"}], "[",
RowBox[{"[", "1", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"animdata", "=",
RowBox[{"{", "}"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.728743289935294*^9, 3.72874329385341*^9}, {
3.728743632131178*^9, 3.7287436375398397`*^9}, {3.728744181884326*^9,
3.728744187709267*^9}, {3.728745128877624*^9,
3.7287451319102144`*^9}},ExpressionUUID->"19fa83bd-5896-405e-813d-\
b874dba3846d"],
Cell[BoxData[
RowBox[{"For", "[",
RowBox[{
RowBox[{"i", "=", "1"}], ",",
RowBox[{"i", "\[LessEqual]",
RowBox[{"Length", "[", "imagedata", "]"}]}], ",",
RowBox[{"i", "=",
RowBox[{"i", "+", "100"}]}], ",", "\n",
RowBox[{
RowBox[{"polys", "=",
RowBox[{
RowBox[{
RowBox[{"Polygon", "[", "#", "]"}], "&"}], "/@",
RowBox[{"(", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Apply", "[",
RowBox[{