package ift6561examples; import umontreal.ssj.stat.Tally; import java.io.*; public class CallCenterCRN extends CallCenter { Tally statQoS1 = new Tally ("stats on QoS for config.1"); Tally statQoS2 = new Tally ("stats on QoS for config.2"); Tally statQoS3 = new Tally ("stats on QoS for config.3"); Tally statLR1 = new Tally ("stats on loss rate for config.1"); Tally statLR2 = new Tally ("stats on loss rate for config.2"); Tally statLR3 = new Tally ("stats on loss rate for config.3"); Tally statWait1 = new Tally ("stats on waiting time for config.1"); Tally statWait2 = new Tally ("stats on waiting time for config.2"); Tally statWait3 = new Tally ("stats on waiting time for config.3"); Tally statDiffQoS21 = new Tally ("stats on difference between config.2 and config.1 for QoS"); Tally statDiffQoS31 = new Tally ("stats on difference between config.3 and config.1 for QoS"); Tally statDiffLR21 = new Tally ("stats on difference between config.2 and config.1 for loss rate"); Tally statDiffLR31 = new Tally ("stats on difference between config.3 and config.1 for loss rate"); Tally statDiffWait21 = new Tally ("stats on difference between config.2 and config.1 for waiting time"); Tally statDiffWait31 = new Tally ("stats on difference between config.3 and config.1 for waiting time"); double p1, p2, p3; double nu1, nu2, nu3; public CallCenterCRN (String fileName, double p1, double nu1, double p2, double nu2, double p3, double nu3) throws IOException { super (fileName); this.p1 = p1; this.p2 = p2; this.p3 = p3; this.nu1 = nu1; this.nu2 = nu2; this.nu3 = nu3; } // Overridden to support the case of no abandonment public double generPatience() { if (nu <= 0) // ExponentialDist.inverseF crashes with nu = 0. return Double.POSITIVE_INFINITY; else return super.generPatience(); } public void setPatience (double p, double nu) { this.p = p; this.nu = nu; } public void simulateDiffCRN (int n) { double qos1, qos2, qos3, lr1, lr2, lr3, w1, w2, w3; statQoS1.init(); statQoS2.init(); statQoS3.init(); statLR1.init(); statLR2.init(); statLR3.init(); statWait1.init(); statWait2.init(); statWait3.init(); statDiffQoS21.init(); statDiffQoS31.init(); statDiffLR21.init(); statDiffLR31.init(); statDiffWait21.init(); statDiffWait31.init(); for (int i=0; i