/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.math3.optimization.direct; import java.util.Comparator; import org.apache.commons.math3.analysis.MultivariateFunction; import org.apache.commons.math3.exception.NullArgumentException; import org.apache.commons.math3.optimization.GoalType; import org.apache.commons.math3.optimization.ConvergenceChecker; import org.apache.commons.math3.optimization.PointValuePair; import org.apache.commons.math3.optimization.SimpleValueChecker; import org.apache.commons.math3.optimization.MultivariateOptimizer; import org.apache.commons.math3.optimization.OptimizationData; /** * This class implements simplex-based direct search optimization. * *
* Direct search methods only use objective function values, they do * not need derivatives and don't either try to compute approximation * of the derivatives. According to a 1996 paper by Margaret H. Wright * (Direct * Search Methods: Once Scorned, Now Respectable), they are used * when either the computation of the derivative is impossible (noisy * functions, unpredictable discontinuities) or difficult (complexity, * computation cost). In the first cases, rather than an optimum, a * not too bad point is desired. In the latter cases, an * optimum is desired but cannot be reasonably found. In all cases * direct search methods can be useful. *
** Simplex-based direct search methods are based on comparison of * the objective function values at the vertices of a simplex (which is a * set of n+1 points in dimension n) that is updated by the algorithms * steps. *
*
* The {@link #setSimplex(AbstractSimplex) setSimplex} method must * be called prior to calling the {@code optimize} method. *
** Each call to {@link #optimize(int,MultivariateFunction,GoalType,double[]) * optimize} will re-use the start configuration of the current simplex and * move it such that its first vertex is at the provided start point of the * optimization. If the {@code optimize} method is called to solve a different * problem and the number of parameters change, the simplex must be * re-initialized to one with the appropriate dimensions. *
** Convergence is checked by providing the worst points of * previous and current simplex to the convergence checker, not the best * ones. *
** This simplex optimizer implementation does not directly support constrained * optimization with simple bounds, so for such optimizations, either a more * dedicated method must be used like {@link CMAESOptimizer} or {@link * BOBYQAOptimizer}, or the optimized method must be wrapped in an adapter like * {@link MultivariateFunctionMappingAdapter} or {@link * MultivariateFunctionPenaltyAdapter}. *
* * @see AbstractSimplex * @see MultivariateFunctionMappingAdapter * @see MultivariateFunctionPenaltyAdapter * @see CMAESOptimizer * @see BOBYQAOptimizer * @deprecated As of 3.1 (to be removed in 4.0). * @since 3.0 */ @SuppressWarnings("boxing") // deprecated anyway @Deprecated public class SimplexOptimizer extends BaseAbstractMultivariateOptimizer