本文整理汇总了Java中org.uma.jmetal.solution.Solution.getObjective方法的典型用法代码示例。如果您正苦于以下问题:Java Solution.getObjective方法的具体用法?Java Solution.getObjective怎么用?Java Solution.getObjective使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.uma.jmetal.solution.Solution
的用法示例。
在下文中一共展示了Solution.getObjective方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateLimits
import org.uma.jmetal.solution.Solution; //导入方法依赖的package包/类
/**
* Updates the grid limits considering the solutions contained in a
* <code>solutionList</code>.
*
* @param solutionList The <code>solutionList</code> considered.
*/
private void updateLimits(List<S> solutionList) {
for (int obj = 0; obj < numberOfObjectives; obj++) {
gridLowerLimits[obj] = Double.MAX_VALUE;
gridUpperLimits[obj] = Double.MIN_VALUE;
}
//Find the max and min limits of objetives into the population
for (int ind = 0; ind < solutionList.size(); ind++) {
Solution<?> tmpIndividual = solutionList.get(ind);
for (int obj = 0; obj < numberOfObjectives; obj++) {
if (tmpIndividual.getObjective(obj) < gridLowerLimits[obj]) {
gridLowerLimits[obj] = tmpIndividual.getObjective(obj);
}
if (tmpIndividual.getObjective(obj) > gridUpperLimits[obj]) {
gridUpperLimits[obj] = tmpIndividual.getObjective(obj);
}
}
}
}
示例2: update
import org.uma.jmetal.solution.Solution; //导入方法依赖的package包/类
@Override
public void update(Solution<?> solution) {
if (solution == null) {
throw new JMetalException("The solution is null") ;
} else if (solution.getNumberOfObjectives() != this.getNumberOfObjectives()) {
throw new JMetalException("The number of objectives of the solution ("
+ solution.getNumberOfObjectives()
+ ") "
+ "is different to the size of the reference point("
+ this.getNumberOfObjectives()
+ ")"
);
}
for (int i = 0; i < this.getNumberOfObjectives(); i++) {
if (this.getObjective(i) > solution.getObjective(i)) {
this.setObjective(i, solution.getObjective(i));
}
}
}
示例3: update
import org.uma.jmetal.solution.Solution; //导入方法依赖的package包/类
@Override
public void update(Solution<?> solution) {
if (solution == null) {
throw new JMetalException("The solution is null") ;
} else if (solution.getNumberOfObjectives() != this.getNumberOfObjectives()) {
throw new JMetalException("The number of objectives of the solution ("
+ solution.getNumberOfObjectives()
+ ") "
+ "is different to the size of the reference point("
+ this.getNumberOfObjectives()
+ ")"
);
}
for (int i = 0; i < this.getNumberOfObjectives(); i++) {
if (this.getObjective(i) < solution.getObjective(i)) {
this.setObjective(i, solution.getObjective(i));
}
}
}
示例4: calculateHypervolumeIndicator
import org.uma.jmetal.solution.Solution; //导入方法依赖的package包/类
/**
* Calculates the hypervolume of that portion of the objective space that
* is dominated by individual a but not by individual b
*/
double calculateHypervolumeIndicator(Solution<?> solutionA, Solution<?> solutionB, int d,
double maximumValues[], double minimumValues[]) {
double a, b, r, max;
double volume ;
double rho = 2.0;
r = rho * (maximumValues[d - 1] - minimumValues[d - 1]);
max = minimumValues[d - 1] + r;
a = solutionA.getObjective(d - 1);
if (solutionB == null) {
b = max;
} else {
b = solutionB.getObjective(d - 1);
}
if (d == 1) {
if (a < b) {
volume = (b - a) / r;
} else {
volume = 0;
}
} else {
if (a < b) {
volume =
calculateHypervolumeIndicator(solutionA, null, d - 1, maximumValues, minimumValues) * (b
- a) / r;
volume +=
calculateHypervolumeIndicator(solutionA, solutionB, d - 1, maximumValues, minimumValues)
* (max - b) / r;
} else {
volume =
calculateHypervolumeIndicator(solutionA, solutionB, d - 1, maximumValues, minimumValues)
* (max - a) / r;
}
}
return (volume);
}
示例5: PointSolution
import org.uma.jmetal.solution.Solution; //导入方法依赖的package包/类
/**
* Constructor
*
* @param solution
*/
public PointSolution(Solution<?> solution) {
this.numberOfObjectives = solution.getNumberOfObjectives() ;
objectives = new double[numberOfObjectives] ;
for (int i = 0; i < numberOfObjectives; i++) {
this.objectives[i] = solution.getObjective(i) ;
}
}
示例6: ArrayPoint
import org.uma.jmetal.solution.Solution; //导入方法依赖的package包/类
/**
* Constructor from a solution
*
* @param solution
*/
public ArrayPoint(Solution<?> solution) {
if (solution == null) {
throw new JMetalException("The solution is null") ;
}
int dimensions = solution.getNumberOfObjectives();
point = new double[dimensions];
for (int i = 0; i < dimensions; i++) {
point[i] = solution.getObjective(i);
}
}