Test Net
- added net test - added more docs
This commit is contained in:
@@ -14,10 +14,6 @@ public class Main {
|
||||
String csv = null;
|
||||
var runs = 100;
|
||||
var seed = 2007539552L;
|
||||
var total = 10000;
|
||||
var lambda = 1.0 / 4.5;
|
||||
var mu = 3.2;
|
||||
var sigma = 0.6;
|
||||
|
||||
// Evantually change the parameters
|
||||
var arguments = parseParameters(args);
|
||||
@@ -29,26 +25,11 @@ public class Main {
|
||||
csv = arguments.get("csv");
|
||||
var parallel = arguments.containsKey("p");
|
||||
|
||||
// varius distributions
|
||||
var distrExp = new Distribution.Exponential(lambda);
|
||||
var distrNorm = new Distribution.NormalBoxMuller(mu, sigma);
|
||||
var distrUnav = new Distribution.UnavailableTime(0.2, distrNorm);
|
||||
|
||||
// Build the network
|
||||
var net = new Net();
|
||||
var node1 = ServerNode.createLimitedSource("Source", distrExp, total);
|
||||
var node2 = ServerNode.createQueue("Queue", 1, distrNorm);
|
||||
var node3 = ServerNode.createQueue("Queue Wait", 1, distrNorm, distrUnav);
|
||||
net.addNode(node1);
|
||||
net.addNode(node2);
|
||||
net.addNode(node3);
|
||||
net.addConnection(node1, node2, 1.0);
|
||||
net.addConnection(node2, node3, 1.0);
|
||||
net.normalizeWeights();
|
||||
|
||||
/// Run multiple simulations
|
||||
var net = moreComplexNet();
|
||||
// var maxDepartures = new EndSimulationCriteria.MaxDepartures("Queue", total);
|
||||
// var maxTime = new EndSimulationCriteria.MaxTime(1000.0);
|
||||
|
||||
/// Run multiple simulations
|
||||
var nano = System.nanoTime();
|
||||
var sim = new SimulationMultiple(net);
|
||||
var results = parallel ? sim.runParallel(seed, runs) : sim.run(seed, runs);
|
||||
@@ -64,6 +45,39 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
public static Net simpleNet() {
|
||||
var lambda = 1.0 / 4.5;
|
||||
var mu = 3.2;
|
||||
var sigma = 0.6;
|
||||
var total = 10000;
|
||||
|
||||
var distrExp = new Distribution.Exponential(lambda);
|
||||
var distrNorm = new Distribution.NormalBoxMuller(mu, sigma);
|
||||
|
||||
// Build the network
|
||||
var net = new Net();
|
||||
net.addNode(ServerNode.createLimitedSource("Source", distrExp, total));
|
||||
net.addNode(ServerNode.createQueue("Queue", 1, distrNorm));
|
||||
net.addConnection(0, 1, 1.0);
|
||||
net.normalizeWeights();
|
||||
|
||||
return net;
|
||||
}
|
||||
|
||||
public static Net moreComplexNet() {
|
||||
var net = simpleNet();
|
||||
var distrNorm = new Distribution.NormalBoxMuller(3.2, 0.6);
|
||||
var distrNorm2 = new Distribution.NormalBoxMuller(4.2, 0.6);
|
||||
var distrUnav = new Distribution.UnavailableTime(0.2, distrNorm2);
|
||||
|
||||
// Build the network
|
||||
net.addNode(ServerNode.createQueue("Queue Wait", 1, distrNorm, distrUnav));
|
||||
net.addConnection(1, 2, 1.0);
|
||||
net.normalizeWeights();
|
||||
|
||||
return net;
|
||||
}
|
||||
|
||||
public static Map<String, String> parseParameters(String[] args) {
|
||||
var arguments = new HashMap<String, Boolean>();
|
||||
arguments.put("p", false);
|
||||
|
||||
Reference in New Issue
Block a user