类 MultivariateFunctionMappingAdapter
- 所有已实现的接口:
-
MultivariateFunction
Adapter for mapping bounded MultivariateFunction
to unbounded ones.
This adapter can be used to wrap functions subject to simple bounds on parameters so they can be used by optimizers that do not directly support simple bounds.
The principle is that the user function that will be wrapped will see its parameters bounded as required, i.e when its value
method is called with argument array point
, the elements array will fulfill requirement lower[i] <= point[i] <= upper[i]
for all i. Some of the components may be unbounded or bounded only on one side if the corresponding bound is set to an infinite value. The optimizer will not manage the user function by itself, but it will handle this adapter and it is this adapter that will take care the bounds are fulfilled. The adapter value(double[])
method will be called by the optimizer with unbound parameters, and the adapter will map the unbounded value to the bounded range using appropriate functions like Sigmoid
for double bounded elements for example.
As the optimizer sees only unbounded parameters, it should be noted that the start point or simplex expected by the optimizer should be unbounded, so the user is responsible for converting his bounded point to unbounded by calling boundedToUnbounded(double[])
before providing them to the optimizer. For the same reason, the point returned by the BaseMultivariateOptimizer.optimize(OptimizationData[])
method is unbounded. So to convert this point to bounded, users must call unboundedToBounded(double[])
by themselves!
This adapter is only a poor man solution to simple bounds optimization constraints that can be used with simple optimizers like SimplexOptimizer
. A better solution is to use an optimizer that directly supports simple bounds like CMAESOptimizer
or BOBYQAOptimizer
. One caveat of this poor-man's solution is that behavior near the bounds may be numerically unstable as bounds are mapped from infinite values. Another caveat is that convergence values are evaluated by the optimizer with respect to unbounded variables, so there will be scales differences when converted to bounded variables.
- 另请参阅:
-
构造器概要
构造器说明MultivariateFunctionMappingAdapter
(MultivariateFunction bounded, double[] lower, double[] upper) 简单构造函数。 -
方法概要
修饰符和类型方法说明double[]
boundedToUnbounded
(double[] point) 将数组从有界映射到无界。double[]
unboundedToBounded
(double[] point) 将数组从无界映射到有界。double
value
(double[] point) 从无界点计算基础函数值。
-
构造器详细资料
-
MultivariateFunctionMappingAdapter
public MultivariateFunctionMappingAdapter(MultivariateFunction bounded, double[] lower, double[] upper) 简单构造函数。- 参数:
-
bounded
- 有界函数 -
lower
- 输入参数数组的每个元素的下界(某些元素可能设置为Double.NEGATIVE_INFINITY
表示无界值) -
upper
- 输入参数数组的每个元素的上界(某些元素可能设置为Double.POSITIVE_INFINITY
表示无界值) - 抛出:
-
MathIllegalArgumentException
- 如果下界和上界不一致,无论是按维度还是按值
-
-
方法详细资料
-
unboundedToBounded
public double[] unboundedToBounded(double[] point) 将数组从无界映射到有界。- 参数:
-
point
- 无界值。 - 返回:
- 有界值。
-
boundedToUnbounded
public double[] boundedToUnbounded(double[] point) 将数组从有界映射到无界。- 参数:
-
point
- 有界值。 - 返回:
- 无界值。
-
value
public double value(double[] point) 从无界点计算基础函数值。此方法简单地使用在构造函数中设置的映射将无界点限制,并使用有界点调用基础函数。
- 指定者:
-
value
在接口中MultivariateFunction
- 参数:
-
point
- 无界值 - 返回:
- 基础函数值
- 另请参阅:
-