4import umontreal.ssj.stat.*;
5import umontreal.ssj.rng.*;
6import umontreal.ssj.randvar.*;
10 Tally waitingTimes =
new Tally(
"Waiting times");
11 Tally averageWaits =
new Tally(
"Average wait");
16 public QueueObs(
double lambda,
double mu,
int step) {
19 waitingTimes.setBroadcasting(
true);
24 public double simulate(
int numCust) {
28 for (cust = 2; cust <= numCust; cust++) {
29 Wi += genServ.nextDouble() - genArr.nextDouble();
34 return waitingTimes.average();
37 public void simulateRuns(
int n,
int numCust) {
39 for (
int i = 0; i < n; i++)
40 averageWaits.add(simulate(numCust));
47 public ObservationTrace(
int step) {
53 System.out.println(
"Customer " + cust +
" waited " + x +
" time units.");
61 ArrayList<Double> largeWaits =
new ArrayList<Double>();
63 public LargeWaitsCollector(
double threshold) {
64 this.threshold = threshold;
73 public String formatLargeWaits() {
74 return "not yet implemented...";
78 public static void main(String[] args) {
79 QueueObs queue =
new QueueObs(1.0, 2.0, 5);
80 queue.simulateRuns(2, 100);
81 System.out.println(
"\n\n" + queue.averageWaits.report());
void newObservation(StatProbe probe, double x)
Receives the new observation x broadcast by probe.
void newObservation(StatProbe probe, double x)
Receives the new observation x broadcast by probe.
This class implements random variate generators for the exponential distribution.
This is the base class for all random variate generators over the real line.
Extends the abstract class RandomStreamBase by using as a backbone (or main) generator the combined m...
The objects of this class are statistical probes or collectors, which are elementary devices for coll...
Represents an object that can listen to observations broadcast by statistical probes.