本文整理匯總了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;
}