001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.commons.math3.optimization.direct; 019 020 import org.apache.commons.math3.analysis.MultivariateFunction; 021 import org.apache.commons.math3.optimization.BaseMultivariateOptimizer; 022 import org.apache.commons.math3.optimization.BaseMultivariateSimpleBoundsOptimizer; 023 import org.apache.commons.math3.optimization.GoalType; 024 import org.apache.commons.math3.optimization.InitialGuess; 025 import org.apache.commons.math3.optimization.SimpleBounds; 026 import org.apache.commons.math3.optimization.PointValuePair; 027 import org.apache.commons.math3.optimization.ConvergenceChecker; 028 029 /** 030 * Base class for implementing optimizers for multivariate scalar functions, 031 * subject to simple bounds: The valid range of the parameters is an interval. 032 * The interval can possibly be infinite (in one or both directions). 033 * This base class handles the boiler-plate methods associated to thresholds 034 * settings, iterations and evaluations counting. 035 * 036 * @param <FUNC> Type of the objective function to be optimized. 037 * 038 * @version $Id: BaseAbstractMultivariateSimpleBoundsOptimizer.java 1422230 2012-12-15 12:11:13Z erans $ 039 * @deprecated As of 3.1 (to be removed in 4.0). 040 * @since 3.0 041 * @deprecated As of 3.1 since the {@link BaseAbstractMultivariateOptimizer 042 * base class} contains similar functionality. 043 */ 044 @Deprecated 045 public abstract class BaseAbstractMultivariateSimpleBoundsOptimizer<FUNC extends MultivariateFunction> 046 extends BaseAbstractMultivariateOptimizer<FUNC> 047 implements BaseMultivariateOptimizer<FUNC>, 048 BaseMultivariateSimpleBoundsOptimizer<FUNC> { 049 /** 050 * Simple constructor with default settings. 051 * The convergence checker is set to a 052 * {@link org.apache.commons.math3.optimization.SimpleValueChecker}. 053 * 054 * @see BaseAbstractMultivariateOptimizer#BaseAbstractMultivariateOptimizer() 055 * @deprecated See {@link org.apache.commons.math3.optimization.SimpleValueChecker#SimpleValueChecker()} 056 */ 057 @Deprecated 058 protected BaseAbstractMultivariateSimpleBoundsOptimizer() {} 059 060 /** 061 * @param checker Convergence checker. 062 */ 063 protected BaseAbstractMultivariateSimpleBoundsOptimizer(ConvergenceChecker<PointValuePair> checker) { 064 super(checker); 065 } 066 067 /** 068 * @return the lower bounds. 069 */ 070 public double[] getLowerBound() { 071 return super.getLowerBound(); 072 } 073 074 /** 075 * @return the upper bounds. 076 */ 077 public double[] getUpperBound() { 078 return super.getUpperBound(); 079 } 080 081 /** {@inheritDoc} */ 082 @Override 083 public PointValuePair optimize(int maxEval, FUNC f, GoalType goalType, 084 double[] startPoint) { 085 return super.optimizeInternal(maxEval, f, goalType, 086 new InitialGuess(startPoint)); 087 } 088 089 /** {@inheritDoc} */ 090 public PointValuePair optimize(int maxEval, FUNC f, GoalType goalType, 091 double[] startPoint, 092 double[] lower, double[] upper) { 093 return super.optimizeInternal(maxEval, f, goalType, 094 new InitialGuess(startPoint), 095 new SimpleBounds(lower, upper)); 096 } 097 }