some benchmarks for scheduling
[IRC.git] / Robust / src / Benchmarks / PERT / Mcore / Stage.java
index 79d685732c6584f64edc43cf9ee6a99be9af58fe..accb9bbcc92a92c4435d50e5326dfcae11f4c1bc 100644 (file)
@@ -10,55 +10,71 @@ public class Stage {
     int nortime;
     int petime;
     int time;
-    double variance2;
+    float variance2;
 
     public Stage(int id) {
-       System.printI(0xff20);
+       //System.printI(0xff20);
        this.ID = id;
 
        this.samplings = new int[10];
-       System.printI(0xff21);
+       //System.printI(0xff21);
        for(int i = 0; i < this.samplings.length; ++i) {
-               System.printI(0xff22);
            this.samplings[i] = 0;
+           //System.printString(tint + "; ");
        }
-       System.printI(0xff23);
+       //System.printI(0xff23);
 
        this.optime = 0;
        this.nortime = 0;
        this.petime = 0;
        this.time = 0;
        this.variance2 = 0;
-       System.printI(0xff24);
+       //System.printI(0xff24);
     }
 
     public void sampling() {
-       System.printI(0xff00);
-       Random r = new Random(ID);
-       System.printI(0xff01);
+       //System.printI(0xff00);
        int tint = 0;
-       System.printI(this.samplings.length);
-       for(int i = 0; i < this.samplings.length; ++i) {
-           do {
-               tint = r.nextInt()%50;
-           } while(tint <= 0);
-               System.printI(0xff02);
-           this.samplings[i] = tint;
-           //System.printString(tint + "; ");
+       //System.printI(this.samplings.length);
+       int i = 0;
+       if(this.ID == 0) {
+           //System.printI(0xff01);
+           this.samplings[i++] = 33;
+           this.samplings[i++] = 36;
+           this.samplings[i++] = 27;
+           this.samplings[i++] = 15;
+           this.samplings[i++] = 43;
+           this.samplings[i++] = 35;
+           this.samplings[i++] = 36;
+           this.samplings[i++] = 42;
+           this.samplings[i++] = 49;
+           this.samplings[i++] = 21;
+       } else if(this.ID == 1) {
+           //System.printI(0xff02);
+           this.samplings[i++] = 12;
+           this.samplings[i++] = 27;
+           this.samplings[i++] = 40;
+           this.samplings[i++] = 9;
+           this.samplings[i++] = 13;
+           this.samplings[i++] = 26;
+           this.samplings[i++] = 40;
+           this.samplings[i++] = 26;
+           this.samplings[i++] = 22;
+           this.samplings[i++] = 36;
        }
-       System.printI(0xff03);
+       //System.printI(0xff03);
     }
 
     public void estimate() {
-       System.printI(0xff10);
+       //System.printI(0xff10);
        int highest = this.samplings[0];
-       System.printI(0xff12);
+       //System.printI(0xff12);
        int lowest = this.samplings[0];
        int sum = this.samplings[0];
-       System.printI(0xff13);
-       System.printI(this.samplings.length);
+       //System.printI(0xff13);
+       //System.printI(this.samplings.length);
        for(int i = 1; i < this.samplings.length; ++i) {
-               System.printI(0xff14);
+               //System.printI(0xff14);
            int temp = this.samplings[i];
            if(temp > highest) {
                highest = temp;
@@ -67,17 +83,17 @@ public class Stage {
            }
            sum += temp;
        }
-       System.printI(0xff15);
+       //System.printI(0xff15);
        sum  = sum - highest - lowest;
        int ordinary = sum / (this.samplings.length - 2);
        this.optime = lowest;;
        this.petime = highest;
        this.nortime = ordinary;
-       System.printI(0xff16);
+       //System.printI(0xff16);
        this.time = (this.optime + 4 * this.nortime + this.petime) / 6;
-       System.printI(0xff17);
-       this.variance2 = (double)(this.optime - this.petime) * (double)(this.optime - this.petime) / 36.0;
-       System.printI(0xff18);
+       //System.printI(0xff17);
+       this.variance2 = (float)(this.optime - this.petime) * (float)(this.optime - this.petime) / (float)36.0;
+       //System.printI(0xff18);
        //System.printString("Op time: " + this.optime + "; Nor time: " + this.nortime + "; Pe time: " + this.petime + "; variance2: " + (int)(this.variance2*100) + "(/100)\n");
     }
 
@@ -85,7 +101,7 @@ public class Stage {
        return this.time;
     }
 
-    public double getAntVariance2() {
+    public float getAntVariance2() {
        return this.variance2;
     }