~ubuntu-branches/ubuntu/oneiric/commons-math/oneiric

« back to all changes in this revision

Viewing changes to src/main/java/org/apache/commons/math/optimization/UnivariateRealOptimizer.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan, Torsten Werner, Damien Raude-Morvan
  • Date: 2011-03-07 21:14:46 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110307211446-4zea7og4eeyzhpai
Tags: 2.2-1
[ Torsten Werner ]
* Change maintainers into Maintainers.

[ Damien Raude-Morvan ]
* New upstream release (Closes: #617209).
* d/control: Bump Standards-Version to 3.9.1 (no changes needed).
* d/copyright: Refresh years, upgrade to DEP5 r166 and relicence my work
  under Apache-2.0.
* d/ant.properties: Set junit.jar to /usr/share/java/junit4.jar
  to ensure unit tests are launched.
* d/docs: Install upstream RELEASE-NOTES.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
package org.apache.commons.math.optimization;
18
18
 
19
19
import org.apache.commons.math.ConvergenceException;
 
20
import org.apache.commons.math.FunctionEvaluationException;
20
21
import org.apache.commons.math.ConvergingAlgorithm;
21
 
import org.apache.commons.math.FunctionEvaluationException;
22
22
import org.apache.commons.math.analysis.UnivariateRealFunction;
23
23
 
24
24
 
25
25
/**
26
26
 * Interface for (univariate real) optimization algorithms.
27
27
 *
28
 
 * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $
 
28
 * @version $Revision: 1073658 $ $Date: 2011-02-23 10:45:42 +0100 (mer. 23 févr. 2011) $
29
29
 * @since 2.0
30
30
 */
31
31
public interface UnivariateRealOptimizer extends ConvergingAlgorithm {
36
36
    void setMaxEvaluations(int maxEvaluations);
37
37
 
38
38
    /** Get the maximal number of functions evaluations.
39
 
     * @return maximal number of functions evaluations
 
39
     * @return the maximal number of functions evaluations.
40
40
     */
41
41
    int getMaxEvaluations();
42
42
 
46
46
     * {@link #optimize(UnivariateRealFunction, GoalType, double, double) optimize}
47
47
     * method. It is 0 if the method has not been called yet.
48
48
     * </p>
49
 
     * @return number of evaluations of the objective function
 
49
     * @return the number of evaluations of the objective function.
50
50
     */
51
51
    int getEvaluations();
52
52
 
57
57
     * </p>
58
58
     * @param f the function to optimize.
59
59
     * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE}
60
 
     * or {@link GoalType#MINIMIZE}
 
60
     * or {@link GoalType#MINIMIZE}.
61
61
     * @param min the lower bound for the interval.
62
62
     * @param max the upper bound for the interval.
63
 
     * @return a value where the function is optimum
 
63
     * @return a value where the function is optimum.
64
64
     * @throws ConvergenceException if the maximum iteration count is exceeded
65
65
     * or the optimizer detects convergence problems otherwise.
66
 
     * @throws FunctionEvaluationException if an error occurs evaluating the
67
 
     * function
 
66
     * @throws FunctionEvaluationException if an error occurs evaluating the function.
68
67
     * @throws IllegalArgumentException if min > max or the endpoints do not
69
 
     * satisfy the requirements specified by the optimizer
 
68
     * satisfy the requirements specified by the optimizer.
70
69
     */
71
70
    double optimize(UnivariateRealFunction f, GoalType goalType,
72
71
                    double min, double max)
79
78
     * </p>
80
79
     * @param f the function to optimize.
81
80
     * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE}
82
 
     * or {@link GoalType#MINIMIZE}
 
81
     * or {@link GoalType#MINIMIZE}.
83
82
     * @param min the lower bound for the interval.
84
83
     * @param max the upper bound for the interval.
85
 
     * @param startValue the start value to use
86
 
     * @return a value where the function is optimum
 
84
     * @param startValue the start value to use.
 
85
     * @return a value where the function is optimum.
87
86
     * @throws ConvergenceException if the maximum iteration count is exceeded
88
87
     * or the optimizer detects convergence problems otherwise.
89
 
     * @throws FunctionEvaluationException if an error occurs evaluating the
90
 
     * function
 
88
     * @throws FunctionEvaluationException if an error occurs evaluating the function.
91
89
     * @throws IllegalArgumentException if min > max or the arguments do not
92
 
     * satisfy the requirements specified by the optimizer
 
90
     * satisfy the requirements specified by the optimizer.
 
91
     * @throws IllegalStateException if there are no data.
93
92
     */
94
93
    double optimize(UnivariateRealFunction f, GoalType goalType,
95
94
                    double min, double max, double startValue)
98
97
    /**
99
98
     * Get the result of the last run of the optimizer.
100
99
     *
101
 
     * @return the last result.
 
100
     * @return the optimum.
102
101
     * @throws IllegalStateException if there is no result available, either
103
102
     * because no result was yet computed or the last attempt failed.
104
103
     */
107
106
    /**
108
107
     * Get the result of the last run of the optimizer.
109
108
     *
110
 
     * @return the value of the function at the last result.
 
109
     * @return the value of the function at the optimum.
 
110
     * @throws FunctionEvaluationException if an error occurs evaluating the function.
111
111
     * @throws IllegalStateException if there is no result available, either
112
112
     * because no result was yet computed or the last attempt failed.
113
113
     */
114
 
    double getFunctionValue();
 
114
    double getFunctionValue() throws FunctionEvaluationException;
115
115
 
116
116
}