operator

本文介绍了元启发式技术中用于修改和生成解决方案的不同运营商,如交叉、突变和选择。在jMetal框架中,这些运算符通过Operator接口实现,包括CrossoverOperator、MutationOperator和SelectionOperator等。例如,SBXCrossover接口用于实现模拟二进制交叉,适用于实数编码的解决方案。此外,文章还提到了解决方案修复策略和本地搜索过程。
摘要由CSDN通过智能技术生成

The Operator interface

Metaheuristic techniques are based on modifying or generating new solutions from existing ones by
means of the application of different operators. For example, EAs make use of crossover, mutation, and
selection operators for modifying solutions. In jMetal, any operation altering or generating solutions (or
sets of them) implements or extends the Operator interface:
元启发式技术基于通过修改现有解决方案或生成新解决方案
不同运营商的应用方式。
例如,EA 使用交叉、突变和
用于修改解决方案的选择运算符。
在 jMetal 中,任何改变或生成解决方案的操作(或
它们的集合)实现或扩展了 Operator 接口:

package org.uma.jmetal.operator;

/**
 * Interface representing an operator
 *
 * @author Antonio J. Nebro <antonio@lcc.uma.es>
 * @version 0.1
 * @param <Source> Source Class of the object to be operated with
 * @param <Result> Result Class of the result obtained after applying the operator
 */
public interface Operator<Source, Result> {
  /**
   * @param source The data to process
   */
  public Result execute(Source source) ;
}

The generics in this interface are intended to indicate that an operator is applied to a Source object and returns as a result Result object.
此接口中的泛型旨在指示将运算符应用于“Source”对象并作为结果返回“Result”对象。

The framework already incorporates a number of operators, which can be classiffed into four different
classes:

  • Crossover. Represents the recombination or crossover operators used in EAs. Some of the included
    operators are the simulated binary (SBX) crossover and the single-point crossover for real and
    binary encodings, respectively.
  • Mutation. Represents the mutation operator used in EAs. Examples of included operators are
    polynomial mutation (real encoding) and bit-flip mutation (binary encoding).
  • Selection. This kind of operator is used for performing the selection procedures in many metaheuristics. An
    example of selection operator is the binary tournament.
  • LocalSearch. This class is intended for representing local search procedures. It contains a method for consulting how many evaluations have been performed after been applied.
    该框架已经包含了许多运算符,它们可以分为四种不同的
    类:
  • 交叉。
    表示 EA 中使用的重组或交叉运算符。
    包括的一些
    运算符是模拟二进制 (SBX) 交叉和实数和单点交叉
    二进制编码,分别。
  • 突变。
    表示 EA 中使用的变异算子。
    包含的运算符的示例是
    多项式变异(实数编码)和位翻转变异(二进制编码)。
  • 选择。
    这种算子用于执行许多元启发式算法中的选择过程。
    一个
    选择运算符的示例是二元锦标赛。
    *本地搜索。
    此类旨在表示本地搜索过程。
    它包含一种查询应用后执行了多少次评估的方法。
    We review the interfaces and implementations of these operators next.
    接下来我们回顾一下这些操作符的接口和实现。

Crossover operators

The CrossoverOperator interface represents any crossover in jMetal 5:

package org.uma.jmetal.operator;

/**
 * Interface representing crossover operators. They will receive a list of solutions and return
 * another list of solutions
 *
 * @author Antonio J. Nebro <antonio@lcc.uma.es>
 *
 * @param <S> The class of the solutions
 */
public interface CrossoverOperator<S extends Solution<?>> extends Operator<List<S>,List<S>> {
}

This interface simply states that a crossover has as a source a list of Solution objects and return as a result another list of solutions. Let us examine two implementations of this interface, one for double solutons and another one for binary solutions.

The simulated binary crossover (SBX) is the default crossover operator in many multiobjective evolutionary algorithms (e.g., NSGA-II, SPEA2, SMS-EMOA, MOCell, etc). A scheme of the SBXCrossover class is shown next:
该接口简单地说明交叉具有“解决方案”对象列表作为源,并作为结果返回另一个解决方案列表。
让我们检查这个接口的两种实现,一种用于双解,另一种用于二元解。
模拟二元交叉 (SBX) 是许多多目标进化算法(例如,NSGA-II、SPEA2、SMS-EMOA、MOCell 等)中的默认交叉算子。
SBXCrossover 类的方案如下所示:

package org.uma.jmetal.operator.impl.crossover;

/**
 * This class allows to apply a SBX crossover operator using two parent solutions (Double encoding).
 * A {@link RepairDoubleSolution} object is used to decide the strategy to apply when a value is out
 * of range.
 *
 * The implementation is based on the NSGA-II code available in
 * <a href="http://www.iitk.ac.in/kangal/codes.shtml">http://www.iitk.ac.in/kangal/codes.shtml</a>
 *
 * @author Antonio J. Nebro <antonio@lcc.uma.es>
 * @author Juan J. Durillo
 */
public class SBXCrossover implements CrossoverOperator<DoubleSolution> {
  /** EPS defines the minimum difference allowed between real values */
  private static final double EPS = 1.0e-14;

  private double distributionIndex ;
  private double crossoverProbability  ;
  private RepairDoubleSolution solutionRepair ;

  private JMetalRandom randomGenerator ;

  /** Constructor */
  public SBXCrossover(double crossoverProbability, double distributionIndex) {
    this (crossoverProbability, distributionIndex, new RepairDoubleSolutionAtBounds()) ;
  }

  /** Constructor */
  public SBXCrossover(double crossoverProbability, double distributionIndex, RepairDoubleSolution solutionRepair) {
    if (crossoverProbability < 0) {
      throw new JMetalException("Crossover probability is negative: " + crossoverProbability) ;
    } else if (distributionIndex < 0) {
      throw new JMetalException("Distribution index is negative: " + distributionIndex);
    }

    this.crossoverProbability = crossoverProbability ;
    this.distributionIndex = distributionIndex ;
    this.solutionRepair = solutionRepair ;

    randomGenerator = JMetalRandom.getInstance() ;
  }

  /** Execute() method */
  @Override
  public List<DoubleSolution> execute(List<DoubleSolution> solutions) {
    if (null == solutions) {
      throw new JMetalException("Null parameter") ;
    } else if (solutions.size() != 2) {
      throw new JMetalException("There must be two parents instead of " + solutions.size()) ;
    }

    return doCrossover(crossoverProbability, solutions.get(0), solutions.get(1)) ;
  }
  
  ...

TO BE COMPLETED

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值