qualityIndicators

Quality indicators

Quality indicators are considered in jMetal 5 as components of the core package (jmetal-core). As many other components, there is a generic interface and an impl package containing the provided implementations of that interface.

The QualityIndicator interface is very simple:
质量指标在 jMetal 5 中被视为核心包 (jmetal-core) 的组件。
与许多其他组件一样,有一个通用接口和一个包含该接口提供的实现的“impl”包。
Quality Indicator 界面非常简单:

package org.uma.jmetal.qualityindicator;

/**
 * @author Antonio J. Nebro <antonio@lcc.uma.es>
 *
 * @param <Evaluate> Entity to evaluate
 * @param <Result> Result of the evaluation
 */
public interface QualityIndicator<Evaluate, Result> extends DescribedEntity {
  public Result evaluate(Evaluate evaluate) ;
  public String getName() ;
}

The idea is than every quality indicator is applied to some entity (Evaluate) to be evaluated, and it returns a Result. The use of generics allows to represent indicators returning anything, from a double value (the most usual return type) to a pair of values as in the case of our implementation of Set Coverage. The quality indicators also has an associated name.
这个想法是将每个质量指标应用于要评估的某个实体(Evaluate),并返回一个Result
泛型的使用允许表示返回任何东西的指标,从双精度值(最常见的返回类型)到一对值,就像我们实现 Set Coverage 的情况一样。
质量指标也有一个关联的名称。

Auxiliary classes

Before describing how quality indicators are implemented, we must comment before a number of auxiliary classes that are used:

  • The Front interface and ArrayFront class: Frequently, a reference Pareto front is stored in a file containing the objective values of a number of solutions. A Front is an entity intended to store the contents of these files; in the case of the ArrayFront class, it stores the front into an array of points.
  • The FrontNormalizer class: many indicators normalize the list of solutions to be evaluated, and this class is intended to do this: given a reference front or the maximum and minimum values, it returns a normalized list of solutions.
    在描述如何实现质量指标之前,我们必须在使用的一些辅助类之前进行评论:

