当前位置: 首页>>代码示例>>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;未经允许,请勿转载。