return 1 if solution 2 is better
429636
public static int ParetoObjectiveCompare(Solution solution1, Solution solution2)
   {
      boolean dominate1 = false;
      boolean dominate2 = false;

      int objective_count = solution1.getCosts().size();
      for (int i = 0; i < objective_count; i++)
      {
         if (solution1.getCost(i) < solution2.getCost(i))
         {
            dominate1 = true; // solution 2 is dominated

            if (dominate2)
            {
               return 0;
            }
         }
         else if (solution1.getCost(i) > solution2.getCost(i))
         {
            dominate2 = true; // solution 1 is dominated

            if (dominate1)
            {
               return 0;
            }
         }
      }

      if (dominate1 == dominate2)
      {
         return 0;
      }
      else if (dominate1)
      {
         return -1;
      }
      else
      {
         return 1;
      }
   }
130702
def hcf(num1, num2):
    

    if num1 > num2:
        smaller = num2
    else:
        smaller = num1
    for i in range(1, smaller + 1):
        if ((num1 % i == 0) and (num2 % i == 0)):
            return i
1153017
def better_result(base_result, result = nil)
      base_result ||= {}
      return base_result unless result

      return result unless base_result.values.find { |e| e[:possible].any? }

      return result if result.values.find { |e| e[:valid].any? }

      base_result
    end
1084052
function or(arr1, arr2) {
                var ans = new Array(arr1.length);
                for (var i = 0; i < arr1.length; i++)
                    ans[i] = arr1[i] | arr2[i];
                return ans;
            }
244173
public static int ParetoConstraintCompare(Solution solution1, Solution solution2)
   {
      boolean dominate1 = false;
      boolean dominate2 = false;

      int constraint_count = solution1.getConstraints().size();
      for (int i = 0; i < constraint_count; i++)
      {
         if (Math.abs(solution1.getConstraint(i)) < Math.abs(solution2.getConstraint(i)))
         {
            dominate1 = true;
            if (dominate2)
            {
               return 0;
            }
         }
         else if (Math.abs(solution1.getConstraint(i)) > Math.abs(solution2.getConstraint(i)))
         {
            dominate2 = true;
            if (dominate1)
            {
               return 0;
            }
         }
      }

      if (dominate1 == dominate2)
      {
         return 0;
      }
      else if (dominate1)
      {
         return -1;
      }
      else
      {
         return 1;
      }
   }
1348093
def compare (v1, v2):
    """"""
    v1_norm = normalize(v1)
    v2_norm = normalize(v2)
    if v1_norm < v2_norm:
        return -1
    if v1_norm > v2_norm:
        return 1
    return 0
353352
def norm(a, ref1, ref2):
    
    ref = ref1[valid(ref1, ref2)]
    return (a-ref.min())/(ref.max()-ref.min())
539470
def equal(self, a, b, message=None):
        ""
        if a != b:
            self.log_error("{} != {}".format(str(a), str(b)), message)
            return False
        return True
684199
def compare(self, v1, v2):
        
        try:
            if len(v1) != len(v2): return 0
            for x, y in zip(v1, v2):
                if abs( x - y ) > self.tolerance:
                    return 0
            return 1
        except:
            # some patterns may not be vectors
            try:
                if abs( v1 - v2 ) > self.tolerance:
                    return 0
                else:
                    return 1
            except:
                return 0
863998
public static int invertedCompare(Solution s1, Solution s2) {
      int flag = InvertedCompareUtils.RankCompare(s1, s2);

      if (flag == 0)
      {
         flag = InvertedCompareUtils.CrowdingDistanceCompare(s1, s2);
      }
      return flag;
   }
1279352
function compareSpecificity(first, second) {
    for (var i = 0; i < first.length; i++) {
        var a = first[i];
        var b = second[i];

        if (a === b) {
            continue;
        }

        return a - b;
    }

    return 0;
}
672211
private static int compare(long v1, long v2) {
		int pos = 0;
		if (v1 != v2) {
			long x = v1 ^ v2;
			pos += Long.numberOfLeadingZeros(x);
			return pos;
		}
		return -1;
	}
955445
public int compare(final SnomedConcept o1, final SnomedConcept o2) {
        if (o1 == o2) return 0;
        if (o1 != null) {
            if (o2 == null) return 1;
            else return o1.phraseText.compareTo(o2.phraseText);
        }
        return -1;
    }
1199028
def infer(self, setup: QuaRelType, answer_0: QuaRelType, answer_1: QuaRelType) -> int:
        
        if self._check_quarels_compatible(setup, answer_0):
            if self._check_quarels_compatible(setup, answer_1):
                # Found two answers
                return -2
            else:
                return 0
        elif self._check_quarels_compatible(setup, answer_1):
            return 1
        else:
            return -1
1023629
def unordered_pair_eq(pair1, pair2):
    '''
    '''
    (x1, y1), (x2, y2) = pair1, pair2
    return (x1 == x2 and y1 == y2) or (x1 == y2 and y1 == x2)
456202
def compare(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False):
    '''
    
    '''
    cmp_map = {'<': (-1,), '<=': (-1, 0), '==': (0,),
               '>=': (0, 1), '>': (1,)}
    if oper not in ('!=',) and oper not in cmp_map:
        log.error('Invalid operator \'%s\' for version comparison', oper)
        return False

    if cmp_func is None:
        cmp_func = version_cmp

    cmp_result = cmp_func(ver1, ver2, ignore_epoch=ignore_epoch)
    if cmp_result is None:
        return False

    # Check if integer/long
    if not isinstance(cmp_result, numbers.Integral):
        log.error('The version comparison function did not return an '
                  'integer/long.')
        return False

    if oper == '!=':
        return cmp_result not in cmp_map['==']
    else:
        # Gracefully handle cmp_result not in (-1, 0, 1).
        if cmp_result < -1:
            cmp_result = -1
        elif cmp_result > 1:
            cmp_result = 1

        return cmp_result in cmp_map[oper]
144769
def _one_contains_other(s1, s2):
    
    return min(len(s1), len(s2)) == len(s1 & s2)