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 018package org.apache.commons.math3.optimization.direct; 019 020import org.apache.commons.math3.analysis.MultivariateFunction; 021import org.apache.commons.math3.optimization.BaseMultivariateOptimizer; 022import org.apache.commons.math3.optimization.BaseMultivariateSimpleBoundsOptimizer; 023import org.apache.commons.math3.optimization.GoalType; 024import org.apache.commons.math3.optimization.InitialGuess; 025import org.apache.commons.math3.optimization.SimpleBounds; 026import org.apache.commons.math3.optimization.PointValuePair; 027import 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 * @deprecated As of 3.1 (to be removed in 4.0). 039 * @since 3.0 040 * @deprecated As of 3.1 since the {@link BaseAbstractMultivariateOptimizer 041 * base class} contains similar functionality. 042 */ 043@Deprecated 044public abstract class BaseAbstractMultivariateSimpleBoundsOptimizer<FUNC extends MultivariateFunction> 045 extends BaseAbstractMultivariateOptimizer<FUNC> 046 implements BaseMultivariateOptimizer<FUNC>, 047 BaseMultivariateSimpleBoundsOptimizer<FUNC> { 048 /** 049 * Simple constructor with default settings. 050 * The convergence checker is set to a 051 * {@link org.apache.commons.math3.optimization.SimpleValueChecker}. 052 * 053 * @see BaseAbstractMultivariateOptimizer#BaseAbstractMultivariateOptimizer() 054 * @deprecated See {@link org.apache.commons.math3.optimization.SimpleValueChecker#SimpleValueChecker()} 055 */ 056 @Deprecated 057 protected BaseAbstractMultivariateSimpleBoundsOptimizer() {} 058 059 /** 060 * @param checker Convergence checker. 061 */ 062 protected BaseAbstractMultivariateSimpleBoundsOptimizer(ConvergenceChecker<PointValuePair> checker) { 063 super(checker); 064 } 065 066 /** {@inheritDoc} */ 067 @Override 068 public PointValuePair optimize(int maxEval, FUNC f, GoalType goalType, 069 double[] startPoint) { 070 return super.optimizeInternal(maxEval, f, goalType, 071 new InitialGuess(startPoint)); 072 } 073 074 /** {@inheritDoc} */ 075 public PointValuePair optimize(int maxEval, FUNC f, GoalType goalType, 076 double[] startPoint, 077 double[] lower, double[] upper) { 078 return super.optimizeInternal(maxEval, f, goalType, 079 new InitialGuess(startPoint), 080 new SimpleBounds(lower, upper)); 081 } 082}