*Front’接口和[Array Front](https://github.com/jMetal/jMetal/blob/jmetal-5.0/jmetal-core/src/main/java/org/uma/jmetal/util/front/imp/Array正面类:通常,参考帕累托前沿存储在包含多个解的目标值的文件中。“Front”是一个用于存储这些文件内容的实体;对于“Array Front”类,它将前沿存储到一个点数组中。

*[“前归一化器”](https://github.com/jMetal/jMetal/blob/jmetal-5.0/jmetal-core/src/main/java/org/uma/jmetal/util/front/util/Front归一化器。类:许多指标规范化了要评估的解决方案列表,该类旨在做到这一点:给定参考前沿或最大值和最小值,它返回一个规范化的解决方案列表。

An example of indicator: Epsilon

To illustrate a quality indicator in jMetal 5, we describe next the code of the Epsilon indicator.

The declaration of the Epsilon class is included in this piece of code:
为了说明 jMetal 5 中的质量指标,我们接下来描述 Epsilon 指标的代码。
Epsilon 类的声明包含在这段代码中:

public class Epsilon<Evaluate extends List<? extends Solution<?>>>
    extends SimpleDescribedEntity
    implements QualityIndicator<Evaluate,Double> {
  ...    

Although at a first glance it seems a very complex declaration, it simply states that Evaluate must be a List of any kind of jMetal Solution, so any attempt to use the indicator with a non compatible object will be detected at compiling time.

Our approach to implement most of indicators is to consider that most of them require a reference front to be computed, so that front must be incorporated as a parameter of the class constructor:
尽管乍一看它似乎是一个非常复杂的声明,但它只是声明 Evaluate 必须是任何类型的 jMetal Solution 的列表,因此任何将指标与不兼容对象一起使用的尝试都会在编译时被检测到
.
我们实现大多数指标的方法是考虑到它们中的大多数都需要计算参考前端,因此必须将前端作为类构造函数的参数合并:

  private Front referenceParetoFront ;

  /**
   * Constructor
   *
   * @param referenceParetoFrontFile
   * @throws FileNotFoundException
   */
  public Epsilon(String referenceParetoFrontFile) throws FileNotFoundException {
    super("EP", "Epsilon quality indicator") ;
    if (referenceParetoFrontFile == null) {
      throw new JMetalException("The reference pareto front is null");
    }

    Front front = new ArrayFront(referenceParetoFrontFile);
    referenceParetoFront = front ;
  }
...

Then, the evaluate method computes the indicator value by using the reference front:
然后,evaluate 方法使用参考前端计算指标值:

  /**
   * Evaluate() method
   *
   * @param solutionList
   * @return
   */
  @Override public Double evaluate(Evaluate solutionList) {
    if (solutionList == null) {
      throw new JMetalException("The pareto front approximation list is null") ;
    }

    return epsilon(new ArrayFront(solutionList), referenceParetoFront);
  }

Readers interested in how the Epsilon is computed can find all the code here
对如何计算 Epsilon 感兴趣的读者可以找到所有代码

About normalization

An important issue to take into account is that quality indicators do not normalize the solution list to be evaluated. Instead, the user can choose if the fronts are normalized or not before using them.

This piece of code shows an example of how reading a reference from a file and how to get a FrontNormalized from it:
需要考虑的一个重要问题是质量指标不会规范化要评估的解决方案列表。
取而代之的是,用户可以在使用前选择是否对前端进行规范化。
这段代码展示了如何从文件中读取引用以及如何从中获取“Front Normalized”的示例:

Front referenceFront = new ArrayFront("fileName");
FrontNormalizer frontNormalizer = new FrontNormalizer(referenceFront) ;

Then, the front normalizer can be use to a normalized reference front:

Front normalizedReferenceFront = frontNormalizer.normalize(referenceFront) ;

And then, given any solution list to be normalized, it can be done this way:

List<Solution> population ;
...
Front normalizedFront = frontNormalizer.normalize(new ArrayFront(population)) ;

###Using quality indicators
One we have decided about normalization, we can create a quality indicator and use it. We select the Hypervolume as an example:
我们已经决定了标准化,我们可以创建一个质量指标并使用它。
我们以 Hypervolume 为例:

Hypervolume<List<? extends Solution<?>>> hypervolume ;
hypervolume = new Hypervolume<List<? extends Solution<?>>>(referenceFront) ;

double hvValue = hypervolume.evaluate(population) ;

###Discussion
Leaving the normalization up to the user can be error prone, but there is a performance advantage: if the same indicator has to be applied to many solution lists, the normalization of the reference front is carried out only once. This is the case, for example, when some indicator-based algorithms have to find the solution contributing the least to the Hypervolume.
将归一化留给用户可能容易出错,但有一个性能优势:如果必须将相同的指标应用于许多解决方案列表,则参考前沿的归一化只执行一次。
例如,当某些基于指标的算法必须找到对 Hypervolume 贡献最小的解决方案时,就是这种情况。

Computing quality indicators from the command line

If you need to compute the value of a given quality indicator of a front of solutions from the command line you can use the CommandLineIndicatorRunner class. Note that to run this program you must properly set the CLASSPATH environment variable as explained in Section Running (in the subsection called “Running an algorithm from the command line”).
如果您需要从命令行计算解决方案前面的给定质量指标的值,您可以使用 [Command Line Indicator Runner](https://github.com/jMetal/jMetal/blob/jmetal-
5.0/jmetal-exec/src/main/java/org/uma/jmetal/quality Indicator/Command Line Indicator Runner.java) 类。
请注意,要运行此程序,您必须按照 [Running](https://github.com/jMetal/jMetal Documentation/blob/master/running.md) 节中的说明正确设置 CLASSPATH 环境变量(在
小节称为“从命令行运行算法”)。
The usage of this program is:
这个程序的用法是:

java org.uma.jmetal.qualityIndicator.CommandLineIndicatorRunner indicatorName referenceFront frontToEvaluate TRUE | FALSE

where indicator name can be:

  • GD: Generational distance
  • IGD: Inverted generational distance
  • IGD+: Inverted generational distance plus
  • EP: Epsilon
  • HV: Hypervolume
  • SPREAD: Spread (two objectives)
  • GSPREAD: Generalized spread (more than two objectives
  • ER: Error ratio
  • ALL: Select all the available indicators

The last parameter is used to indicate whether the fronts are to be normalized or not before computing the quality indicators.

We include some examples next. First, we run NSGA-II to solve problem ZDT2:
最后一个参数用于指示在计算质量指标之前是否对前沿进行归一化。
我们接下来会举一些例子。
首先,我们运行 NSGA-II 来解决问题 [ZDT2](https://github.com/jMetal/jMetal/blob/jmetal-5.0/jmetal-problem/src/main/java/org/uma/jmetal/
问题/多目标/zdt/ZDT2.java):

$ java org.uma.jmetal.runner.multiobjective.NSGAIIRunner org.uma.jmetal.problem.multiobjective.zdt.ZDT2

ago 01, 2015 6:08:16 PM org.uma.jmetal.runner.multiobjective.NSGAIIRunner main
INFORMACIÓN: Total execution time: 1445ms
ago 01, 2015 6:08:17 PM org.uma.jmetal.runner.AbstractAlgorithmRunner printFinalSolutionSet
INFORMACIÓN: Random seed: 1438445295477
ago 01, 2015 6:08:17 PM org.uma.jmetal.runner.AbstractAlgorithmRunner printFinalSolutionSet
INFORMACIÓN: Objectives values have been written to file FUN.tsv
ago 01, 2015 6:08:17 PM org.uma.jmetal.runner.AbstractAlgorithmRunner printFinalSolutionSet
INFORMACIÓN: Variables values have been written to file VAR.tsv

Now we use CommandLineIndicatorRunner to compute the Hypervolume value by normalizing first the fronts:
现在我们使用 Command Line Indicator Runner 来计算 Hypervolume 值,首先对前端进行归一化:

$ java org.uma.jmetal.qualityIndicator.CommandLineIndicatorRunner HV jmetal-problem/src/test/resources/pareto_fronts/ZDT2.pf FUN.tsv TRUE

The fronts are NORMALIZED before computing the indicators
0.32627228626895705

If we are interested in computing all the quality indicators, we execute the following command:
如果我们对计算所有质量指标感兴趣,我们执行以下命令:

$ java org.uma.jmetal.qualityIndicator.CommandLineIndicatorRunner ALL jmetal-problem/src/test/resources/pareto_fronts/ZDT2.pf FUN.tsv TRUE

The fronts are NORMALIZED before computing the indicators
EP: 0.01141025767271403
HV: 0.32627228626895705
GD: 1.862557951719542E-4
IGD: 1.8204928590462744E-4
IGD+: 0.003435437983027875
SPREAD: 0.33743702454536517
GSPREAD: 0.40369897027563534
R2: 0.19650995040071226
ER: 1.0
SC(refPF, front): 0.89
SC(front, refPF): 0.0
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值