-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenetic-algos.html
More file actions
4798 lines (4503 loc) · 211 KB
/
Copy pathgenetic-algos.html
File metadata and controls
4798 lines (4503 loc) · 211 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
<!doctype html>
<html lang="en">
<head>
<!--
Need to look at WHY this doesn't render to PDF properly with
the version of Reveal.JS from 2023-04, nor 2025-03,
but is fine with 2020-11!
-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Genetic Algorithms</title>
<link rel="stylesheet" href="reveal/dist/reset.css">
<link rel="stylesheet" href="reveal/dist/reveal.css">
<link rel="stylesheet" href="reveal/dist/theme/black.css" id="theme">
<link rel="stylesheet" href="genetic-algos.css">
<link rel="stylesheet" href="reveal/plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>Tight Genes:</h1>
<h2>Intro to Genetic Algorithms</h2>
<h4>by Dave Aronson</h4>
T.Rex-20<span data-gv-var="year"></span>@Codosaur.us<br>
twitter.com/DaveAronson<br>
linkedin.com/in/DaveAronson<br>
github.com/CodosaurusLLC/tight-genes
<aside class="notes">
NOTE TO SELF: click on timer to reset it at the start<br>
<span data-human-lang="english">
Current time: ~80, speaking medium, w/ a few ad-libs and water breaks.<br>
SDD wants 80-85, so leave as-is, but SPEAK MEDIUM-SLOW!!!
</span>
<span data-human-lang="lithuanian">
Current time: ~37,
speaking medium/fast, with lots of ad-libs.<br>
DDEU wants 45, leave ~5-10 for Q&A, so net 35-40,
seems about right, SLOW DOWN but use fewer ad-libs.
</span>
</aside>
</section>
<section>
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<span data-human-lang="spanish">¡Hola, Málaga!</span>
<span data-human-lang="dutch">Hallo, Utrecht!</span>
<span data-human-lang="lithuanian">Sveiki, Vilniau!</span>
<span data-human-lang="greek" lang="el">Γεια σας, Αθήνα!</span>
<span data-human-lang="norwegian">Hei, Oslo!</span>
<span data-human-lang="portuguese">Olá, Coimbra!</span>
</div>
<div class="half vctring" style="font-size: 6em">👋</div>
<div class="qtr vctring" style="font-size: 1.5em" data-not-if-human-lang="english">
<div>(Hello, <span data-gv-var="city-en"></span>!)</div>
</div>
<div style="display: none" data-human-lang="english" data-gv-var="city-en">
</div>
</div>
<span class="slide-caption">Image: standard emoji</span>
<aside class="notes">
<div data-human-lang="lithuanian">SveikEE VILnio!</div>
<div data-human-lang="dutch">haLLO uTREKHT!</div>
<div data-human-lang="greek">Ya Sas, AhTHEEna!</div>
<div data-human-lang="norwegian">Hi, osLO!</div>
<div data-human-lang="english">Good morning, Singapore!</div>
</aside>
</section>
<!--
<section data-human-lang="english">
<div class="all">
<img data-gv-var="city-en" src="images/london.png">
</div>
<span class="slide-caption">Image: https://www.pexels.com/photo/london-from-the-river-27585634/</span>
<aside class="notes"><span data-gv-var="city-en"></span>!</aside>
</section>
-->
<section>
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<div>
<span data-human-lang="lithuanian">Aš esu Dave Aronson,</span>
<span data-human-lang="spanish">Me llamo</span>
<span data-human-lang="dutch">Ik ben</span>
<span data-human-lang="greek" lang="el">Είμαι ο</span>
<span data-human-lang="norwegian">Jeg er</span>
<span data-human-lang="portuguese">Eu sou</span>
</div>
</div>
<div class="half vctring">
<img src="images/Dave-Aronson-Speaking-at-JSConf-Hawaii-1kx1k.jpg">
</div>
<div class="qtr vctring" style="font-size: 1.5em" data-not-if-human-lang="english">
(I'm Dave Aronson,)
</div>
</div>
<span class="slide-caption">Image: me speaking at JSConf Hawai'i 2020!</span>
<aside class="notes">
<span data-human-lang="lithuanian">AHSH EHsoo</span>
<span data-human-lang="dutch">Ik ben</span>
<span data-human-lang="greek">eeMAY o</span>
<span data-human-lang="norwegian">Yai ar</span>
<span data-human-lang="english">I'm</span>
Dave Aronson,
</aside>
</section>
<section>
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<span data-human-lang="lithuanian">T. Reksas iš Codosaurus,</span>
<span data-human-lang="spanish">el T. Rex de Codosaurus,</span>
<span data-human-lang="dutch">de T. Rex van Codosaurus,</span>
<span data-human-lang="greek" lang="el">ο T. Rex του Codosaurus,</span>
<span data-human-lang="norwegian">T. Rex fra Codosaurus,</span>
<span data-human-lang="portuguese">o T. Rex de Codosaurus,</span>
</div>
<div class="half vctring">
<img src="images/CodoLogo-from-EPS.png" class="expand-tall">
</div>
<div class="qtr vctring" style="font-size: 1.5em" data-not-if-human-lang="english">
(the T. Rex of Codosaurus,)
</div>
</div>
<span class="slide-caption">Image: my company logo!</span>
<aside class="notes">
<span data-human-lang="lithuanian">teeRANnoSOWrus RRREKsas ish Codosowrus,</span>
<span data-human-lang="dutch">deh Tay Rrrex fon Codosowrus</span>
<span data-human-lang="greek">o T. Rex tu Codosaurus,</span>
<span data-human-lang="norwegian">Tay Rex fra Codosowroos,</span>
<span data-human-lang="english">the Tyrannosaurus Rex of Codosaurus, LLC,</span>
</aside>
</section>
<section>
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<span data-human-lang="lithuanian">ir atskridau čia</span>
<span data-human-lang="spanish">y volé hasta aquí</span>
<span data-human-lang="dutch">en ik ben hierheen gevlogen</span>
<span data-human-lang="greek" lang="el">και πέταξα εδώ</span>
<span data-human-lang="norwegian">og jeg fløy hit</span>
<span data-human-lang="portuguese">e voei para cá</span>
</div>
<div class="half vctring" style="font-size: 4em">
🛫 . . . 🛬
</div>
<div class="qtr vctring" style="font-size: 1.5em" data-not-if-human-lang="english">
(and I flew here)
</div>
</div>
<span class="slide-caption">Image: standard emoji</span>
<aside class="notes">
<span data-human-lang="lithuanian">ir atskrihDOH cheh</span>
<span data-human-lang="dutch">en ik ben heerhay gheflogheh</span>
<span data-human-lang="greek">kay paytaxAH ehDOH</span>
<span data-human-lang="norwegian">oh yai floy heet</span>
<span data-human-lang="english">and I flew all the way over here</span>
</aside>
</section>
<section>
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<span data-human-lang="lithuanian">ant savo augintinio pterodaktilio</span>
<span data-human-lang="spanish">en mi mascota pterodáctila</span>
<span data-human-lang="dutch">op mijn pterodactylus</span>
<span data-human-lang="greek" lang="el" style="font-size: 0.95em">με το κατοικίδιο μου πτεροδάκτυλο</span>
<span data-human-lang="norwegian">på kjæledyret mitt pterodactyl</span>
<span data-human-lang="portuguese">no meu pterodátilo de estimação</span>
</div>
<div class="half">
<img src="images/pterodactyl.png" height="60%"
style="position: absolute; top: 27%; left: 15%">
<img src="images/t-rex-light.png" height="35%"
style="position: absolute; bottom: 43%; right: 35%; border-radius: 0">
</div>
<div class="qtr vctring" style="font-size: 1.5em" data-not-if-human-lang="english">
(on my pet pterodactyl)
</div>
</div>
<span class="slide-caption">Images: https://pixabay.com/vectors/dinosaur-tyrannosaurus-t-rex-6273164/<br>and https://pixabay.com/vectors/bird-flying-wings-dinosaur-ancient-44859/</span>
<aside class="notes">
<span data-human-lang="lithuanian">ahnt sahvo auGIHNtihnyo PterodakTIHlyo</span>
<span data-human-lang="dutch">oap main pteroDACteeluss</span>
<span data-human-lang="greek">meh to katoiKIdio moh pteroDAKtilo</span>
<span data-human-lang="norwegian">po KYELihDEEReh mit PeroduckTEEL</span>
<span data-human-lang="english">on my pet pterodactyl</span>
</aside>
</section>
<section>
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<span data-human-lang="lithuanian">kad išmokinčiau jus apie</span>
<span data-human-lang="spanish">para enseñaros sobre</span>
<span data-human-lang="dutch">om jullie iets over</span>
<span data-human-lang="greek" lang="el">για να σας μάθω τους</span>
<span data-human-lang="norwegian">for å lære deg om</span>
<span data-human-lang="portuguese">para vos ensinar sobre</span>
</div>
<div class="half vctring" style="font-size: 7em">
👨🏽🏫
</div>
<div class="qtr vctring" style="font-size: 1.5em" data-not-if-human-lang="english">
(to teach you about)
</div>
</div>
<span class="slide-caption">Image: standard emoji</span>
<aside class="notes">
<span data-human-lang="lithuanian">kad ishmoKIHNchyo YOOS ah-PEE-eh</span>
<span data-human-lang="dutch">ohm Yully eets ofer</span>
<span data-human-lang="greek">yeh na Sas MAtho tohss</span>
<span data-human-lang="norwegian">for oh LAARa dai om</span>
<span data-human-lang="english">to teach you about</span>
</aside>
</section>
<section>
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<span data-human-lang="lithuanian">Genetiniai Algoritmai.</span>
<span data-human-lang="spanish">Algoritmos Genéticos.</span>
<span data-human-lang="dutch">Genetische Algoritmen te leren.</span>
<span data-human-lang="greek" lang="el">Γενετικούς Αλγόριθμους.</span>
<span data-human-lang="norwegian">Genetiske Algoritmer.</span>
<span data-human-lang="portuguese">Algoritmos Genéticos.</span>
</div>
<div class="half vctring"><img src="images/genetic-testing.png"></div>
<div class="qtr vctring" style="font-size: 1.5em" data-not-if-human-lang="english">
(Genetic Algorithms.)
</div>
</div>
<span class="slide-caption">Image: https://pixabay.com/vectors/genetic-testing-gene-panel-genetics-2316642</span>
<aside class="notes">
<span data-human-lang="lithuanian">geNETinee AlgoRITHmai.</span>
<span data-human-lang="dutch">GheNEHtische AlghoRITmeh te lereh.</span>
<span data-human-lang="greek">yenetiKOHSS alGOrithmohss.</span>
<span data-human-lang="norwegian">GeNEtiskEH AlgoREETmer?</span>
<span data-human-lang="english">Genetic Algorithms.<br><br>So . . .</span>
</aside>
</section>
<section data-not-if-human-lang="english">
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<div>
<span data-human-lang="lithuanian">Visgi</span>
<span data-human-lang="spanish">Pero</span>
<span data-human-lang="dutch">Maar</span>
<span data-human-lang="greek" lang="el">Αλλά</span>
<span data-human-lang="norwegian">Men</span>
<span data-human-lang="portuguese">Mas</span>
. . .
</div>
</div>
<div class="half vctring" style="font-size: 6em">
☝️
</div>
<div class="qtr vctring" style="font-size: 1.5em">
(But . . .)
</div>
</div>
<span class="slide-caption">Image: standard emoji</span>
<aside class="notes">
<span data-human-lang="lithuanian">VIZgih</span>
<span data-human-lang="dutch">Maar</span>
<span data-human-lang="greek">AHlah</span>
<span data-human-lang="norwegian">M'n</span>
. . .
</aside>
</section>
<section data-not-if-human-lang="english">
<div class="all">
<div class="qtr vctring" style="font-size: 1.5em">
<span data-human-lang="lithuanian">toliau tesiu pasakojima angliškai.</span>
<span data-human-lang="spanish">lo haré en inglés.</span>
<span data-human-lang="dutch">ik zal het in het Engels doen.</span>
<span data-human-lang="greek" lang="el">θα το κάνω στα αγγλικά.</span>
<span data-human-lang="norwegian">jeg skal gjøre det på engelsk.</span>
<span data-human-lang="portuguese">vou fazê-lo em inglês.</span>
</div>
<div class="half vctring" style="font-size: 8em">
🇺🇸
</div>
<div class="qtr vctring" style="font-size: 1.5em">
(I will do it in English.)
</div>
</div>
<span class="slide-caption">Image: standard emoji</span>
<aside class="notes">
<span data-human-lang="lithuanian">tohlYO TESSu PassaKoimah AHNglishkay.</span>
<span data-human-lang="dutch">ik ZAL-et in-et ENgels doon.</span>
<span data-human-lang="greek">Tha toh KAno sta AngliKAH.</span>
<span data-human-lang="norwegian">Yai skuhl YOR-uh deuh po en-YILSK.</span>
<br><br>
<div data-not-if-human-lang="portuguese">
<div data-not-if-human-lang="french">
<span data-time-min="40">
Mainly because you’ve just heard almost all the
<span data-human-lang="lithuanian">Lithuanian</span>
<span data-human-lang="spanish">Spanish</span>
<span data-human-lang="dutch">Dutch</span>
<span data-human-lang="greek">Greek</span>
<span data-human-lang="norwegian">Norwegian</span>
I speak!
</span>
<br>
</div>
</div>
So . . .
</aside>
</section>
<section>
<div class="all vctring">
<img src="images/little-girl.jpg">
</div>
<span class="slide-caption">Image: https://www.pexels.com/photo/pensive-girl-with-school-notebook-thinking-16117755/</span>
<aside class="notes">
. . . what <i>are</i> genetic algorithms in the first place?
<span data-time-min="40">
The entire concept is an
</span>
<span data-time-max="39">They are</span>
. . .
</aside>
</section>
<section>
<div class="all vctring">
<img src="images/settings_icon-icons.com_49925.png" style="background-color: white">
</div>
<span class="slide-caption">Image: https://icon-icons.com/download/49925/PNG/512/</span>
<aside class="notes">
...
<span data-time-min="40">
optimization meta-heuristic,
so that <i>individual</i> genetic algorithms are
</span>
optimization heuristics, . . .
</aside>
</section>
<section>
<div class="vctring" style="font-size: 8em">WAT?!</div>
<aside class="notes">
. . .
<span data-time-max="39">which is</span>
<span data-time-min="40">and all that babble is just</span>
<i>fancy-talk</i> for . . .
</aside>
</section>
<section>
<div class="all vctring">
<div style="font-size: 1.6em">
<b>Optimization Heuristic:</b><br>
shortcut to find<br>
"good enough" solutions<br>
(ideally the best,<br>
but OK if not).
</div>
</div>
<aside class="notes">
. . .
<span data-time-min="40">
the idea that
genetic algorithms are
a category of
</span>
shortcuts to find solutions to hard problems.
<span data-time-min="40">
Generally these apply to problems that
would be computationally intractable
to attack by normal means.
</span>
Ideally they'll find the best solution,
but in reality we usually have to settle for
something "good enough",
due to constraints like time or money.
<span data-time-min="40">
After all, that's generally why we're
using a shortcut in the first place.
</span>
<br><br>
There are many kinds of optimization heuristics,
but genetic algorithms are
<span data-time-min="40">
(as you may have guessed from the name)
</span>
uniquely inspired by . . .
</aside>
</section>
<section>
<div class="all vctring">
<img src="images/evolution.jpg" class="expand-wide">
</div>
<span class="slide-caption">Image: https://www.freepik.com/free-vector/human-workers-evolution-silhouettes_725773.htm</span>
<aside class="notes">
. . . real-world biological evolution,
mainly the principles of
survival of the fittest,
random combination of old sets of genes
<span data-time-min="30">(no, not like I'm wearing)</span>
into one new set,
and random mutation.
<br><br>
The history goes back to 1950, when . . .
</aside>
</section>
<section>
<div class="all vctring">
<img src="images/turing.png" style="height: 100%">
<div style="font-size: 3em; font-weight: bold">Alan<br>Turing</div>
</div>
<span class="slide-caption">Image: https://cdn.britannica.com/81/191581-050-8C0A8CD3/Alan-Turing.jpg</span>
<aside class="notes">
. . . Alan Turing, as in Turing Test,
<span data-time-min="30">Turing Machine,</span>
<span data-time-min="40">Turing Completeness, Turing Award</span>
and so on,
<span data-var-city-en="London">
oh you know him, he's one of yours, anyway, he
</span>
proposed a "learning machine"
in which he thought that
the mechanism of learning
would be similar to evolution.
Nothing much ever came of that,
and it took a few decades for
genetic algorithms in general
to get some traction.
The first commercial product based on genetic algorithms,
a mainframe toolkit for . . .
</aside>
</section>
<section>
<div class="all vctring">
<img src="images/industrial-process.jpg">
</div>
<span class="slide-caption">Image: https://pxhere.com/en/photo/267871</span>
<aside class="notes">
. . . industrial processes,
came out in the late 1980's,
from General Electric.
<span data-time-min="40">
In 1989 a more general genetic algorithm toolkit,
called Evolver,
came out for <i>PCs</i>.
</span>
These days,
MATLAB and such tools
have some genetic algorithm facilities built-in, and
most major programming languages have
genetic algorithm libraries available<span data-conf-prog-lang="ruby">,
including over 30 Ruby gems</span>.
<span data-time-min="50">
(Plus, the basic idea is simple enough that
any decent programmer can implement it from scratch.)
</span>
However, the actual <i>uses</i> of genetic algorithms
remain mostly hidden,
and in my opinion frankly rather boring<span data-time-min="50">
to most of us
</span>,
used by companies in their internal
industrial processes, logistics, scheduling, and so on.
<br><br>
But once in a while, they do get used for
something more interesting,
and more publicly known.
<span data-time-min="50">
These days, with AI becoming much more common,
they're often used for things like
selecting features sets of machine learning models and
optimizing hyperparameters of neural networks, and even
denoising, reconstructing, and extracting features from images.
</span>
Most famously, <span data-time-min="50">though,</span> in 2005 . . .
</aside>
</section>
<section>
<div class="all vctring">
<img src="images/nasa-logo-web-rgb.png">
</div>
<span class="slide-caption">Image: https://www.nasa.gov/sites/default/files/thumbnails/image/nasa-logo-web-rgb.png</span>
<aside class="notes">
. . . NASA<span data-time-min="50">,
the United States' National Aeronautics and Space Administration,
</span>
used a genetic algorithm to design an . . .
</aside>
</section>
<section>
<div class="all vctring">
<img src="images/st5-antenna.jpg" class="expand-tall">
<div style="font-size: 1.8em; font-weight: bold">
ST5 antenna,<br>
and<br>
US quarter<br>
for scale
</div>
</div>
<span class="slide-caption">Image: https://www.jpl.nasa.gov/nmp/st5/IMAGES/st5-antenna.jpg</span>
<aside class="notes">
. . . antenna for the ST5 series of satellites<span data-time-min="35">,
launched in 2006</span>.
(No, that's not just a paperclip
bent up by someone
fidgeting in a boring meeting.)
The NASA Jet Propulsion Laboratory website says:
"Its unusual shape is expected
because most human antenna designers
would never think of such a design."
And that is one of the great advantages of this approach.
<span data-time-min="50">
These algorithms are much less hampered by
expectations of similarity to past solutions.
They can come up with things that
a human might dismiss at first glance as unrealistic,
but the numbers work out just fine.
However, today we'll only be looking at
much simpler problem domains,
for the sake of making understandable demos.
</span>
<br><br>
<span data-time-min="50">
Before we delve into the technical details,
I'd like to set the . . .
</span>
<span data-time-max="49">
So, how do genetic algorithms work?
They consist of a simple series of steps,
simple enough that I personally don't consider this
to be a form of AI, but some conferences do, so here I am!
Anyway:
</span>
</aside>
</section>
<section data-time-min="50">
<div class="vctring" style="font-size: 10em">? ? ?</div>
<aside class="notes">
question policy.
If you have a question that absolutely must be answered now,
in order for you to understand some important point,
raise a hand, and I'll try to notice and call on you.
If you have a less urgent question,
please save it for the end,
and save comments for after all questions.
<br><br>
So, how do genetic algorithms work?
They consist of a simple series of steps,
simple enough that I personally don't consider this
to be a form of AI, but some conferences do, so here I am!
Anyway:
</aside>
</section>
<section>
<span class="center cycle-stage cycle-stage-init">Initialize</span>
<aside class="notes">
First, we create an initial population of candidates.
In Genetic Algorithm terms, these are called "chromosomes",
but since most living beings contain
<i>many</i> chromosomes in each and every cell,
I don't like that term,
I think it leads to confusion,
so I'm just going to say "candidates".
<span data-time-min="35">
I've also heard them called individuals, solutions,
or
<i>phenotypes</i>,
to use another actual genetic term,
but most people don't know that word,
so I'll skip that one too.
</span>
<br><br>
The next step is to . . .
</aside>
</section>
<section>
<span class="center cycle-stage cycle-stage-init">Initialize</span>
<span class="center cycle-arrow-init">⬇️</span>
<span class="center cycle-stage cycle-stage-assess">Assess</span>
<aside class="notes">
. . . assess the "fitness" of each candidate,
according to whatever criteria we want to apply.
We do it here mainly because
it supplies the data
<i>usually</i> used in the next step,
which is to ask, are we . . .
</aside>
</section>
<section>
<span class="center cycle-stage cycle-stage-init">Initialize</span>
<span class="center cycle-arrow-init">⬇️</span>
<span class="center cycle-stage cycle-stage-assess">Assess</span>
<span class="cycle-arrow-assess">⬅️</span>
<span class="cycle-stage cycle-stage-done">Done?</span>
<aside class="notes">
. . . done yet?
This is <i>usually</i> based on the fitness,
but <i>could</i> be based on other criteria,
<span data-time-min="40">
and we'll discuss some of those later,
</span>
or a combination.
If we're not done, then next we . . .
</aside>
</section>
<section>
<span class="center cycle-stage cycle-stage-init">Initialize</span>
<span class="center cycle-arrow-init">⬇️</span>
<span class="center cycle-stage cycle-stage-assess">Assess</span>
<span class="cycle-arrow-assess">⬅️</span>
<span class="cycle-stage cycle-stage-done">Done?</span>
<span class="cycle-arrow-done">⬇️</span>
<span class="cycle-stage cycle-stage-select">Select</span>
<aside class="notes">
. . . select some candidates to breed the next generation.
This is <i>also</i> usually based on the fitness,
to simulate <i>survival</i> of the fittest.
<!-- Remember, evolution is not about survival to a ripe old age,
it's only concerned with
survival to the point of passing along one's genes.
Survival of an elder
may contribute to survival of the young,
but that's a much more complicated discussion
of indirect evolutionary pressures. -->
<br><br>
After that,
<span data-time-min="35">as you may have guessed,</span>
we <i>use</i> those candidates we just selected . . .
</aside>
</section>
<section>
<span class="center cycle-stage cycle-stage-init">Initialize</span>
<span class="center cycle-arrow-init">⬇️</span>
<span class="center cycle-stage cycle-stage-assess">Assess</span>
<span class="cycle-arrow-assess">⬅️</span>
<span class="cycle-stage cycle-stage-done">Done?</span>
<span class="cycle-arrow-done">⬇️</span>
<span class="cycle-stage cycle-stage-select">Select</span>
<span class="center cycle-arrow-select">➡️</span>
<span class="cycle-stage cycle-stage-breed">Breed</span>
<aside class="notes">
. . . to <i>breed</i>
a new population.
<span data-time-min="35">
Some of the previous population,
especially the fittest ones,
<i>may</i> be carried over into this new population,
but usually not.
</span>
<br><br>
Next
<span data-time-min="35">
is a very important but easily forgotten step,
which is to
</span>
<span data-time-max="34">we</span>
. . .
</aside>
</section>
<section>
<span class="center cycle-stage cycle-stage-init">Initialize</span>
<span class="center cycle-arrow-init">⬇️</span>
<span class="center cycle-stage cycle-stage-assess">Assess</span>
<span class="cycle-arrow-assess">⬅️</span>
<span class="cycle-stage cycle-stage-done">Done?</span>
<span class="cycle-arrow-done">⬇️</span>
<span class="cycle-stage cycle-stage-select">Select</span>
<span class="center cycle-arrow-select">➡️</span>
<span class="cycle-stage cycle-stage-breed">Breed</span>
<span class="cycle-arrow-breed">⬆️</span>
<span class="cycle-stage cycle-stage-mutate">Mutate</span>
<aside class="notes">
. . . <i>mutate</i> those new candidates,
for more <i>diversity</i> in the gene pool.
<br><br>
Finally, we . . .
</aside>
</section>
<section>
<span class="center cycle-stage cycle-stage-init">Initialize</span>
<span class="center cycle-arrow-init">⬇️</span>
<span class="center cycle-stage cycle-stage-assess">Assess</span>
<span class="cycle-arrow-assess">⬅️</span>
<span class="cycle-stage cycle-stage-done">Done?</span>
<span class="cycle-arrow-done">⬇️</span>
<span class="cycle-stage cycle-stage-select">Select</span>
<span class="center cycle-arrow-select">➡️</span>
<span class="cycle-stage cycle-stage-breed">Breed</span>
<span class="cycle-arrow-breed">⬆️</span>
<span class="cycle-stage cycle-stage-mutate">Mutate</span>
<span class="cycle-arrow-mutate">⬅️</span>
<aside class="notes">
. . . go back to step 2, assessing their fitness.
<span data-time-min="40">
(You might want to take a picture of this slide
and the next one,
because they're the big takeaways about
how genetic algorithms work at a high level.
I'll give you a moment to get out your phones.)
</span>
This sequence could be represented at a high level
with some rather simple code, like so:
</aside>
</section>
<section>
<div class="vctring">
<div>
<pre style="font-size: 0.9em"><code data-trim class="language-ruby">
how_many = 10 # or however big we want
pop = initial_pop(how_many)
evaluate(pop)
while not done?(pop)
breeders = select_breeders(pop)
pop = breed(breeders, how_many)
mutate(pop)
evaluate(pop)
end
</code></pre>
</div>
</div>
<aside class="notes">
<span data-not-if-conf-prog-lang="ruby">
<span data-not-if-conf-prog-lang="n/a">
I know this conference is mainly focused on $WHATEVER, but this
</span>
<span data-if-conf-prog-lang="n/a">This</span>
code is in Ruby.
I chose that to reduce boilerplate overhead,
and because it reads so close to plain English,
so even if you don't know Ruby,
I'm confident you'll understand the ideas,
and maybe even the actual code.
<span data-time-min="40">
I'll try to remember to explain any
weird bits of Ruby syntax.
</span>
</span>
<br><br>
Now let's take a closer look at
<span data-time-min="35">what goes on in</span>
each step,
by working through an example.
</aside>
</section>
<section>
<div class="cycling-steps">
<span class="current-step center cycle-stage cycle-stage-init">Initialize</span>
<span class="center cycle-arrow-init">⬇️</span>
<span class="center cycle-stage cycle-stage-assess">Assess</span>
<span class="cycle-arrow-assess">⬅️</span>
<span class="cycle-stage cycle-stage-done">Done?</span>
<span class="cycle-arrow-done">⬇️</span>
<span class="cycle-stage cycle-stage-select">Select</span>
<span class="center cycle-arrow-select">➡️</span>
<span class="cycle-stage cycle-stage-breed">Breed</span>
<span class="cycle-arrow-breed">⬆️</span>
<span class="cycle-stage cycle-stage-mutate">Mutate</span>
<span class="cycle-arrow-mutate">⬅️</span>
</div>
<aside class="notes">
First we create an initial population of candidates.
But what is a candidate, and how do we create one?
These are different solutions to some problem,
usually represented as
different instances of the same data structure.
<span data-time-min="35">
They could be
any data structure we want,
so long as we can
evaluate their fitness,
combine old ones
to make a new one,
and mutate them.
</span>
The simplest common type of candidate is . . .
</aside>
</section>
<section>
<div class="all vctring" style="font-size: .7em">
<b>
<code>
01001000<br>
01100101<br>
01101100<br>
01101100<br>
01101111<br>
00100000<br>
01110111<br>
01101111<br>
01110010<br>
01101100<br>
01100100<br>
00100001<br>
</code>
</b>
</div>
<aside class="notes">
. . . a simple string of bits.
This will do fine for candidates that consist of
a simple series of yes/no decisions.
This may sound simplistic,
but there is a huge class of problems that boil down to this,
called . . .
</aside>
</section>
<section>
<div class="all vctring">
<img src="images/backpack.png" class="expand-tall">
<div style="font-size: 1.8em; font-weight: bold">
Knapsack /<br>Rucksack /<br>Backpack /<br>Whatever!
</div>
</div>
<span class="slide-caption">Image: https://publicdomainvectors.org/en/free-clipart/Rucksack-vector-image/9910.html</span>
<aside class="notes">
. . . knapsack problems<span data-time-min="40">,
which is a category of
constrained resource allocation problems</span>.
The canonical example is that you have a knapsack<span data-time-min="40">
(or rucksack, backpack, or whatever you call it)</span>,
and many things you want to carry in it,
but they won't all fit,
<span data-time-max="39">so</span>
<span data-time-min="35">
or the total weight is more than you can carry,
or some such similar constraint,
or <i>combination</i> of constraints.
So
</span>
you want to find the combination of items,
that will fit<span data-time-min="35"> the constraints</span>,
and has the maximum value.
<span data-time-min="35">
That could be the literal cash value,
or something more metaphorical.
<span data-time-min="40">
In the canonical example,
you might be taking the knapsack on a camping trip,
so you want to pack whatever supplies you might need,
for your survival, or at least your comfort.
Different items will have different levels of importance
for those purposes.
For instance, common . . .
</span>
</span>
<span data-time-max="39">
To look at a concrete example, suppose we know . . .
</span>
</aside>
</section>
<section data-time-min="40">
<div class="all vcntring">
<img src="images/camping-supplies.jpg">
</div>
<span class="slide-caption">Image: forgot source, it's all over the web</span>
<aside class="notes">
. . . camping supplies would be
much more valuable in this context than, say,
an accordion, especially per kilogram or cubic centimeter.
<span data-time-min="60">
In fact, if other people are camping there,
an accordion might even have <i>negative</i> value!
</span>
<br><br>
There is a standard heuristic for knapsack problems,
of simply adding the most valuable item that will fit,
until we can't fit anything more.
However, it's easy to envision times when that would not
get us the best solution.
<span data-time-min="60">
For instance, suppose . . .
</span>
<span data-time-max="59">
<br><br>
To look at a concrete example, suppose we know . . .
</span>
</aside>
</section>
<section data-time-min="60">
<div class="all vcntring"><img src="images/desert.jpg"></div>
<span class="slide-caption">Image: https://www.pexels.com/photo/person-in-white-shirt-walking-on-desert-4253829/</span>
<aside class="notes">
. . . you're lost in the desert,
with knapsack that has a ten-liter capacity,
and coincidentally nothing left in it,
and you stumble across four bottles of water.
Ignoring the volume of the bottle material,
and their exact shapes,
they hold . . .
</aside>
</section>
<section data-time-min="60">
<br>
<img src="images/water-bottle.png" height="317">
<img src="images/water-bottle.png" height="363">
<img src="images/water-bottle.png" height="400">
<img src="images/water-bottle.png" height="431">
<span class="slide-caption">Image: https://www.rawpixel.com/image/9007646/png-white-background-people</span>
<aside class="notes">
. . . two, three, four, and five liters.
That totals 14 liters, so you can't take them all.
The standard heuristic would have us first take the five,
and then the four, and then we can't fit anything more.
But if you think about it a moment, it's fairly clear that
we should leave the four and take the rest.
That is, take the five, three, and two, totaling ten,
which is the exact capacity of our knapsack,
so we definitely can't do any better.
<br><br>
To look at an example of how to solve a knapsack problem
by using a genetic algorithm,
suppose we know . . .
</aside>
</section>
<section>
<div class="all vcntring" style="font-size: 9em">
🧑🏽🌾
🚚
</div>
<span class="slide-caption">Image: standard emoji</span>
<aside class="notes">
. . . a farmer,
with a smallish truck,
and he needs to decide what to take to market each week.
And on this farm he has . . .
</aside>
</section>
<section>
<div class="vctring" style="font-size: 4em">
🐄 🐄 🐄 🐄
🐄 🐄 🐄
</div>
<span class="slide-caption">Images: standard emoji</span>