-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProptotypeOtsuOptimizer.nb
2021 lines (1946 loc) · 90.7 KB
/
ProptotypeOtsuOptimizer.nb
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[ 92741, 2013]
NotebookOptionsPosition[ 86954, 1913]
NotebookOutlinePosition[ 87303, 1928]
CellTagsIndexPosition[ 87260, 1925]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["Input", "Chapter",
CellChangeTimes->{{3.767759378500918*^9,
3.7677593920882177`*^9}},ExpressionUUID->"f3e44aa6-774d-44b1-af39-\
682a2d6f11dc"],
Cell[CellGroupData[{
Cell["State object", "Section",
CellChangeTimes->{{3.767166470022061*^9, 3.767166477329526*^9}, {
3.7671677046869*^9, 3.7671677207719154`*^9}, {3.76724734064356*^9,
3.7672473610000496`*^9}, {3.7677610880446267`*^9, 3.767761093203618*^9}, {
3.7677613516705103`*^9,
3.767761369081594*^9}},ExpressionUUID->"f707af31-f5ef-4b64-9f68-\
237a1eefd16b"],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{"ClearAll", "[", "State", "]"}], "\[IndentingNewLine]",
RowBox[{"Protect", "[", "State", "]"}]}], "Input",
CellChangeTimes->{{3.767761371138901*^9,
3.7677614059518747`*^9}},ExpressionUUID->"9eab9f45-8872-4a40-89ce-\
34e1f125e105"],
Cell[BoxData[
RowBox[{"{", "\<\"State\"\>", "}"}]], "Output",
CellChangeTimes->{3.767761421278852*^9, 3.767769569563464*^9,
3.767789623432192*^9},ExpressionUUID->"cc3f1db8-6487-460f-a0e9-\
ffc1e72d9569"]
}, Open ]],
Cell[CellGroupData[{
Cell["Getters", "Subsection",
CellChangeTimes->{{3.767761632389473*^9,
3.7677616366375637`*^9}},ExpressionUUID->"e8ace4c3-7c21-4329-8235-\
ce3d7bf976ae"],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"BBox", "[",
RowBox[{"State", "[",
RowBox[{"bbox_", ",", "samples_", ",", "mask_"}], "]"}], "]"}], ":=",
"bbox"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"Samples", "[",
RowBox[{"State", "[",
RowBox[{"bbox_", ",", "samples_", ",", "mask_"}], "]"}], "]"}], ":=",
"samples"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"CorrectMask", "[",
RowBox[{"State", "[",
RowBox[{"bbox_", ",", "samples_", ",", "mask_"}], "]"}], "]"}], ":=",
"mask"}], ";"}]}], "Input",
CellChangeTimes->{{3.7677614272751117`*^9,
3.767761524391709*^9}},ExpressionUUID->"515f628d-c648-4961-8ddf-\
0efaf244baed"]
}, Open ]],
Cell[CellGroupData[{
Cell["Setter", "Subsection",
CellChangeTimes->{{3.767761632389473*^9, 3.7677616366375637`*^9}, {
3.767788550648763*^9,
3.7677885516816683`*^9}},ExpressionUUID->"3738df63-8b7c-4877-8677-\
ac134c5875c5"],
Cell["Check that a sample in a box", "Text",
CellChangeTimes->{{3.767759907427004*^9,
3.767759922200918*^9}},ExpressionUUID->"671cc62a-cf03-467b-89a7-\
3ee8e06120b1"],
Cell[BoxData[{
RowBox[{
RowBox[{"InClosedBoxQ", "[",
RowBox[{"sample_", ",", "bbox_"}], "]"}], ":=",
RowBox[{"And", "@@",
RowBox[{"MapThread", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{
"#2", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "-",
"#1"}], "\[LessEqual]", "0"}], ")"}], "&&",
RowBox[{"(",
RowBox[{"0", "\[LessEqual]",
RowBox[{
RowBox[{
"#2", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "-",
"#1"}]}], ")"}]}], "&"}], ",",
RowBox[{"{",
RowBox[{"sample", ",", "bbox"}], "}"}]}],
"]"}]}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"InOpenBoxQ", "[",
RowBox[{"sample_", ",", "bbox_"}], "]"}], ":=",
RowBox[{"And", "@@",
RowBox[{"MapThread", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{
"#2", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "-",
"#1"}], "<", "0"}], ")"}], "&&",
RowBox[{"(",
RowBox[{"0", "<",
RowBox[{
RowBox[{
"#2", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "-",
"#1"}]}], ")"}]}], "&"}], ",",
RowBox[{"{",
RowBox[{"sample", ",", "bbox"}], "}"}]}], "]"}]}]}]}], "Input",
CellChangeTimes->{{3.76775948939713*^9, 3.7677595324301963`*^9}, {
3.7677596783615737`*^9, 3.767759735184733*^9}, {3.7677599051120267`*^9,
3.767759906371128*^9}, {3.7677602575437975`*^9, 3.7677602601952825`*^9}, {
3.7677604449678154`*^9, 3.7677604558272853`*^9}, {3.7677605214824514`*^9,
3.7677605221389074`*^9}, {3.767760999249755*^9, 3.767761000984333*^9}, {
3.7677647671381507`*^9, 3.767764768649007*^9}, 3.76776484251151*^9, {
3.7677650634809475`*^9, 3.7677650642313004`*^9}, {3.7677654929314766`*^9,
3.7677655251320505`*^9}, {3.767793237656455*^9,
3.767793274372697*^9}},ExpressionUUID->"4ce851e4-bf9b-4aca-9dbb-\
e158028f3862"],
Cell[BoxData[
RowBox[{
RowBox[{"SetBBox", "[",
RowBox[{"state_", ",", "bbox_"}], "]"}], ":=",
RowBox[{
RowBox[{
RowBox[{"State", "[",
RowBox[{"bbox", ",",
RowBox[{"Pick", "[",
RowBox[{
RowBox[{"Samples", "[", "state", "]"}], ",", "#"}], "]"}], ",",
RowBox[{"Pick", "[",
RowBox[{
RowBox[{"CorrectMask", "[", "state", "]"}], ",", "#"}], "]"}]}],
"]"}], "&"}], "[",
RowBox[{"Map", "[",
RowBox[{
RowBox[{
RowBox[{"InOpenBoxQ", "[",
RowBox[{"#", ",", "bbox"}], "]"}], "&"}], ",",
RowBox[{"Samples", "[", "state", "]"}]}], "]"}], "]"}]}]], "Input",
CellChangeTimes->{{3.7677885543487606`*^9, 3.767788570691966*^9}, {
3.767788612964938*^9,
3.7677886855892296`*^9}},ExpressionUUID->"e151147f-3366-4b6a-bdac-\
9b090aba8a93"]
}, Open ]],
Cell[CellGroupData[{
Cell["Member functions", "Subsection",
CellChangeTimes->{{3.767761632389473*^9,
3.7677616625751767`*^9}},ExpressionUUID->"b4eb201a-e655-48bb-b660-\
cc8a7a0b0c01"],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"CorrectSamples", "[",
RowBox[{"State", "[",
RowBox[{"bbox_", ",", "samples_", ",", "mask_"}], "]"}], "]"}], ":=",
RowBox[{"Pick", "[",
RowBox[{"samples", ",", "mask"}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"IncorrectSamples", "[",
RowBox[{"State", "[",
RowBox[{"bbox_", ",", "samples_", ",", "mask_"}], "]"}], "]"}], ":=",
RowBox[{"Pick", "[",
RowBox[{"samples", ",", "mask", ",", "False"}], "]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.767761552537298*^9, 3.767761579828508*^9},
3.7677616287637367`*^9, {3.767787304247753*^9,
3.7677873139055414`*^9}},ExpressionUUID->"50f81b7d-b756-4700-8d39-\
8e8ef16e7d2b"],
Cell[BoxData[
RowBox[{
RowBox[{"OpenBoxMask", "[", "state_State", "]"}], ":=",
RowBox[{"Map", "[",
RowBox[{
RowBox[{
RowBox[{"InOpenBoxQ", "[",
RowBox[{"#", ",",
RowBox[{"BBox", "[", "state", "]"}]}], "]"}], "&"}], ",",
RowBox[{"Samples", "[", "state", "]"}]}], "]"}]}]], "Input",
CellChangeTimes->{{3.7677878108351145`*^9,
3.767787819817972*^9}},ExpressionUUID->"f3a41e81-ebd6-4927-9d9b-\
c26b59068e05"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["Find inner or outer bounding box", "Section",
CellChangeTimes->{{3.767166470022061*^9, 3.767166477329526*^9}, {
3.7671677046869*^9, 3.7671677207719154`*^9}, {3.76724734064356*^9,
3.7672473610000496`*^9}, {3.7677610880446267`*^9, 3.767761093203618*^9}, {
3.7677874082375917`*^9,
3.7677874357068634`*^9}},ExpressionUUID->"36620ca8-1104-457c-be70-\
c55b0a3076af"],
Cell["\<\
Bounding box is a list of pairs. Every pair consists of limits {min, max} for \
every parameter\
\>", "Text",
CellChangeTimes->{{3.767758539533745*^9,
3.7677586142049637`*^9}},ExpressionUUID->"8beb2370-c305-4c1f-bdbf-\
884e913b7a0a"],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"FindInnerBox", "[", "state_State", "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"MapThread", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"Max", "[",
RowBox[{
RowBox[{
"#1", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], ",",
RowBox[{
"#2", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}],
"]"}], ",",
RowBox[{"Min", "[",
RowBox[{
RowBox[{
"#1", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], ",",
RowBox[{
"#2", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}],
"]"}]}], "}"}], "&"}], ",", "\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"BBox", "[", "state", "]"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"Min", "[", "#", "]"}], ",",
RowBox[{"Max", "[", "#", "]"}]}], "}"}], "&"}], "/@",
RowBox[{"Transpose", "@",
RowBox[{"CorrectSamples", "[", "state", "]"}]}]}]}],
"\[IndentingNewLine]", "}"}]}], "]"}]}], ";"}]], "Input",
CellChangeTimes->{{3.7672506095076666`*^9, 3.767250623796792*^9}, {
3.767250658058034*^9, 3.7672506612885876`*^9}, {3.7672508772584376`*^9,
3.767250877442335*^9}, {3.767250960710501*^9, 3.767250961196203*^9}, {
3.7672510129507475`*^9, 3.7672510151106005`*^9}, {3.767786828726348*^9,
3.7677868772931848`*^9}},ExpressionUUID->"922357db-6fe8-4469-8e2b-\
dc2defcab635"],
Cell[BoxData[{
RowBox[{
RowBox[{"MaxFromList", "[",
RowBox[{"list_", ",", "default_"}], "]"}], ":=",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"Length", "[", "list", "]"}], "\[Equal]", "0"}], ",", "default",
",",
RowBox[{"Max", "[", "list", "]"}]}], "]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"MinFromList", "[",
RowBox[{"list_", ",", "default_"}], "]"}], ":=",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"Length", "[", "list", "]"}], "\[Equal]", "0"}], ",", "default",
",",
RowBox[{"Min", "[", "list", "]"}]}], "]"}]}]}], "Input",
CellChangeTimes->{{3.767764889852384*^9,
3.7677649834336653`*^9}},ExpressionUUID->"c03b1d80-729a-452d-8c3a-\
9558792b5827"],
Cell[BoxData[
RowBox[{
RowBox[{"FindOuterBox", "[", "state_State", "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"If", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"And", "@@",
RowBox[{"CorrectMask", "[", "state", "]"}]}], ",", "\[IndentingNewLine]",
RowBox[{"BBox", "[", "state", "]"}], ",", "\[IndentingNewLine]",
RowBox[{"MapThread", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Function", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
"paramSamples", ",", "\[IndentingNewLine]", "inLimits", ",",
"\[IndentingNewLine]", "outLimits"}], "\[IndentingNewLine]", "}"}],
",", "\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"MaxFromList", "[",
RowBox[{
RowBox[{"Select", "[",
RowBox[{"paramSamples", ",",
RowBox[{
RowBox[{"#", "<",
RowBox[{
"inLimits", "\[LeftDoubleBracket]", "1",
"\[RightDoubleBracket]"}]}], "&"}]}], "]"}], ",",
RowBox[{
"outLimits", "\[LeftDoubleBracket]", "1",
"\[RightDoubleBracket]"}]}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"MinFromList", "[",
RowBox[{
RowBox[{"Select", "[",
RowBox[{"paramSamples", ",",
RowBox[{
RowBox[{"#", ">",
RowBox[{
"inLimits", "\[LeftDoubleBracket]", "2",
"\[RightDoubleBracket]"}]}], "&"}]}], "]"}], ",",
RowBox[{
"outLimits", "\[LeftDoubleBracket]", "2",
"\[RightDoubleBracket]"}]}], "]"}]}], "\[IndentingNewLine]",
"}"}]}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"{",
RowBox[{
RowBox[{"Transpose", "@",
RowBox[{"IncorrectSamples", "[", "state", "]"}]}], ",",
RowBox[{"FindInnerBox", "[", "state", "]"}], ",",
RowBox[{"BBox", "[", "state", "]"}]}], "}"}]}], "\[IndentingNewLine]",
"]"}]}], "\[IndentingNewLine]", "]"}]}]], "Input",
CellChangeTimes->{{3.7672473762639236`*^9, 3.767247469499672*^9}, {
3.7672478198712225`*^9, 3.767247898287366*^9}, {3.767247934759923*^9,
3.7672480964242673`*^9}, {3.7672481406884875`*^9, 3.7672481770771112`*^9},
3.767250110597088*^9, {3.7672502225974116`*^9, 3.7672504923767414`*^9}, {
3.7672505306397133`*^9, 3.7672505910607452`*^9}, {3.7672506768780966`*^9,
3.767250726523991*^9}, {3.7672508797390776`*^9, 3.767250883882573*^9},
3.767761809191862*^9, {3.7677649903283515`*^9, 3.7677650030228033`*^9}, {
3.7677650374607005`*^9, 3.7677650473881445`*^9}, {3.767766139402331*^9,
3.7677661405274734`*^9}, {3.7677694443921137`*^9, 3.767769480798335*^9}, {
3.767770589401721*^9, 3.7677706089961653`*^9}, {3.7677869474155483`*^9,
3.767787033900357*^9}, {3.7677873254304547`*^9,
3.767787341527415*^9}},ExpressionUUID->"b9430d9c-ceed-4256-9fd0-\
6e36ca7e8f5d"]
}, Open ]],
Cell[CellGroupData[{
Cell["Recall", "Section",
CellChangeTimes->{{3.767166470022061*^9, 3.767166477329526*^9}, {
3.7671677046869*^9, 3.7671677207719154`*^9}, {3.76724734064356*^9,
3.7672473610000496`*^9}, {3.767759469281143*^9, 3.7677594712968864`*^9}, {
3.7677874558988724`*^9,
3.7677874582429047`*^9}},ExpressionUUID->"9101d0c5-1687-41ee-a71e-\
59228f6ebe7d"],
Cell["Find ration of correct/total in bounding box", "Text",
CellChangeTimes->{{3.767759930059805*^9,
3.7677599687946177`*^9}},ExpressionUUID->"e909e2d3-6860-43a3-9d4e-\
5cb57ebeccf1"],
Cell[BoxData[
RowBox[{
RowBox[{"FindRecall", "[", "state_State", "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"Module", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"inBoxMask", "=",
RowBox[{"OpenBoxMask", "[", "state", "]"}]}], "\[IndentingNewLine]",
"}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"N", "@",
RowBox[{"Count", "[",
RowBox[{
RowBox[{"MapThread", "[",
RowBox[{"And", ",",
RowBox[{"{",
RowBox[{"inBoxMask", ",",
RowBox[{"CorrectMask", "[", "state", "]"}]}], "}"}]}], "]"}], ",",
"True"}], "]"}]}], "/",
RowBox[{"Count", "[",
RowBox[{"inBoxMask", ",", "True"}], "]"}]}]}], "\[IndentingNewLine]",
"]"}]}]], "Input",
CellChangeTimes->{{3.767759750810851*^9, 3.767759889653764*^9}, {
3.767760032433732*^9, 3.7677600360007634`*^9}, 3.7677650763551893`*^9,
3.7677655321368713`*^9, {3.767787104980736*^9, 3.767787165262849*^9}, {
3.7677871986941576`*^9, 3.7677872052585*^9}, {3.767787915754181*^9,
3.7677879507774773`*^9}},ExpressionUUID->"89d9bf20-95d6-4205-bafa-\
d2ba0e84404e"]
}, Open ]],
Cell[CellGroupData[{
Cell["Split bounding box", "Section",
CellChangeTimes->{{3.767166470022061*^9, 3.767166477329526*^9}, {
3.7671677046869*^9, 3.7671677207719154`*^9}, {3.76724734064356*^9,
3.7672473610000496`*^9}, {3.767759469281143*^9, 3.7677594712968864`*^9}, {
3.7677607765530734`*^9, 3.767760779663613*^9}, {3.7677651047761602`*^9,
3.7677651109802375`*^9}, {3.7677876854506483`*^9,
3.7677876935102296`*^9}},ExpressionUUID->"cd56502b-a6ec-422f-9e62-\
280bdab97813"],
Cell[BoxData[
RowBox[{"ClearAll", "[",
RowBox[{"FindSplittingThreshold", ",", "SplitBBox"}], "]"}]], "Input",
CellChangeTimes->{{3.7677631097905846`*^9,
3.767763124000063*^9}},ExpressionUUID->"ac9c159d-65ae-4c4a-83a8-\
c0d709578105"],
Cell[BoxData[
RowBox[{
RowBox[{"FindSplittingThreshold", "[",
RowBox[{"state_State", ",", "idx_"}], "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"Module", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"inBoxMask", "=",
RowBox[{"OpenBoxMask", "[", "state", "]"}]}], ",",
"\[IndentingNewLine]", "values"}], "\[IndentingNewLine]", "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"values", "=",
RowBox[{"Map", "[",
RowBox[{
RowBox[{
RowBox[{
"#", "\[LeftDoubleBracket]", "idx", "\[RightDoubleBracket]"}], "&"}],
",",
RowBox[{"Pick", "[",
RowBox[{
RowBox[{"Samples", "[", "state", "]"}], ",", "inBoxMask"}], "]"}]}],
"]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"FindThreshold", "[",
RowBox[{"Pick", "[",
RowBox[{"values", ",",
RowBox[{"Pick", "[",
RowBox[{
RowBox[{"CorrectMask", "[", "state", "]"}], ",", "inBoxMask"}],
"]"}]}], "]"}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input",
CellChangeTimes->{{3.767761030669877*^9, 3.7677610693844986`*^9}, {
3.7677625203999915`*^9, 3.7677628128681364`*^9}, {3.7677628923413334`*^9,
3.7677629047810316`*^9}, {3.767762955113796*^9, 3.767763026027483*^9}, {
3.767763193079321*^9, 3.7677631963713984`*^9}, 3.767765612624501*^9, {
3.767787555527048*^9, 3.7677876308854103`*^9},
3.7677879596191607`*^9},ExpressionUUID->"ad60d0ea-4610-448a-9c8a-\
8cc388773083"],
Cell[BoxData[
RowBox[{
RowBox[{"SplitBBox", "[",
RowBox[{"bbox_", ",", "threshold_", ",", "idx_"}], "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"ReplacePart", "[",
RowBox[{"bbox", ",",
RowBox[{"idx", "\[Rule]",
RowBox[{"{",
RowBox[{
RowBox[{"bbox", "\[LeftDoubleBracket]",
RowBox[{"idx", ",", "1"}], "\[RightDoubleBracket]"}], ",",
"threshold"}], "}"}]}]}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"ReplacePart", "[",
RowBox[{"bbox", ",",
RowBox[{"idx", "\[Rule]",
RowBox[{"{",
RowBox[{"threshold", ",",
RowBox[{"bbox", "\[LeftDoubleBracket]",
RowBox[{"idx", ",", "2"}], "\[RightDoubleBracket]"}]}], "}"}]}]}],
"]"}]}], "\[IndentingNewLine]", "}"}]}]], "Input",
CellChangeTimes->{{3.7677607821940317`*^9, 3.7677607823936815`*^9}, {
3.767760818240224*^9, 3.7677609648769016`*^9}, {3.7677610104716167`*^9,
3.7677610142128224`*^9}, {3.767764066840362*^9,
3.7677640669028807`*^9}},ExpressionUUID->"4a17b746-81bd-4eca-91a6-\
5c7a49f8510d"]
}, Open ]],
Cell[CellGroupData[{
Cell["Refine and split state", "Section",
CellChangeTimes->{{3.7677662142079988`*^9, 3.767766219303606*^9}, {
3.7677890040173054`*^9,
3.767789007643042*^9}},ExpressionUUID->"ac064878-5043-40fa-aaf5-\
5f1949b06f28"],
Cell["In that follows we ignore subnormal floating point numbers", "Text",
CellChangeTimes->{{3.7677937758655276`*^9,
3.7677938161097836`*^9}},ExpressionUUID->"69e14abf-7e73-4f8b-b940-\
28d1ded35fa1"],
Cell[BoxData[{
RowBox[{"ClearAll", "[",
RowBox[{"NextAfter", ",", "NextBefore"}], "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"NextAfter", "[", "0.", "]"}], "=", "$MinMachineNumber"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"NextAfter", "[", "x_", "]"}], "/;",
RowBox[{
RowBox[{"Precision", "[", "x", "]"}], "\[Equal]", "MachinePrecision"}]}],
":=",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"me", "=",
RowBox[{"MantissaExponent", "[",
RowBox[{"x", ",", "2"}], "]"}]}], "}"}], ",",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"2",
RowBox[{"First", "[", "me", "]"}]}], "+", "$MachineEpsilon"}], ")"}],
RowBox[{"Power", "[",
RowBox[{"2", ",",
RowBox[{
RowBox[{"Last", "[", "me", "]"}], "-", "1"}]}], "]"}]}]}], "]"}]}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"NextBefore", "[", "0.", "]"}], "=",
RowBox[{"-", "$MinMachineNumber"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"NextBefore", "[", "x_", "]"}], "/;",
RowBox[{
RowBox[{"Precision", "[", "x", "]"}], "\[Equal]", "MachinePrecision"}]}],
":=",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"me", "=",
RowBox[{"MantissaExponent", "[",
RowBox[{"x", ",", "2"}], "]"}]}], "}"}], ",",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"2",
RowBox[{"First", "[", "me", "]"}]}], "-", "$MachineEpsilon"}], ")"}],
RowBox[{"Power", "[",
RowBox[{"2", ",",
RowBox[{
RowBox[{"Last", "[", "me", "]"}], "-", "1"}]}], "]"}]}]}],
"]"}]}]}], "Input",
CellChangeTimes->{{3.7677933013690014`*^9, 3.7677933468362722`*^9}, {
3.7677933985439787`*^9,
3.767793556120515*^9}},ExpressionUUID->"66f1e1be-219d-4153-bd2c-\
88d0187d0a9c"],
Cell[BoxData[{
RowBox[{"ClearAll", "[", "RefineState", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"RefineState", "=",
RowBox[{"Function", "[",
RowBox[{
RowBox[{"{", "state", "}"}], ",",
RowBox[{"SetBBox", "[",
RowBox[{"state", ",",
RowBox[{"FindOuterBox", "[", "state", "]"}]}], "]"}]}], "]"}]}],
";"}]}], "Input",
CellChangeTimes->{{3.7677636163936844`*^9, 3.7677636821132827`*^9}, {
3.7677638503671417`*^9, 3.7677639503013897`*^9}, {3.7677663311789236`*^9,
3.767766331902167*^9}, {3.76778770869328*^9, 3.7677877830234475`*^9}, {
3.767788011885776*^9, 3.767788091434231*^9}, {3.767788891933634*^9,
3.7677889354871864`*^9}, {3.767788976878957*^9,
3.7677889807857046`*^9}},ExpressionUUID->"420edb38-fc48-45fa-98a9-\
056a23f501ba"],
Cell[BoxData[{
RowBox[{"ClearAll", "[", "CloseBBox", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"CloseBBox", "[", "bbox_", "]"}], ":=",
RowBox[{"Map", "[",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"NextBefore", "[",
RowBox[{"#", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
"]"}], ",",
RowBox[{"NextAfter", "[",
RowBox[{"#", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}],
"]"}]}], "}"}], "&"}], ",", "bbox"}], "]"}]}],
"\n"}], "\[IndentingNewLine]",
RowBox[{"ClearAll", "[", "SplitState", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"SplitState", "=", "\[IndentingNewLine]",
RowBox[{"Function", "[",
RowBox[{
RowBox[{"{",
RowBox[{"state", ",", "splitIndex"}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{"If", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"And", "@@",
RowBox[{"CorrectMask", "[", "state", "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"{", "state", "}"}], ",", "\[IndentingNewLine]",
RowBox[{"Module", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"splitBoxes", "=",
RowBox[{"SplitBBox", "[",
RowBox[{
RowBox[{"BBox", "[", "state", "]"}], ",",
RowBox[{"FindSplittingThreshold", "[",
RowBox[{"state", ",", "splitIndex"}], "]"}], ",",
"splitIndex"}], "]"}]}], "\[IndentingNewLine]", "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"RefineState", "@",
RowBox[{"SetBBox", "[",
RowBox[{"state", ",",
RowBox[{"CloseBBox", "[",
RowBox[{
"splitBoxes", "\[LeftDoubleBracket]", "1",
"\[RightDoubleBracket]"}], "]"}]}], "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"RefineState", "@",
RowBox[{"SetBBox", "[",
RowBox[{"state", ",",
RowBox[{
"splitBoxes", "\[LeftDoubleBracket]", "2",
"\[RightDoubleBracket]"}]}], "]"}]}]}], "\[IndentingNewLine]",
"}"}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]",
"]"}]}], "\[IndentingNewLine]", "]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.7677907651174545`*^9, 3.7677908732872543`*^9}, {
3.767790930297665*^9, 3.767790934626549*^9}, {3.767791265631129*^9,
3.7677913448817787`*^9}, {3.7677913886662245`*^9, 3.7677914806125174`*^9}, {
3.767791514181158*^9, 3.7677915158689547`*^9}, {3.7677916090216556`*^9,
3.7677916535979433`*^9}, {3.7677917208835816`*^9, 3.7677917322639685`*^9}, {
3.7677935386571217`*^9, 3.767793539735218*^9}, {3.7677935720152674`*^9,
3.7677935874573936`*^9}, {3.767793828591016*^9,
3.7677938338454733`*^9}},ExpressionUUID->"9162e813-3fc1-4683-9301-\
7cebddba1a58"]
}, Open ]],
Cell[CellGroupData[{
Cell["Picture", "Section",
CellChangeTimes->{{3.7677586743252296`*^9,
3.7677586917513814`*^9}},ExpressionUUID->"77abb98b-d5d8-42c2-8449-\
8858622eeb26"],
Cell[BoxData[
RowBox[{
RowBox[{"colors", "=",
RowBox[{"ColorData", "[",
RowBox[{"94", ",", "\"\<ColorList\>\""}], "]"}]}], ";"}]], "Input",
CellChangeTimes->{{3.7677658079107137`*^9,
3.7677658448599143`*^9}},ExpressionUUID->"dfd304e9-4722-4d0f-82fc-\
a4e256772216"],
Cell[BoxData[
RowBox[{
RowBox[{"PlotState", "[", "state_State", "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"Module", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"outBox", "=",
RowBox[{"FindOuterBox", "[", "state", "]"}]}], "\[IndentingNewLine]",
"}"}], ",", "\[IndentingNewLine]",
RowBox[{"Graphics", "[", "\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"FaceForm", "[",
RowBox[{"Directive", "[",
RowBox[{
RowBox[{
"colors", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
",",
RowBox[{"Opacity", "[", "0.25", "]"}]}], "]"}], "]"}], ",",
RowBox[{"EdgeForm", "[", "None", "]"}], ",",
RowBox[{"Rectangle", "@@",
RowBox[{"Transpose", "[", "outBox", "]"}]}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{
RowBox[{"FaceForm", "[", "None", "]"}], ",",
RowBox[{"EdgeForm", "[",
RowBox[{
"colors", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
"]"}], ",",
RowBox[{"Rectangle", "@@",
RowBox[{"Transpose", "[",
RowBox[{"BBox", "[", "state", "]"}], "]"}]}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"Orange", ",",
RowBox[{"PointSize", "\[Rule]", " ", "Medium"}], ",",
RowBox[{"Point", "@",
RowBox[{"CorrectSamples", "[", "state", "]"}]}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"Blue", ",",
RowBox[{"PointSize", "\[Rule]", " ", "Medium"}], ",",
RowBox[{"Point", "@",
RowBox[{"IncorrectSamples", "[", "state", "]"}]}]}], "}"}]}],
"\[IndentingNewLine]", "}"}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}]}]], "Input",
CellChangeTimes->{{3.7677645921275797`*^9, 3.7677646383782387`*^9}, {
3.7677657981800957`*^9, 3.7677658057542734`*^9}, {3.7677658571690593`*^9,
3.7677659031085873`*^9}, {3.7677659477536077`*^9, 3.76776604809245*^9}, {
3.7677676796632967`*^9, 3.767767739371324*^9}, {3.767770085828457*^9,
3.767770091473618*^9}, 3.7677702722093496`*^9, {3.7677891377672286`*^9,
3.7677893506830754`*^9}},ExpressionUUID->"ad058efa-0159-4b4e-808c-\
eb7cb331078a"],
Cell[BoxData[
RowBox[{
RowBox[{"PlotStates", "[",
RowBox[{"states_", ",", "samples_", ",", "mask_"}], "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"Graphics", "[", "\[IndentingNewLine]",
RowBox[{"Join", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Table", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"FaceForm", "[",
RowBox[{"Directive", "[",
RowBox[{
RowBox[{
"colors", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
",",
RowBox[{"Opacity", "[", "0.25", "]"}]}], "]"}], "]"}], ",",
RowBox[{"EdgeForm", "[",
RowBox[{
"colors", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
"]"}], ",",
RowBox[{"Rectangle", "@@",
RowBox[{"Transpose", "[",
RowBox[{"BBox", "[", "s", "]"}], "]"}]}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"s", ",", "states"}], "}"}]}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{",
RowBox[{"Orange", ",",
RowBox[{"PointSize", "\[Rule]", " ", "Medium"}], ",",
RowBox[{"Point", "[",
RowBox[{"Pick", "[",
RowBox[{"samples", ",", "mask"}], "]"}], "]"}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"Blue", ",",
RowBox[{"PointSize", "\[Rule]", " ", "Medium"}], ",",
RowBox[{"Point", "[",
RowBox[{"Pick", "[",
RowBox[{"samples", ",", "mask", ",", "False"}], "]"}], "]"}]}],
"}"}]}], "\[IndentingNewLine]", "}"}]}], "\[IndentingNewLine]", "]"}],
"\[IndentingNewLine]", "]"}]}]], "Input",
CellChangeTimes->{{3.767770974078397*^9, 3.7677711038208995`*^9}, {
3.767789503417983*^9,
3.7677895134711866`*^9}},ExpressionUUID->"6ab04ce3-84be-42a8-a19a-\
eaab930ab355"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["Output", "Chapter",
CellChangeTimes->{{3.767759378500918*^9,
3.767759384694582*^9}},ExpressionUUID->"1564bff3-bb40-4fca-a7ea-\
4b192bc2e345"],
Cell[CellGroupData[{
Cell["Demo bounding box refinement", "Section",
CellChangeTimes->{{3.767166470022061*^9, 3.767166477329526*^9}, {
3.7671677046869*^9, 3.7671677207719154`*^9}, {3.76724734064356*^9,
3.7672473610000496`*^9}, {3.7677586428591447`*^9,
3.767758645343891*^9}},ExpressionUUID->"5ded10bf-7808-4179-a976-\
cb0650a4e687"],
Cell[CellGroupData[{
Cell["Data", "Subsection",
CellChangeTimes->{{3.7677586743252296`*^9,
3.7677587028300133`*^9}},ExpressionUUID->"c05cdc8d-e420-4164-a8f8-\
fe7a59e76978"],
Cell["Objective function", "Text",
CellChangeTimes->{{3.767758729717716*^9,
3.76775875348128*^9}},ExpressionUUID->"4d51b0e7-3094-4689-88d0-\
96a1ec17e121"],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"f", "[",
RowBox[{"x_", ",", "y_"}], "]"}], ":=",
RowBox[{"4",
RowBox[{"(",
RowBox[{
SuperscriptBox["x", "2"], "+",
SuperscriptBox["y", "2"]}], ")"}],
RowBox[{"(",
RowBox[{"1", "-",
RowBox[{"(",
RowBox[{
SuperscriptBox["x", "2"], "+",
SuperscriptBox["y", "2"]}], ")"}]}], ")"}]}]}], ";"}]], "Input",
CellChangeTimes->{{3.767758729717716*^9,
3.7677587435975785`*^9}},ExpressionUUID->"4d2b3b1c-2ecb-49c8-ab5b-\
81fbb9d718ff"],
Cell[BoxData[{
RowBox[{
RowBox[{"GetSamples", "[", "n_", "]"}], ":=",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"Sqrt", "[", "#1", "]"}],
RowBox[{"{",
RowBox[{
RowBox[{"Cos", "[",
RowBox[{"2", "\[Pi]", " ", "#2"}], "]"}], ",",
RowBox[{"Sin", "[",
RowBox[{"2", "\[Pi]", " ", "#2"}], "]"}]}], "}"}]}], "&"}], "@@@",
RowBox[{"RandomReal", "[",
RowBox[{
RowBox[{"{",
RowBox[{"0", ",", "1"}], "}"}], ",",
RowBox[{"{",
RowBox[{"n", ",", "2"}], "}"}]}], "]"}]}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"samples", "=",
RowBox[{"GetSamples", "[", "288", "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"weights", "=",
RowBox[{"f", "@@@", "samples"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"mask", "=",
RowBox[{"Thread", "[",
RowBox[{"weights", "\[GreaterEqual]", "0.8"}], "]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.767758960127267*^9, 3.767758960517852*^9}, {
3.7677666161835613`*^9, 3.7677666163710556`*^9}, {3.767770870540456*^9,
3.767770872302128*^9}},ExpressionUUID->"9bed07dc-064d-4c7d-b577-\
beb63ba0a36b"]
}, Open ]],
Cell[CellGroupData[{
Cell["Bounding boxes", "Subsection",
CellChangeTimes->{{3.7677586743252296`*^9, 3.7677586917513814`*^9}, {
3.767760056958596*^9,
3.7677600731056213`*^9}},ExpressionUUID->"8fc5bfb8-1d76-429e-a179-\
faca8803d889"],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"states", "=",
RowBox[{"{",
RowBox[{"State", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"-", "1"}], ",", "1"}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "}"}], ",", "samples", ",",
"mask"}], "]"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"Show", "[",
RowBox[{"PlotState", "/@", "states"}], "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"states", "=",
RowBox[{"RefineState", "/@", "states"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"Show", "[",
RowBox[{"PlotState", "/@", "states"}], "]"}], "\[IndentingNewLine]",
RowBox[{"FindRecall", "/@", "states"}]}], "Input",
CellChangeTimes->{{3.76776570078953*^9, 3.7677657680247145`*^9}, {
3.7677660938795547`*^9, 3.7677660972335978`*^9}, 3.7677666251699033`*^9, {
3.767789592710252*^9, 3.767789603524604*^9}, {3.7677899338914833`*^9,
3.767789974240932*^9}, {3.767793997478093*^9, 3.7677940050125847`*^9}, {
3.7677940613242884`*^9,
3.767794064005415*^9}},ExpressionUUID->"3237e718-bbf5-4539-84fe-\
6333030e1a10"],
Cell[BoxData[
GraphicsBox[{
{EdgeForm[None], FaceForm[{RGBColor[
0.21020243862087418`, 0.47802869583858715`, 0.802198107305176], Opacity[
0.25]}], RectangleBox[{-0.8499987668877526, -0.8191459716563785}, \
{0.831745331817188, 0.8547489977193644}]},
{EdgeForm[RGBColor[
0.21020243862087418`, 0.47802869583858715`, 0.802198107305176]], FaceForm[
None], RectangleBox[{-1, -1}, {1, 1}]},
{RGBColor[1, 0.5, 0], PointSize[Medium], PointBox[CompressedData["
1:eJwVlGk8FAobxd2ISoVCpaKktIlII8ljvancFlJJyVIuyZa1cEkyERWpGwmh
EiVbdh5SI0sYM7YxxuwLbmUJo+Tt/XB+58v/4/mfjS4+NpcWSEhI3P2d/3fJ
LiXBr1IWmIwPNwbT6LC5VK7PVYqHekFEZULHEO6aFt6/bcoEKw3Jbk4PE+O7
kn2z09vhb0f/WTJDCLeqfNhTY0zUc/BQ9FVhQ+ftT7QLIUyU27nGjFjJAEG9
vpW/Ex0i/D9R2SYs3KZW2Xj6IQ2WLTT12uXIhYwdryWkdr7EipnO55kkHtR6
n3mhKMvFpvpU8oHHnZAizqalKvHRQrNAP+dzM56RCz5wnjAMsf/FPHqbcheZ
aaWk8hw25BcZUy/XkFDY4kSS3d6HYRPNCSVKAzCl4G6q2NwPxUWn788E8WCa
ljL0WZ4FOnlLkLhvELVKGTfz7EpAf9A5Ye1qPqZ6hTUrRrTjiHHushM/+UhI
fD5UOlODm6nUimoPLiwO/3k/KJgPV+aqTpXVUoEvqZwVmnUfrUYpm6RkuEiS
M22Q+81ttfFU2TsZiTVpsf92TLTBck3FgB8qXOxrD1UxecDC9yPxKjrp/Xi5
54G8PpkDHeGH/hzns/DBzxP2++ebcOyCxnymJwtTewq8+m+yMJpqUHbsDRuk
UUZK4dowhA5u8HOtLYQJlc7AL65McJmb8yVnswBaad63fw6CqEZjfFUSD+mS
Z3fLrWNjmL/lKtUVZCi4az3PONEEaTZ6qt97Bbh8+q370pNFoC661pjL4kGh
mfbipXu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