15 public Stage(int id) {
18 this.samplings = new int[10];
19 for(int i = 0; i < this.samplings.length; ++i) {
20 this.samplings[i] = 0;
30 public void sampling() {
32 int tmp = samplings[samplings.length];
35 Random r = new Random(ID);
37 for(int i = 0; i < this.samplings.length; ++i) {
39 tint = r.nextInt()%50;
41 this.samplings[i] = tint;
42 //System.printString(tint + "; ");
45 //for(int i = 0; i < this.samplings.length; ++i) {
46 //this.samplings[i] = tint + i;
47 //System.printString(tint + "; ");
49 //System.printString("\n");
52 public void estimate() {
54 int tmp = samplings[samplings.length];
57 int highest = this.samplings[0];
58 int lowest = this.samplings[0];
59 int sum = this.samplings[0];
60 for(int i = 1; i < this.samplings.length; ++i) {
61 int temp = this.samplings[i];
64 } else if(temp < lowest) {
69 sum = sum - highest - lowest;
70 int ordinary = sum / (this.samplings.length - 2);
71 this.optime = lowest;;
72 this.petime = highest;
73 this.nortime = ordinary;
74 this.time = (this.optime + 4 * this.nortime + this.petime) / 6;
75 this.variance2 = (double)(this.optime - this.petime) * (double)(this.optime - this.petime) / 36.0;
76 //System.printString("Op time: " + this.optime + "; Nor time: " + this.nortime + "; Pe time: " + this.petime + "; variance2: " + (int)(this.variance2*100) + "(/100)\n");
79 public int getAntTime() {
83 public double getAntVariance2() {
84 return this.variance2;