Add new images and update README with network modifications; improve ConsoleTable formatting

This commit is contained in:
2025-03-22 09:39:23 +01:00
parent e48bddf94d
commit 3844a46379
9 changed files with 1132 additions and 1044 deletions

View File

@@ -55,4 +55,23 @@ public class TestRandom {
assertTrue("Standard Dev must be less than [" + expected + "] -> [" + stdDev + "]", stdDev < expected);
}
@Test
public void testMean() {
var rng = new Rng();
var normal = new Distribution.NormalBoxMuller(1 / 3.5, 0.6);
var mean = 0.0;
for (var i = 0; i < 100000; i++) {
var sample = Distribution.getPositiveSample(normal, rng);
mean = (mean * (i + 1) + sample) / (i + 2);
}
assertEquals(0.6, mean, 0.01);
for (var i = 0; i < 100000; i++) {
var sample = Math.max(0, normal.sample(rng));
mean = (mean * (i + 1) + sample) / (i + 2);
}
assertEquals(0.41, mean, 0.01);
}
}

View File

@@ -144,8 +144,8 @@ public class TestInteractions {
// Test the interactive console LOAD EXAMPLE 2
net = runInteraction("4", "2", "2", "7");
assertEquals("Source[servers:1, queue:100, spawn:10000, Exponential(1.5)] -> Service1(1.0)\n"
+ "Service1[servers:1, queue:100, spawn:0, Exponential(2.0)] -> Service2(1.0)\n"
assertEquals("Source[servers:1, queue:100, spawn:10000, Exponential(1.5)] -> Service(1.0)\n"
+ "Service[servers:1, queue:100, spawn:0, Exponential(2.0)] -> Service2(1.0)\n"
+ "Service2[servers:1, queue:100, spawn:0, Exponential(3.5), u:UnavailableTime(0.1, Exponential(10.0))] -\n",
net.toString());
}