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
18 package org.apache.commons.math3.optimization.direct;
19
20 import org.apache.commons.math3.analysis.MultivariateFunction;
21 import org.apache.commons.math3.optimization.BaseMultivariateOptimizer;
22 import org.apache.commons.math3.optimization.BaseMultivariateSimpleBoundsOptimizer;
23 import org.apache.commons.math3.optimization.GoalType;
24 import org.apache.commons.math3.optimization.InitialGuess;
25 import org.apache.commons.math3.optimization.SimpleBounds;
26 import org.apache.commons.math3.optimization.PointValuePair;
27 import org.apache.commons.math3.optimization.ConvergenceChecker;
28
29 /**
30 * Base class for implementing optimizers for multivariate scalar functions,
31 * subject to simple bounds: The valid range of the parameters is an interval.
32 * The interval can possibly be infinite (in one or both directions).
33 * This base class handles the boiler-plate methods associated to thresholds
34 * settings, iterations and evaluations counting.
35 *
36 * @param <FUNC> Type of the objective function to be optimized.
37 *
38 * @version $Id: BaseAbstractMultivariateSimpleBoundsOptimizer.java 1462503 2013-03-29 15:48:27Z luc $
39 * @deprecated As of 3.1 (to be removed in 4.0).
40 * @since 3.0
41 * @deprecated As of 3.1 since the {@link BaseAbstractMultivariateOptimizer
42 * base class} contains similar functionality.
43 */
44 @Deprecated
45 public abstract class BaseAbstractMultivariateSimpleBoundsOptimizer<FUNC extends MultivariateFunction>
46 extends BaseAbstractMultivariateOptimizer<FUNC>
47 implements BaseMultivariateOptimizer<FUNC>,
48 BaseMultivariateSimpleBoundsOptimizer<FUNC> {
49 /**
50 * Simple constructor with default settings.
51 * The convergence checker is set to a
52 * {@link org.apache.commons.math3.optimization.SimpleValueChecker}.
53 *
54 * @see BaseAbstractMultivariateOptimizer#BaseAbstractMultivariateOptimizer()
55 * @deprecated See {@link org.apache.commons.math3.optimization.SimpleValueChecker#SimpleValueChecker()}
56 */
57 @Deprecated
58 protected BaseAbstractMultivariateSimpleBoundsOptimizer() {}
59
60 /**
61 * @param checker Convergence checker.
62 */
63 protected BaseAbstractMultivariateSimpleBoundsOptimizer(ConvergenceChecker<PointValuePair> checker) {
64 super(checker);
65 }
66
67 /** {@inheritDoc} */
68 @Override
69 public PointValuePair optimize(int maxEval, FUNC f, GoalType goalType,
70 double[] startPoint) {
71 return super.optimizeInternal(maxEval, f, goalType,
72 new InitialGuess(startPoint));
73 }
74
75 /** {@inheritDoc} */
76 public PointValuePair optimize(int maxEval, FUNC f, GoalType goalType,
77 double[] startPoint,
78 double[] lower, double[] upper) {
79 return super.optimizeInternal(maxEval, f, goalType,
80 new InitialGuess(startPoint),
81 new SimpleBounds(lower, upper));
82 }
83 }