@Override
  public double evaluateLocalPolicy(
      Gene gene, MSApplicationNode node, IMSProvider prov, InternetEstimator internet) {
    Double budget = (Double) node.getCharacteristic().get(Constant.BUDGET);
    Double s_maxCost = (highStorageCost * StorageConstraint.getHighStorageValue());
    Double r_maxCost = (highRamCost * RamConstraint.getHighRamValue());

    Double cost = calculateCost(node, prov);
    ((CIntegerGene) gene).setAllocationCost(cost);

    Double maxCost = r_maxCost + s_maxCost;
    // maxCost = (budget > maxCost) ? budget : maxCost; // the max value could be the budget
    maxCost = (budget);

    double distance = calculateDistance_ErrHandling(cost, budget, maxCost);
    return distance * getWeight();
  }
  @Override
  public double evaluateGlobalPolicy(
      int gene_index,
      IChromosome chromos,
      IMSApplication app,
      IMSProvider prov,
      InternetEstimator internet) {
    List<MSApplicationNode> nodes = app.getNodes();
    MSApplicationNode node = nodes.get(gene_index);
    Double budget = (Double) node.getCharacteristic().get(Constant.BUDGET);
    Double cost = calculateCost_Network(gene_index, chromos, app, prov);

    ((CIntegerGene) chromos.getGene(gene_index)).setAllocationCost(cost);

    Double maxCost = budget;
    double distance = calculateDistance_ErrHandling(cost, budget, maxCost);

    return distance * getWeight();
  }