1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.commons.math4.legacy.fitting.leastsquares;
18
19 /**
20 * An algorithm that can be applied to a non-linear least squares problem.
21 *
22 * @since 3.3
23 */
24 public interface LeastSquaresOptimizer {
25
26 /**
27 * Solve the non-linear least squares problem.
28 *
29 *
30 * @param leastSquaresProblem the problem definition, including model function and
31 * convergence criteria.
32 * @return The optimum.
33 */
34 Optimum optimize(LeastSquaresProblem leastSquaresProblem);
35
36 /**
37 * The optimum found by the optimizer. This object contains the point, its value, and
38 * some metadata.
39 */
40 //TODO Solution?
41 interface Optimum extends LeastSquaresProblem.Evaluation {
42
43 /**
44 * Get the number of times the model was evaluated in order to produce this
45 * optimum.
46 *
47 * @return the number of model (objective) function evaluations
48 */
49 int getEvaluations();
50
51 /**
52 * Get the number of times the algorithm iterated in order to produce this
53 * optimum. In general least squares it is common to have one {@link
54 * #getEvaluations() evaluation} per iterations.
55 *
56 * @return the number of iterations
57 */
58 int getIterations();
59 }
60 }