code: public double valueSum() {
  
      // We want the exp(log-sum-exp), for stability
      // This rearranges to exp(a)*(sum-exp)
  
      double max = 0.0;
      for (int[] assignment : this) {
        double v = getAssignmentLogValue(assignment);
        if (v > max) {
          max = v;
        }
      }
  
      double sumExp = 0.0;
      for (int[] assignment : this) {
        double assigmentLogValue = getAssignmentLogValue(assignment);
        assert !Double.isNaN(assigmentLogValue);
        sumExp += Math.exp(getAssignmentLogValue(assignment) - max);
      }
  
      assert !Double.isNaN(sumExp);
      assert !Double.isNaN(max);
      return sumExp * Math.exp(max);
    }
docs: This is useful for calculating the partition function, and is exposed here because when implemented internally
  we can do a much more numerically stable summation.
  
  @return the sum of all values for all assignments to the TableFactor