Add new images and update README with network modifications; improve ConsoleTable formatting
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user