jeco.core.problems.zdt.ZDT 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
The newest version!
package jeco.core.problems.zdt;
import jeco.core.problem.Problem;
import jeco.core.problem.Solution;
import jeco.core.problem.Solutions;
import jeco.core.problem.Variable;
import jeco.core.util.random.RandomGenerator;
public abstract class ZDT extends Problem> {
public ZDT(Integer numberOfVariables) {
super(numberOfVariables, 2);
}
public Solutions> newRandomSetOfSolutions(int size) {
Solutions> solutions = new Solutions>();
for (int i=0; i> solI = new Solution>(numberOfObjectives);
for (int j = 0; j < numberOfVariables; ++j) {
Variable varJ = new Variable(RandomGenerator.nextDouble(lowerBound[j], upperBound[j]));
solI.getVariables().add(varJ);
}
solutions.add(solI);
}
return solutions;
}
public void evaluate(Solutions> solutions) {
for(Solution> solution : solutions)
this.evaluate(solution);
}
public abstract void evaluate(Solution> solution);
}