📄 simpleobjectivefunction2.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 + -