⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpleobjectivefunction2.java

📁 模拟退火是一种启发式算法
💻 JAVA
字号:
package org.theblueplanet.annealing.examples;

import org.theblueplanet.annealing.ObjectiveFunction;

/**
 *  A NDIM-dimension paraboloid
 *
 * @author     Charles M間nin
 * @since    November 3, 2001
 * @version    1.0
 */
public class SimpleObjectiveFunction2 implements ObjectiveFunction {
    private final static int NDIM      = 8;
    private final static double offset = -10.;

    /**
     *  Gets the Ndim attribute of the SimpleObjectiveFunction2 object
     *
     * @return    The Ndim value
     */
    public int getNdim() {
        return NDIM;
    }

    /**
     *  The paraboloid algorithm
     *
     * @param  vertex The vertices of the Simplex that the function is to evaluate
     * @return         The value of the function at the vertices
     */
    public static double func(double[] vertex) {
        double sumr  = 0;
        for (int jj = 1; jj <= NDIM; jj++) {//Fortran convention
            double q  = vertex[jj];
            sumr += q * q;
        }
        return (sumr + offset);
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -