private boolean isParamConstraintViolated(List<JobSuggestedParamValue> jobSuggestedParamValueList,
      TuningAlgorithm.JobType jobType) {

    logger.info("Checking whether parameter values are within constraints");
    Integer violations = 0;

    if (jobType.equals(TuningAlgorithm.JobType.PIG)) {
      Double mrSortMemory = null;
      Double mrMapMemory = null;
      Double pigMaxCombinedSplitSize = null;

      for (JobSuggestedParamValue jobSuggestedParamValue : jobSuggestedParamValueList) {
        if (jobSuggestedParamValue.tuningParameter.paramName.equals("mapreduce.task.io.sort.mb")) {
          mrSortMemory = jobSuggestedParamValue.paramValue;
        } else if (jobSuggestedParamValue.tuningParameter.paramName.equals("mapreduce.map.memory.mb")) {
          mrMapMemory = jobSuggestedParamValue.paramValue;
        } else if (jobSuggestedParamValue.tuningParameter.paramName.equals("pig.maxCombinedSplitSize")) {
          pigMaxCombinedSplitSize = jobSuggestedParamValue.paramValue / FileUtils.ONE_MB;
        }
      }

      if (mrSortMemory != null && mrMapMemory != null) {
        if (mrSortMemory > 0.6 * mrMapMemory) {
          logger.info("Constraint violated: Sort memory > 60% of map memory");
          violations++;
        }
        if (mrMapMemory - mrSortMemory < 768) {
          logger.info("Constraint violated: Map memory - sort memory < 768 mb");
          violations++;
        }
      }

      if (pigMaxCombinedSplitSize != null && mrMapMemory != null && (pigMaxCombinedSplitSize > 1.8 * mrMapMemory)) {
        logger.info("Constraint violated: Pig max combined split size > 1.8 * map memory");
        violations++;
      }
    }
    if (violations == 0) {
      return false;
    } else {
      logger.info("Number of constraint(s) violated: " + violations);
      return true;
    }
  }
Check if the parameters violated constraints
Constraint 1: sort.mb > 60% of map.memory: To avoid heap memory failure
Constraint 2: map.memory - sort.mb < 768: To avoid heap memory failure
Constraint 3: pig.maxCombinedSplitSize > 1.8*mapreduce.map.memory.mb
@param jobSuggestedParamValueList List of suggested param values
@param jobType Job type
@return true if the constraint is violated, false otherwise
app/com/linkedin/drelephant/tuning/ParamGenerator.java