![JAR search and dependency download from the Maven repository](/logo.png)
jeco.core.problems.dtlz.DTLZ3 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jeco-core Show documentation
Show all versions of jeco-core Show documentation
Java Evolutionary COmputation library
package jeco.core.problems.dtlz;
import java.util.ArrayList;
import jeco.core.problem.Solution;
import jeco.core.problem.Variable;
public class DTLZ3 extends DTLZ {
public DTLZ3(Integer numberOfVariables) {
super(numberOfVariables);
for (int i = 0; i < numberOfVariables; i++) {
lowerBound[i] = 0.0;
upperBound[i] = 1.0;
}
} // DTLZ3
public DTLZ3() {
this(12);
}
public void evaluate(Solution> solution) {
ArrayList> variables = solution.getVariables();
double[] x = new double[numberOfVariables];
double[] f = new double[numberOfObjectives];
int k = numberOfVariables - numberOfObjectives + 1;
for (int i = 0; i < numberOfVariables; i++) {
x[i] = variables.get(i).getValue();
}
double g = 0.0;
for (int i = numberOfVariables - k; i < numberOfVariables; i++) {
g += (x[i] - 0.5) * (x[i] - 0.5) - Math.cos(20.0 * Math.PI * (x[i] - 0.5));
}
g = 100.0 * (k + g);
for (int i = 0; i < numberOfObjectives; i++) {
f[i] = 1.0 + g;
}
for (int i = 0; i < numberOfObjectives; i++) {
for (int j = 0; j < numberOfObjectives - (i + 1); j++) {
f[i] *= java.lang.Math.cos(x[j] * 0.5 * java.lang.Math.PI);
}
if (i != 0) {
int aux = numberOfObjectives - (i + 1);
f[i] *= java.lang.Math.sin(x[aux] * 0.5 * java.lang.Math.PI);
} // if
} //for
for (int i = 0; i < numberOfObjectives; i++) {
solution.getObjectives().set(i, f[i]);
}
}
public DTLZ3 clone() {
DTLZ3 clone = new DTLZ3(this.numberOfVariables);
for(int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy