- fixed negative sample from distribution for time
This commit is contained in:
2025-01-17 19:47:05 +01:00
parent 7b46054b70
commit d7b968d0a2
3 changed files with 22 additions and 6 deletions

View File

@@ -133,7 +133,7 @@ public class NetSimulation {
if (event.node.maxServers > this.numServerBusy) {
this.numServerBusy++;
var time = event.node.distribution.sample(this.rng);
var time = event.node.getPositiveSample(this.rng);
var departure = Event.newDeparture(event.node, timeNow + time);
fel.add(departure);
} else {
@@ -163,7 +163,7 @@ public class NetSimulation {
if (this.queue.size() < this.numServerBusy) {
this.numServerBusy--;
} else {
var time = event.node.distribution.sample(this.rng);
var time = event.node.getPositiveSample(this.rng);
var departure = Event.newDeparture(event.node, timeNow + time);
fel.add(departure);
}
@@ -188,7 +188,7 @@ public class NetSimulation {
*/
private void addArrivalIf(boolean condition, ServerNode node, double timeNow, PriorityQueue<Event> fel) {
if (condition && node != null) {
var delay = node.distribution.sample(this.rng);
var delay = node.getPositiveSample(this.rng);
fel.add(Event.newArrival(node, timeNow + delay));
}
}