code: public static int ConstraintCompare(Solution solution1, Solution solution2)
     {
        double constraints1 = 0;
        int constraint_count = solution1.getConstraints().size();
        for (int i = 0; i < constraint_count; i++)
        {
           constraints1 += Math.abs(solution1.getConstraint(i));
        }
  
        double constraints2 = 0;
        for (int i = 0; i < constraint_count; i++)
        {
           constraints2 += Math.abs(solution2.getConstraint(i));
        }
  
        if ((constraints1 != 0.0) || (constraints2 != 0.0))
        {
           if (constraints1 == 0.0)
           {
              return -1;
           }
           else if (constraints2 == 0.0)
           {
              return 1;
           }
           else
           {
              return Double.compare(constraints1, constraints2);
           }
        }
        else
        {
           return 0;
        }
     }
docs: return 1 if solution 2 is better