Пример #1
0
  public GenericGame test31() {
    GameQuick wo = new GameQuick(10, 10);
    wo.setBPrint(true);

    int heteroTask = 10;
    int heteroMachine = 10;

    int[] iaLength = new int[wo.getIClass()];
    for (int j = 0; j < wo.getIClass(); j++) {
      iaLength[j] = 1000 + (int) (Math.random() * 1000);
    }
    wo.setIaTask(iaLength);

    int[] iaCPU = new int[wo.getISite()];
    for (int j = 0; j < wo.getISite(); j++) {
      iaCPU[j] = 16 + (int) (Math.random() * 32);
    }
    wo.setIaCPU(iaCPU);

    double tmpPrediciton;

    double[][] dmPrediction = new double[wo.getIClass()][wo.getISite()];
    for (int i = 0; i < wo.getIClass(); i++) {
      tmpPrediciton = 10 + Math.random() * heteroTask * 10;
      for (int j = 0; j < wo.getISite(); j++) {
        dmPrediction[i][j] = tmpPrediciton * (0.5 + Math.random());
      }
    }
    wo.setDmPrediction(dmPrediction);
    wo.schedule();
    wo.printExeTimesForEachClass();

    return wo;
  }
Пример #2
0
  public GenericGame test3consistent() {
    GameQuick wo = new GameQuick(10, 10);
    wo.setBPrint(true);

    //		int heteroTask = 1000;//HiHi
    //		int heteroMachine = 100;

    int heteroTask = 1000; // HiLo
    int heteroMachine = 10;

    //		int heteroTask = 10;//LoHi
    //		int heteroMachine = 100;

    //		int heteroTask = 10;//LoLo
    //		int heteroMachine = 10;

    int[] iaLength = new int[wo.getIClass()];
    for (int j = 0; j < wo.getIClass(); j++) {
      iaLength[j] = 1000 + (int) (Math.random() * 1000);
    }
    wo.setIaTask(iaLength);

    int[] iaCPU = new int[wo.getISite()];
    double[] iaSpeedCPU = new double[wo.getISite()];
    for (int j = 0; j < wo.getISite(); j++) {
      iaCPU[j] = 16 + (int) (Math.random() * 16);
      iaSpeedCPU[j] = Math.random() * heteroMachine + 1;
    }
    wo.setIaCPU(iaCPU);

    double tmpPrediciton;

    double[][] dmPrediction = new double[wo.getIClass()][wo.getISite()];
    for (int i = 0; i < wo.getIClass(); i++) {
      tmpPrediciton = 10 + Math.random() * heteroTask * 10;
      for (int j = 0; j < wo.getISite(); j++) {
        dmPrediction[i][j] = tmpPrediciton * iaSpeedCPU[j] * (0.5 + Math.random());
      }
    }
    wo.setDmPrediction(dmPrediction);

    return wo;
  }
Пример #3
0
  public void test3_1() {
    GameQuick wo = new GameQuick(2, 2);
    wo.setBPrint(true);

    int[] iaLength = {100, 100};
    wo.setIaTask(iaLength);

    int[] iaCPU = {10, 10};
    wo.setIaCPU(iaCPU);

    double[][] dmPrediction = {
      {24, 30},
      {21, 15}
    };
    wo.setDmPrediction(dmPrediction);

    double[] daPrice = new double[2];
    for (int j = 0; j < 2; j++) {
      daPrice[j] = 1 + Math.random() * 10;
    }
    wo.setDaPrice(daPrice);

    wo.schedule();
  }
Пример #4
0
 public static Color GetRandomColor() {
   int r = (int) (Math.random() * 255);
   int g = (int) (Math.random() * 255);
   int b = (int) (Math.random() * 255);
   return new Color(r, g, b);
 }