示例#1
0
  private void normalizeServiceTemplateWeights() {

    // normalize the general criteria
    System.out.println("SYSTEM: Normalizing Service Template Weights");
    double total = 0;
    for (ServiceTemplate template : data.getServiceTemplates()) {
      total = total + template.getWeight();
    }

    for (ServiceTemplate template : data.getServiceTemplates()) {
      double res = template.getWeight() / total;
      System.out.println(
          "SYSTEM: Total: " + total + " || value: " + template.getWeight() + "|| res: " + res);
      template.setWeight((float) res);
    }
  }
示例#2
0
 // checks if the CSA has enough data for a decision
 private CSAData checkData(CSAData data) {
   if (data != null) {
     if (data.getServiceTemplates().size() > 0) {
       data.setEvalResult(OK);
       return data;
     } else {
       data.setEvalResult(ERROR_1);
       return data;
     }
   } else {
     return data;
   }
 }
示例#3
0
  private void normalizeCriteriaWeights() {

    // normalize the general criteria
    System.out.println("SYSTEM: Normalizing general criteria");
    double total = 0;
    for (Criterion crit : data.getCriteria()) {
      total = total + crit.getWeight();
    }

    for (Criterion crit : data.getCriteria()) {
      double res = crit.getWeight() / total;
      System.out.println(
          "SYSTEM: Total: " + total + " || value: " + crit.getWeight() + "|| res: " + res);
      crit.setWeight(res);
    }

    // normalize each of the Service Templates
    for (ServiceTemplate template : data.getServiceTemplates()) {
      System.out.println(
          "SYSTEM: Normalizing criteria of the serviceTemplate: " + template.getId());
      double templateTotal = 0;
      for (Criterion crit : template.getCriteria()) {
        templateTotal = templateTotal + crit.getWeight();
      }

      for (Criterion crit : template.getCriteria()) {
        double res = crit.getWeight() / templateTotal;
        System.out.println(
            "SYSTEM: Total: "
                + templateTotal
                + " || value: "
                + crit.getWeight()
                + "|| res: "
                + res);
        crit.setWeight(res);
      }
    }
  }