-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDiscreteLLL2D.kt
37 lines (28 loc) · 1.08 KB
/
DiscreteLLL2D.kt
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
/*
* This file is an example of how to use the IterativeDiscreteSimulation class to create a simulation.
* It uses one of the system declarations from Systems.kt and the LLL2D() algorithm from Algorithms.Kt
*/
package com.aditshah.distributed.simulations
import com.aditshah.distributed.infrastructure.simulation.IterativeDiscreteSimulation
import kotlin.time.seconds
fun main() {
val simulation = IterativeDiscreteSimulation.create {
system(numNodes = 5) {
system50Corner()
}
//Setting some constants for the algorithm (defined here in case they need to be used for visualization component)
val coverageRadius = 3.16 //2.24
val movementRadius = 1.415
// val tau = 50.0
// var tau = Tau(coverageRadius.pow(2) * 1.0)
var tau = Tau(100000.0)
val tauDecay = 0.999
visualization {
addComponent("/coverageRadius", coverageRadius)
}
algorithm(delayPeriod = 0.01.seconds) {
LLL2D(coverageRadius, movementRadius, tau, tauDecay)
}
}
simulation.start()
}