Refatoring

- separated net topology from the simulation nodes
- moved files in a better hierarchy
This commit is contained in:
2025-01-22 17:04:53 +01:00
parent b9cd0ddeb7
commit 69b8e5710b
10 changed files with 511 additions and 408 deletions

View File

@@ -1,6 +1,9 @@
package net.berack.upo.valpre;
import net.berack.upo.valpre.rand.Distribution;
import net.berack.upo.valpre.sim.SimulationMultiple;
import net.berack.upo.valpre.sim.Net;
import net.berack.upo.valpre.sim.ServerNode;
public class Main {
public static void main(String[] args) throws Exception {
@@ -12,18 +15,19 @@ public class Main {
var sigma = 0.6;
// Build the network
var net = new Net();
var node1 = ServerNode.createLimitedSource("Source", new Distribution.Exponential(lambda), total);
var node2 = ServerNode.createQueue("Queue", 1, new Distribution.NormalBoxMuller(mu, sigma));
node1.addChild(node2, 1.0);
/// Run the simulation
var sim = new NetSimulation();
sim.addNode(node1);
sim.addNode(node2);
net.addNode(node1);
net.addNode(node2);
net.addConnection(node1.name, node2.name, 1.0);
net.normalizeWeights();
/// Run multiple simulations
// var maxDepartures = new EndSimulationCriteria.MaxDepartures("Queue", total);
// var maxTime = new EndSimulationCriteria.MaxTime(1000.0);
var nano = System.nanoTime();
var sim = new SimulationMultiple(net);
var results = sim.runParallel(seed, 1000);
nano = System.nanoTime() - nano;