当前位置: 首页>>代码示例>>Java>>正文


Java GoalType.MINIMIZE属性代码示例

本文整理汇总了Java中org.apache.commons.math3.optimization.GoalType.MINIMIZE属性的典型用法代码示例。如果您正苦于以下问题:Java GoalType.MINIMIZE属性的具体用法?Java GoalType.MINIMIZE怎么用?Java GoalType.MINIMIZE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.optimization.GoalType的用法示例。


在下文中一共展示了GoalType.MINIMIZE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doOptimize

/** {@inheritDoc} */
@Override
protected PointValuePair doOptimize() {
    final double[] lowerBound = getLowerBound();
    final double[] upperBound = getUpperBound();

    // Validity checks.
    setup(lowerBound, upperBound);

    isMinimize = (getGoalType() == GoalType.MINIMIZE);
    currentBest = new ArrayRealVector(getStartPoint());

    final double value = bobyqa(lowerBound, upperBound);

    return new PointValuePair(currentBest.getDataRef(),
                                  isMinimize ? value : -value);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:17,代码来源:BOBYQAOptimizer.java

示例2: doOptimize

/** {@inheritDoc} */
@Override
protected PointValuePair doOptimize() {
    if (simplex == null) {
        throw new NullArgumentException();
    }

    // Indirect call to "computeObjectiveValue" in order to update the
    // evaluations counter.
    final MultivariateFunction evalFunc
        = new MultivariateFunction() {
            /** {@inheritDoc} */
            public double value(double[] point) {
                return computeObjectiveValue(point);
            }
        };

    final boolean isMinim = getGoalType() == GoalType.MINIMIZE;
    final Comparator<PointValuePair> comparator
        = new Comparator<PointValuePair>() {
        /** {@inheritDoc} */
        public int compare(final PointValuePair o1,
                           final PointValuePair o2) {
            final double v1 = o1.getValue();
            final double v2 = o2.getValue();
            return isMinim ? Double.compare(v1, v2) : Double.compare(v2, v1);
        }
    };

    // Initialize search.
    simplex.build(getStartPoint());
    simplex.evaluate(evalFunc, comparator);

    PointValuePair[] previous = null;
    int iteration = 0;
    final ConvergenceChecker<PointValuePair> checker = getConvergenceChecker();
    while (true) {
        if (iteration > 0) {
            boolean converged = true;
            for (int i = 0; i < simplex.getSize(); i++) {
                PointValuePair prev = previous[i];
                converged = converged &&
                    checker.converged(iteration, prev, simplex.getPoint(i));
            }
            if (converged) {
                // We have found an optimum.
                return simplex.getPoint(0);
            }
        }

        // We still need to search.
        previous = simplex.getPoints();
        simplex.iterate(evalFunc, comparator);
        ++iteration;
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:56,代码来源:SimplexOptimizer.java

示例3: doOptimize

/** {@inheritDoc} */
@Override
protected PointValuePair doOptimize() {
    if (simplex == null) {
        throw new NullArgumentException();
    }

    // Indirect call to "computeObjectiveValue" in order to update the
    // evaluations counter.
    final MultivariateFunction evalFunc
        = new MultivariateFunction() {
            public double value(double[] point) {
                return computeObjectiveValue(point);
            }
        };

    final boolean isMinim = getGoalType() == GoalType.MINIMIZE;
    final Comparator<PointValuePair> comparator
        = new Comparator<PointValuePair>() {
        public int compare(final PointValuePair o1,
                           final PointValuePair o2) {
            final double v1 = o1.getValue();
            final double v2 = o2.getValue();
            return isMinim ? Double.compare(v1, v2) : Double.compare(v2, v1);
        }
    };

    // Initialize search.
    simplex.build(getStartPoint());
    simplex.evaluate(evalFunc, comparator);

    PointValuePair[] previous = null;
    int iteration = 0;
    final ConvergenceChecker<PointValuePair> checker = getConvergenceChecker();
    while (true) {
        if (iteration > 0) {
            boolean converged = true;
            for (int i = 0; i < simplex.getSize(); i++) {
                PointValuePair prev = previous[i];
                converged = converged &&
                    checker.converged(iteration, prev, simplex.getPoint(i));
            }
            if (converged) {
                // We have found an optimum.
                return simplex.getPoint(0);
            }
        }

        // We still need to search.
        previous = simplex.getPoints();
        simplex.iterate(evalFunc, comparator);
        ++iteration;
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:54,代码来源:SimplexOptimizer.java


注:本文中的org.apache.commons.math3.optimization.GoalType.MINIMIZE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。