### Question:
SmileModelFitter { public LeastSquareResultsWithTransform solve(DoubleArray start) { return solve(start, new BitSet()); } SmileModelFitter(
      double forward,
      DoubleArray strikes,
      double timeToExpiry,
      DoubleArray impliedVols,
      DoubleArray error,
      VolatilityFunctionProvider<T> model); LeastSquareResultsWithTransform solve(DoubleArray start); LeastSquareResultsWithTransform solve(DoubleArray start, BitSet fixed); LeastSquareResultsWithTransform solve(DoubleArray start, NonLinearParameterTransforms transform); abstract T toSmileModelData(DoubleArray modelParameters); VolatilityFunctionProvider<T> getModel();  }### Answer:
@Test @SuppressWarnings("unused") public void testExactFit() { double[][] start = getStartValues(); BitSet[] fixed = getFixedValues(); int nStartPoints = start.length; ArgChecker.isTrue(fixed.length == nStartPoints); for (int trys = 0; trys < nStartPoints; trys++) { LeastSquareResultsWithTransform results = _fitter.solve(DoubleArray.copyOf(start[trys]), fixed[trys]); DoubleArray res = results.getModelParameters(); assertThat(0.0).isCloseTo(results.getChiSq(), offset(_chiSqEps)); int n = res.size(); T data = getModelData(); assertThat(data.getNumberOfParameters()).isEqualTo(n); for (int i = 0; i < n; i++) { assertThat(data.getParameter(i)).isCloseTo(res.get(i), offset(_paramValueEps)); } } }
@Test public void testNoisyFit() { double[][] start = getStartValues(); BitSet[] fixed = getFixedValues(); int nStartPoints = start.length; ArgChecker.isTrue(fixed.length == nStartPoints); for (int trys = 0; trys < nStartPoints; trys++) { LeastSquareResultsWithTransform results = _nosiyFitter.solve(DoubleArray.copyOf(start[trys]), fixed[trys]); DoubleArray res = results.getModelParameters(); double eps = 1e-2; assertThat(results.getChiSq() < 7).isTrue(); int n = res.size(); T data = getModelData(); assertThat(data.getNumberOfParameters()).isEqualTo(n); for (int i = 0; i < n; i++) { assertThat(data.getParameter(i)).isCloseTo(res.get(i), offset(eps)); } } }