本文整理汇总了Java中jmetal.util.NonDominatedSolutionList类的典型用法代码示例。如果您正苦于以下问题:Java NonDominatedSolutionList类的具体用法?Java NonDominatedSolutionList怎么用?Java NonDominatedSolutionList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NonDominatedSolutionList类属于jmetal.util包,在下文中一共展示了NonDominatedSolutionList类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readNonDominatedSolutionSet
import jmetal.util.NonDominatedSolutionList; //导入依赖的package包/类
/**
* Reads a set of non dominated solutions from a file
* @param path The path of the file containing the data
* @return A solution set
*/
public SolutionSet readNonDominatedSolutionSet(String path) {
try {
/* Open the file */
FileInputStream fis = new FileInputStream(path) ;
InputStreamReader isr = new InputStreamReader(fis) ;
BufferedReader br = new BufferedReader(isr) ;
SolutionSet solutionSet = new NonDominatedSolutionList();
String aux = br.readLine();
while (aux!= null) {
StringTokenizer st = new StringTokenizer(aux);
int i = 0;
Solution solution = new Solution(st.countTokens());
while (st.hasMoreTokens()) {
double value = (new Double(st.nextToken())).doubleValue();
solution.setObjective(i,value);
i++;
}
solutionSet.add(solution);
aux = br.readLine();
}
br.close();
return solutionSet;
} catch (Exception e) {
System.out.println("jmetal.qualityIndicator.util.readNonDominatedSolutionSet: "+path);
e.printStackTrace();
}
return null;
}
示例2: readNonDominatedSolutionSet
import jmetal.util.NonDominatedSolutionList; //导入依赖的package包/类
/**
* Reads a set of non dominated solutions from a file
* @param path The path of the file containing the data
* @return A solution set
*/
public SolutionSet readNonDominatedSolutionSet(String path) {
try {
/* Open the file */
FileInputStream fis = new FileInputStream(path) ;
InputStreamReader isr = new InputStreamReader(fis) ;
BufferedReader br = new BufferedReader(isr) ;
SolutionSet solutionSet = new NonDominatedSolutionList();
String aux = br.readLine();
while (aux!= null) {
StringTokenizer st = new StringTokenizer(aux);
int i = 0;
Solution solution = new Solution(st.countTokens());
while (st.hasMoreTokens()) {
double value = new Double(st.nextToken());
solution.setObjective(i,value);
i++;
}
solutionSet.add(solution);
aux = br.readLine();
}
br.close();
return solutionSet;
} catch (Exception e) {
System.out.println("jmetal.qualityIndicator.util.readNonDominatedSolutionSet: "+path);
e.printStackTrace();
}
return null;
}