This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
102 lines (100 loc) · 4.41 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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="./style.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Graph solver</title>
<script>
MathJax = {
loader: {load: ['input/asciimath', 'output/chtml']}
}
</script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/startup.js">
</script>
</head>
<body>
<canvas id="sim"></canvas>
<div class="controls">
<h1>Ant colony optimization</h1>
<div class="algo1" id="main1" style="align-items: center; justify-content: space-between;">
<h3>Understand the algorithm</h3>
<button id="start-id">Start</button>
</div>
<div id="main2">
<ul style="padding-left:5%;" id="steps"></ul>
<div id="next-btn"></div>
<!-- <div class="button-container">
<button id="Start">Start</button>
<button id="pause">Pause</button>
<button id="next">Next</button>
</div> -->
</div>
<div class="algo1">
<h3>Initialize the simulation</h3>
<button class="start-btn" id="start-id1">Start</button>
</div>
<div class="" id="simulation">
<div class="sim-controls">
<label for="nodeNumber">Number of nodes: </label>
<input type="range" name="" id="node-number-input" min="1" max="120" step="1" value="3">
<span id="node-number-value" style="flex-grow:1"></span>
</div>
<div class="sim-controls">
<label for="antNumber">Number of ants: </label>
<input type="number" name="" id="ant-number-input" min="1" max="999" step="1" value="3" style="margin-left:5%;">
<span id="ant-number-value" style="flex-grow:1"></span>
</div>
<div class="sim-controls">
<label for="">Alpha</label>
<input type="range" name="" id="sim-alpa-input" min="0" max="10" step="0.01" style="margin-left:28%;">
<span id="sim-alpha-value" style="flex-grow:1"></span>
</div>
<div class="sim-controls">
<label for="">Beta</label>
<input type="range" name="" id="sim-beta-input" min="0" max="10" step="0.01" style="margin-left:30.5%;">
<span id="sim-beta-value" style="flex-grow:1"></span>
</div>
<button id='set-btn' style="margin-top:3%;">Set values</button>
<div id="setmsg"></div>
<h3>Start the simulation</h3>
<div class="sim-controls">
<label for="">Simulation speed</label><input type="range" name="" id="sim-speed" min="1" max="10000" step="1" value="10000">
</div>
<div class="sim-controls">
<label for="">Draw ants</label><input type="checkbox" name="" id="draw-ants">
</div>
<div class="sim-controls">
<label for="">Trace pheromone trails</label><input type="checkbox" name="" id="trace-pheromone" checked>
</div>
<div class="sim-controls">
<label for="">Trace desireability lines</label><input type="checkbox" name="" id="trace-desireability">
</div>
<div id="chart-container">
</div>
<canvas id="chart"></canvas>
<div>
The line in <span style="color:green">green</span> represents the minimum cost found yet.</br>
Current cost: <span id="current-cost"></span>
</div>
<div>
Maximum cost: <span id="max-cost"></span>
</div>
<div>
Minimum cost: <span id="min-cost"></span>
</div>
<div>
Ants discovered <span id="path-percent"></span>todo% out of all combinations that is equal to <span id="total-number-path"></span>
<div style="font-size:13px; display: inline;">
`=(fact(Number Of Nodes-1))/2`
</div>
</div>
</div>
</div>
</body>
<script src="./events.js"></script>
<script type="module" src="./main.js"></script>
</html>