當前位置: 首頁>>代碼示例>>Java>>正文


Java NonDominatedSolutionList類代碼示例

本文整理匯總了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;
}
 
開發者ID:organicsmarthome,項目名稱:OSHv2,代碼行數:36,代碼來源:MetricsUtil.java

示例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;
}
 
開發者ID:organicsmarthome,項目名稱:OSHv4,代碼行數:36,代碼來源:MetricsUtil.java


注:本文中的jmetal.util.NonDominatedSolutionList類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。