-
Notifications
You must be signed in to change notification settings - Fork 1
/
proofs.html
708 lines (599 loc) · 24 KB
/
proofs.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="./lib/seedrandom.min.js"></script>
<script src="./lib/d3.v5.min.js"></script>
<script src="./lib/glpk.min.js"></script>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<script src="./simple/simplegraph.js"></script>
<script src="./simple/simpleLp.js"></script>
<script src="./simple/testCaseGenerator.js"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
margin: 5%;
}
svg {
margin: 1%;
background-color: white;
}
.modelDivClass {
font-size: xx-small;
white-space: pre-wrap;
font-family: "Lucida Console", Monaco, monospace;
background-color: #eee;
padding: 2%;
border-radius: 4px;
margin: 1%;
min-width: 150px;
}
.flexbreak {
flex-basis: 100%;
height: 0;
}
.definitionDiv {
position: fixed;
right: 5%;
transform: scale(0.8);
max-width: 20%;
/* text-align: right; */
background-color: white;
border-radius: 10px;
padding: 10px;
box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
}
.definitionDiv td {
padding: 5px;
}
</style>
<body>
<!-- bootstrap -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
</body>
<script>
let drawTest = (test, testRow, svgheight = 200) => {
let mkx = (elem) => {
return "x_" + elem[0].id + "_" + elem[1].id
}
let div = testRow
.append('div')
.style('width', '20%')
let svg = div
.append('svg')
.style('width', '100%')
.style('height', svgheight + 'px')
if (test.graph.groups.length != 0){
let rt = div.append('div')
.attr('class', 'modelDivClass')
.html('<b>groups<b>\n')
for (let group of test.graph.groups){
rt.append('text')
.text('g' + group.id + ": " + group.nodes.map(n => n.id).join(", ") + "\n")
}
}
if (test.forceOrder != undefined && test.forceOrder.length > 0){
let rt = div.append('div')
.attr('class', 'modelDivClass')
.html('<b>forced vars<b>\n')
for (elem of test.forceOrder){
rt.append('text')
.text(mkx(elem) + '\n')
}
}
if (!test.algorithm.model.minimize.includes('empty')){
div.append('div')
.attr('class', 'modelDivClass')
.html(test.algorithm.model.minimize.substring(0, test.algorithm.model.minimize.length - 1).replace('Minimize', '<b>Minimize</b>'))
}
div.append('div')
.attr('class', 'modelDivClass')
.html(test.algorithm.model.subjectTo.replace('Subject To', '<b>Subject To</b>'))
.style('max-height', '200px')
.style('overflow-y', 'scroll')
if (true){
let rt = div.append('div')
.attr('class', 'modelDivClass')
.html('<b>result</b>\n')
.style('max-height', '200px')
.style('overflow-y', 'scroll')
for (elem in test.algorithm.result){
if (elem == "empty") continue;
let r = rt.append('text')
.html(elem + ": " + Math.round(test.algorithm.result[elem]) + '\n')
if (test.forceOrder != undefined){
let found = true;
for (el of test.forceOrder){
if (mkx(el) == elem){
found = false;
}
}
if (found) r.html("<b>" + elem + ": " + Math.round(test.algorithm.result[elem]) + '</b>\n')
}
}
}
test.graph.draw(svg);
if (test.forceOrder != undefined){
for (o of test.forceOrder){
for (n of o){
svg.selectAll('.node')
.filter(no => no.id == n.id)
.attr('fill', 'red')
}
}
}
}
properDefinitions = {
// decision vars
crossings: {
formula: "$c_{u_1v_1, u_2v_2}$",
type: "bool",
desc: "the number of crossings between edge $u_1v_1$ and $u_2v_2$"
},
precedence: {
formula: "$x_{u_1, u_2}$",
type: "bool",
desc: "equal to 1 if $u_1$ is above $u_2$, 0 otherwise"
},
bendiness: {
formula: "$bend_{u_1v_1, u_2v_2}$",
type: "int",
desc: "bendiness of edge $u_1v_1, u_2v_2$"
},
y: {
formula: "$y_{u_1}$",
type: "int",
desc: "vertical coordinate of node $u_1$"
},
y_top: {
formula: "$y\\_top_{g_1}$",
type: "int",
desc: "vertical topmost bound of group $g_1$"
},
y_bottom: {
formula: "$y\\_bottom_{g_1}$",
type: "int",
desc: "vertical bottommost bound of group $g_1$"
},
z: {
formula: "$z_i$",
type: "int",
desc: "Auxiliary constant. Used for linearization."
},
// constants
m: {
formula: "$m$",
type: "int",
desc: "Auxiliary constant. Predefined. Must be larger than the vertical span of the vis."
},
// sets
edges: {
formula: "$E_k$",
type: "set",
desc: "set of all edges in rank $k$"
},
nonSameRankEdges: {
formula: "$E^{**}_k$",
type: "set",
desc: "set of all non-same-rank edges in rank $k$"
},
sameRankEdges: {
formula: "$E^{*}_k$",
type: "set",
desc: "set of all same-rank edges in rank $k$"
},
nodes: {
formula: "$N_k$",
type: "set",
desc: "set of all nodes in rank $k$"
},
ranks: {
formula: "$\\ell$",
type: "set",
desc: "set of all ranks in graph $G$"
},
groups: {
formula: "$\\Gamma$",
type: "set",
desc: "set of all groups in graph $G$"
}
}
d3.select('body').append('div')
.attr('id', 'accordion')
.append('div')
.attr('class', 'card definitionDiv')
.html(() => {
let header = `<div class="card-header" id="headingOne">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Definitions (click to toggle)
</button>
</h5>
</div>`
let body = `<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">`
body+= `<table>`
for (let elem in properDefinitions){
body += "<tr>"
for (let field in properDefinitions[elem]){
body += "<td>" + properDefinitions[elem][field] + "</td>"
}
body += "</tr>"
}
body += "</table>"
body+= `</div>
</div>
</div>`
let r = header + body;
return r;
})
let testGenerator = new TestCaseGenerator();
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
d3.select('body')
.append('div')
.html('<h1>How to read this page</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(``)
// *********
// SIMPLE INTERSECTION
// *********
d3.select('body')
.append('div')
.html('<h1>Simple Intersection</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`Crossings are computed by comparing each pair of edges in a rank, excluding (for now, but treated in a later section) same rank edges. <br>
<b>Formula:</b> <br>
$c_{u_1v_1, u_2v_2} + x_{u_2, u_1} + x_{v_1,v_2} \\geq 1 \\quad \\forall u_1, u_2 \\in E_k, \\forall k \\in \\ell$ <br>
$c_{u_1v_1, u_2v_2} + x_{u_1, u_2} + x_{v_2,v_1} \\geq 1$ <br>
<br>
<b>Intuition:</b> <br>
There's a crossing ($c_{u_1v_1, u_2v_2} = 1$) if the ends of an edge have opposite positions in the two adjacent ranks:
either $u_1$ is above $u_2$ but $v_1$ is below $v_2$, or viceversa.`)
let testRow = d3.select('body')
.append('div')
.style('display', 'flex')
for (test of testGenerator.gen2x2CrossingTest()){
drawTest(test, testRow);
}
// *********
// SIMPLE TRANSITIVITY
// *********
d3.select('body')
.append('div')
.html('<h1>Simple Transitivity</h1>')
d3.select('body')
.append('div')
.html('')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`This is applied to all triplets of nodes in a rank. This enforces a total order of the nodes in a rank.
Nodes in different groups don't need to have these constraints. <br>
<br>
<b>Formula:</b> <br>
$x_{u_1, u_2} + x_{u_2, u_3} - x_{u_1, u_3} \\geq 0 \\quad \\quad \\forall k \\in \\ell, u_1, u_2, u_3 \\in N_k \\quad
u_1 \\neq u_2 \\neq u_3, u_1 \\neq u_3$ <br>
$- x_{u_1, u_2} - x_{u_2, u_3} + x_{u_1, u_3} \\geq -1$ <br>
<br>
<b>Intuition:</b> <br>
If $u_1$ is above $u_2$, and $u_2$ is above $u_3$, then $u_1$ must be above $u_3$. <br>
`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genTransitivityTest()){
drawTest(test, testRow);
}
// *********
// SAME-RANK EDGES
// *********
d3.select('body')
.append('div')
.html('<h1>Same rank edges</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`
<br>
<b>Formula:</b> <br>
$c_{u_1v_1, u_2v_2} + x_{u_2, u_1} + x_{v_1, u_2} + x_{v_2, v_1} \\geq 1 \\quad \\forall u_1v_1, u_2v_2 \\in E^*_k, u_1v_1 \\neq u_2v_2, k \\in \\ell$<br>
$c_{u_1v_1, u_2v_2} + x_{v_2, u_1} + x_{v_1, v_2} + x_{u_2, v_1} \\geq 1$<br>
$c_{u_1v_1, u_2v_2} + x_{u_1, u_2} + x_{v_2, u_1} + x_{v_1, v_2} \\geq 1$<br>
$c_{u_1v_1, u_2v_2} + x_{v_1, u_2} + x_{v_2, v_1} + x_{u_1, v_2} \\geq 1$<br>
$c_{u_1v_1, u_2v_2} + x_{u_2, v_1} + x_{u_1, u_2} + x_{v_2, u_1} \\geq 1$<br>
$c_{u_1v_1, u_2v_2} + x_{v_2, v_1} + x_{u_1, v_2} + x_{u_2, u_1} \\geq 1$<br>
$c_{u_1v_1, u_2v_2} + x_{v_1, v_2} + x_{u_2, v_1} + x_{u_1, u_2} \\geq 1$<br>
$c_{u_1v_1, u_2v_2} + x_{u_1, v_2} + x_{u_2, u_1} + x_{v_1, u_2} \\geq 1$<br>
<br>
<b>Intuition:</b> <br>
There's a crossing between two-same rank edges if nodes are in specific configurations. One example is: if $u_1$ is above $u_2$, $u_2$ is above $v_1$ and $v_1$ is above $v_2$, there's a crossing.<br>
<br>
<b>Requirements: </b> Simple Transitivity <br>
`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genSameRankEdgesTest()){
drawTest(test, testRow);
}
// *********
// SAME-RANK EDGES AND TWO-RANK EDGES
// *********
d3.select('body')
.append('div')
.html('<h1>Same rank edges and two-rank edges</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`Applied to every pair of same-rank edge and non-same-rank edge in the same rank.<br>
<br>
<b>Formula:</b> <br>
$c_{u_1v_1, u_2v_2} + x_{u_1, u_2} + x_{v_2, u_1} \\geq 1 \\quad \\forall u_1v_1 \\in E^*_k, u_2v_2 \\in E^{**}_k, k \\in \\ell$ <br>
$c_{u_1v_1, u_2v_2} + x_{u_1, v_2} + x_{u_2, u_1} \\geq 1$ <br>
<br>
<b>Intuition:</b> <br>
There's a crossing between a same-rank edge and a non-same-rank edge iff the source of the non-same-rank edge
is exactly in-between the two ends of the same-rank edge.<br>
<br>
<b>Requirements</b>: Simple Transitivity<br>
`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genSameRankEdgesPlusTwoRankEdgesTest()){
drawTest(test, testRow);
}
// *********
// ANCHOR GENERATION
// *********
d3.select('body')
.append('div')
.html('<h1>Anchors</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`Adding anchors is just a preprocessing step.
Anchors are represented by semi-transparent nodes.<br>
In edges that go over more than one rank, one anchor is added for every jumped rank.
`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genSimpleAnchorTest()){
drawTest(test, testRow);
}
testRow.selectAll(".modelDivClass").remove()
// *********
// SINGLE RANK GROUPING
// *********
d3.select('body')
.append('div')
.html('<h1>Single-rank grouping</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`This is needed to keep all the nodes in a group close together, without having external nodes between them.
Note that this formula can replace completely the transitivity constraints (Simple Transitivity)
between nodes in and out of groups,
which aren't needed if two of the nodes are inside a group and one is outside it, or viceversa.<br>
<br>
<b>Formula:</b> <br>
$x_{u_1, u_3} - x_{u_2, u_3} = 0 \\quad \\forall u_1, u_2 \\in g_1, \\forall u_3 \\not\\in g_1, \\forall g_1 \\in G$<br>
<br>
<b>Intuition:</b> <br>
If nodes $u_1$ and $u_2$ are in group $g_1$, and node $u_3$ is outside $g_1$, then either $u_3$ is above both $u_1$ and $u_2$,
or below both of them.<br>
`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genGroupTest(2, 1)){
drawTest(test, testRow);
}
d3.select('body')
.append('div')
.html('<h3>Single-rank grouping (3 elems per group)</h3>')
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genGroupTest(3, 1)){
drawTest(test, testRow);
}
// *********
// MULTI-RANK GROUPING
// *********
d3.select('body')
.append('div')
.html('<h1>Multi-rank groups</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`Multi-rank grouping is implemented with the objective of keeping the group squared. It needs an additional preprocessing step:
every rank contained in a group must have the same number of nodes in the group. Every rank should then have the same number of nodes.
To obtain this, we add additional fake nodes.<br>
After this, another constraint is applied: <br>
<br>
<b>Formula:</b> <br>
$\\sum_{\\substack{{u_1} \\in g_1, {u_2} \\not\\in g_1 \\ u_1, u_2 \\in k}} x_{u_1, u_2} =
\\sum_{\\substack{{u_3} \\in g_1, {u_4} \\not\\in g_1 \\ u_3, u_4 \\in k+1}} x_{u_3, u_4}$<br>
<br>
<b>Intuition:</b> <br>
The distance of a node from the top of the visualization is computed by counting the nodes above it (through the $x$ variables).
The sum of the distance of all the nodes in a given rank in a group should be consistent across all the ranks (in which the group has nodes).
In this way, the group keeps all nodes at the same general height across all ranks.<br>
<br>
<b>Requirements:</b> Simple Transitivity, Single-rank groups.<br>
`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genMultiRankGroupTest()){
drawTest(test, testRow, 300);
}
// *********
// NESTED GROUPS
// *********
d3.select('body')
.append('div')
.html('<h1>Nested groups</h1>')
d3.select('body')
.append('div')
.html(`Nested groups aren\'t really integrated into LP, this is just a test to show that they
work fine with the current formulation. The key to keep them correct is adding anchor / 'fake' nodes where they should be.
It's important to note that fake nodes should be added starting from the innermost group. Note: sub-groups which aren't completely contained aren't supported.`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genNestedGroupTest()){
drawTest(test, testRow, 300);
}
// *********
// BENDINESS REDUCTION
// *********
d3.select('body')
.append('div')
.html('<h1>Bendiness reduction</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`To straighten lines, we add one additional variable per node ($y$), one additional variable per edge ($bend$) to represent
its bendiness, and change the way in which nodes are represented on the plane: they are no more just represented
by squishing them all to the top, but have a precise vertical position (the $y$) that should be optimized to straighten the lines.
Therefore, we not only add constraints, but also edit the objective function to reflect the additional variables that need to be minimized.<br>
$w_1$ and $w_2$ are two arbitrary constants indicating the weight of the two parts of the function. If applied to same rank edges,
it keeps the ends of the same-rank edges close together. <br>
<br>
<b>Formula:</b> <br>
Objective function: $\\textrm{Minimize}: w_1 \\sum_{k \\in \\ell}\; \\sum_{\\substack{u_1v_1, u_2v_2 \\in E_k \\ u_1v_1 \\neq u_2v_2
}} c_{u_1v_1,u_2v_2} + w_2 \\sum_{u_1, u_2 \\in E} bend_{u_1, u_2}$<br>
<br>
Constraints (1): $abs(y_{u_1} - y_{u_2}) \\leq bend_{u_1, u_2}$ <br>
Constraints (1) linearized: <br>
$y_{u_1} - y_{u_2} \\leq bend_{u_1, u_2}$ <br>
$y_{u_2} - y_{u_1} \\leq bend_{u_1, u_2}$ <br>
<br>
<b>Intuition (1):</b> The bendiness of every edge is the difference between the two ends of the edge.<br>
<br>
Constraints (2): <br>
$y_{u_1} \\geq y_{u_2} * x_{u_1, u_2} + (\\text{buffer})*x_{u_1, u_2}$ <br>
$y_{u_2} \\geq y_{u_1} * x_{u_2, u_1} + (\\text{buffer})*x_{u_2, u_1}$ <br>
<br>
Constraints (2) linearized: <br>
$z_i - m * x_{u_2, u_1} \\leq 0 $ <br>
$z_i \\leq y_{u_2}$ <br>
$z_i - y_{u_2} + m * x_{u_2, u_1} \\geq - m $ <br>
$z_i \\geq 0$ <br>
$y_{u_1} - z_i - (\\text{buffer}) * x_{u_2, u_1} \\geq 0$ <br>
<br>
$z_i - m * x_{u_1, u_2} \\leq 0 $ <br>
$z_i \\leq y_{u_1}$ <br>
$z_i - y_{u_1} + m * x_{u_1, u_2} \\geq - m $ <br>
$z_i \\geq 0$ <br>
$y_{u_2} - z_i - (\\text{buffer}) * x_{u_1, u_2} \\geq 0$ <br>
<br>
<b>Intuition (2):</b> If $u_1$ is above $u_2$, then the vertical position of $u_2$ can't be above the one of $u_1$, and viceversa. The buffer
is needed just in case some distance is needed between the two nodes.<br>`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genSimpleBendinessReductionTest()){
drawTest(test, testRow, 300);
}
// *********
// GROUPING WITH BENDINESS REDUCTION
// *********
d3.select('body')
.append('div')
.html('<h1>Single-rank groups and bendiness reduction</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`No change needed in the formulas.`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genGroupBendinessReductionTest()){
drawTest(test, testRow);
}
// *********
// MULTI-RANK GROUPING WITH BENDINESS REDUCTION
// *********
d3.select('body')
.append('div')
.html('<h1>Multi-rank groups and bendiness reduction</h1>')
d3.select('body')
.append('div')
.style('margin-bottom', '20px')
.html(`No anchors needed anymore. <br>
<br>
<b>Formula:</b> <br>
$y_{u_1} \\geq y\\_top_{g_1}$ <br>
$y_{u_1} \\leq y\\_bottom_{g_1} + \\text{buffer}$<br>
<br>
<b>Intuition:</b> All nodes in a group should be included within the top and bottom boundaries of the group.<br>
<br>
<b>Formula:</b> <br>
$y_{u_1} \\leq y\\_top_{g_1} \\; || \\; y_{u_1} \\geq y\\_bottom_{g_1}$ <br>
<b>Formula (linearized):</b> <br>
$y_{u_1} - m * z_1 \\leq y\\_top_{g_1} - 1$ <br>
$- y_{u_1} + m * z_1 \\leq m - y\\_bottom_{g_1}$ <br>
<br>
<b>Intuition:</b> Nodes outside the group (in the same ranks) should be either above or below the group.<br>
<br>
<b>Requirements:</b> Bendiness reduction.<br>
`)
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genMultiRankGroupBendinessReductionTest()){
drawTest(test, testRow, 300);
}
// *********
// GROUP + SIMPLIFY VARS
// *********
d3.select('body')
.append('div')
.html('<h1>Var reduction with groups</h1>')
testRow = d3.select('body')
.append('div')
.style('display', 'flex')
.style('margin-top', '20px')
for (test of testGenerator.genVarReductionTest()){
drawTest(test, testRow, 300);
}
// *********
// ISSUES TEST
// *********
// d3.select('body')
// .append('div')
// .html('<h1>Issue!</h1>')
// testRow = d3.select('body')
// .append('div')
// .style('display', 'flex')
// .style('margin-top', '20px')
// for (test of testGenerator.genTestIssue1()){
// drawTest(test, testRow, 300);
// }
</script>
</html>