Skip to content

Commit 73ea003

Browse files
committed
add nds (non-dominated sorting) to UI
1 parent 2b22b6b commit 73ea003

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

index.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<head>
44
<title>Easy Online MCDM</title>
5+
<script src="./target/scala-3.6.4/mcdm-opt.js" defer></script>
56
<link rel="stylesheet" href="style.css">
67
</head>
78

@@ -196,7 +197,10 @@ <h3>Enter your data and go on!</h3>
196197
<label for="check_wpm">Wpm</label>
197198
<input type="checkbox" id="check_wpm"></input>
198199
</td>
199-
<td></td>
200+
<td>
201+
<label for="check_nds">Nds</label>
202+
<input type="checkbox" id="check_nds"></input>
203+
</td>
200204
</tr>
201205
</table>
202206

@@ -233,7 +237,7 @@ <h3>Enter your data and go on!</h3>
233237
<fieldset>
234238
<legend>Ranks</legend>
235239
<div id="div_output_ranks">
236-
240+
<script src="./target/scala-3.6.4/mcdm-opt.js"></script>
237241
</div>
238242
</fieldset>
239243
</fieldset>
@@ -244,6 +248,6 @@ <h3>Enter your data and go on!</h3>
244248
</body>
245249

246250

247-
<script src="./target/scala-3.6.4/mcdm-fastopt.js"></script>
251+
248252

249253
</html>

src/main/scala/Main.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,14 @@ def evaluate(problem: MCDMProblem): Unit =
351351
methodsnames = methodsnames.appended("Wpm")
352352
scores = Matrix.appendcol(scores, wpmresult.scores)
353353
ranks = Matrix.appendcol(ranks, wpmresult.ranks)
354+
if check_nds.checked then
355+
val ndsresult = nds(
356+
problem.data,
357+
Parser.str2directions(problem.directions)
358+
)
359+
methodsnames = methodsnames.appended("Nds")
360+
scores = Matrix.appendcol(scores, ndsresult.scores)
361+
ranks = Matrix.appendcol(ranks, ndsresult.scores.reverse.map(_ + 1))
354362

355363
val resultstr = HtmlUtils.scorematrixtohtml(problem, methodsnames, scores)
356364
div_output_scores.innerHTML = resultstr

src/main/scala/gui/domobjects.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,6 @@ object DomObjects:
128128
val check_wpm = document
129129
.getElementById("check_wpm")
130130
.asInstanceOf[HTMLInputElement]
131+
val check_nds = document
132+
.getElementById("check_nds")
133+
.asInstanceOf[HTMLInputElement]

0 commit comments

Comments
 (0)