-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
180 lines (162 loc) · 6.15 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Matrix scaling</title>
<!-- Import Styles -->
<link rel="stylesheet" href="./assets/styles.css" />
<!-- Import Vue.js -->
<script src="https://unpkg.com/vue@next"></script>
</head>
<body>
<div id="app">
<div
tabindex="0"
class="container"
@click="escapeGlobal"
@keydown.esc="escapeGlobal"
>
<div id="editor">
<h2>Matrix setting</h2>
<p>
<label id="matrix-file-label" for="matrix-file">Upload input matrix
<input type="file" id="matrix-file" ref="matrixFile" accept=".csv" @change="onFileChange">
</label>
{{ inputFileMessage }}
</p>
<form v-on:submit.prevent="clearMatrix">
<label for="row-num">Row number: </label>
<input type="number" v-model="inputRowNum" id="row-num" min="1" step="1" placeholder="row number (1-)">
<label for="column-num">Column number: </label>
<input type="number" v-model="inputColumnNum" id="column-num" min="1" step="1" placeholder="column number (1-)">
<button>Initialize</button>
</form>
<p>Click cells to edit corresponding values (after editing press enter key):</p>
<table>
<tbody>
<tr v-for="(row, rowIndex) in inputMatrix">
<td
v-for="(value, columnIndex) in row"
@click.stop="changeToEdit(rowIndex, columnIndex, $event)"
>
{{ value }}
</td>
</tr>
</tbody>
</table>
</div>
<input
id="matrix-editor" type="number" min="1" step="1"
ref="matrixEditor"
v-show="isEditing"
:style="{ top: editorY + 'px', left: editorX + 'px' }"
v-model="editingValue"
@keyup.enter="edit"
@keyup.esc="escapeFromEdit"
@click.stop
>
<hr>
<div id="scaling">
<h2>Matrix scaling</h2>
<div class="auto">
<button @click="toggleAutoScaling">{{autoScalingStatus === AUTO_ON ? "\u{23F8}" : "\u{23F5}" }}</button>
<button @click="resetScaling">⏹</button>
<label for="interval">
Interval:
</label>
<input type="range" class="interval-slider" :value="autoScalingIntervalSlider" min="0" max="2" step="1" @input="changeAutoScalingIntervalSlider">
<input id="interval" :value="autoScalingInterval" type="number" min="1" step="1" @input="changeAutoScalingInterval">
ms
</div>
<div class="manual">
Manual:
<button @click="rowScaling" :disabled="!canRowScale">Row scaling</button>
<button @click="columnScaling" :disabled="!canColumnScale">Column scaling</button>
</div>
<div class="result-scaling">
<div class="counter">{{ rowScalingNum }} row scalings</div>
<div class="counter">{{ columnScalingNum }} column scalings</div>
<table>
<tbody>
<tr class="column-sum">
<td class="row-sum"></td>
<td v-for="value in columnSum">
{{ valueFormat(value) }}
</td>
</tr>
<tr v-for="(row, index) in matrix">
<td class="row-sum">{{ valueFormat(rowSum[index]) }}</td>
<td v-for="value in row">
{{ valueFormat(value) }}
</td>
</tr>
</tbody>
</table>
<button @click="downloadScaling" :disabled="scalingStatus === INITIAL_STATE">Download</button>
</div>
</div>
<hr>
<h2>Symmetric capacity</h2>
<p>Compute symmetric capacity (min yAx s.t. ...) by alternating optimization.</p>
<div id="sym-capacity">
<div class="auto">
<button @click="toggleAutoSymCap">{{autoSymCapStatus === AUTO_ON ? "\u{23F8}" : "\u{23F5}" }}</button>
<button @click="resetSymCap">⏹</button>
<label for="interval">
Interval:
</label>
<input type="range" class="interval-slider" :value="autoSymCapIntervalSlider" min="0" max="2" step="1" @input="changeAutoSymCapIntervalSlider">
<input id="interval" :value="autoSymCapInterval" type="number" min="1" step="1" @input="changeAutoSymCapInterval">
ms
</div>
<div class="manual">
Manual:
<button @click="updateLeftVar" :disabled="!upgradableLeft">Update y ← yv</button>
<button @click="updateRightVar" :disabled="!upgradableRight">Update ux → x</button>
</div>
<div class="result-symcap">
<div class="counter">y updated: {{ updateLeftVarNum }} times</div>
<div class="counter">x updated: {{ updateRightVarNum }} times</div>
<table>
<caption>y</caption>
<tbody>
<tr v-for="val in leftVar">
<td>{{ valueFormat(val) }}</td>
</tr>
</tbody>
</table>
<table>
<caption>v</caption>
<tbody>
<tr v-for="val in leftCoef">
<td>{{ valueFormat(val) }}</td>
</tr>
</tbody>
</table>
<table>
<caption>u</caption>
<tbody>
<tr v-for="val in rightCoef">
<td>{{ valueFormat(val) }}</td>
</tr>
</tbody>
</table>
<table>
<caption>x</caption>
<tbody>
<tr v-for="val in rightVar">
<td>{{ valueFormat(val) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<footer>
<div class="container"></div>
</footer>
<!-- Import Js -->
<script src="./main.js"></script>
</body>
</html>