jmetal-architecture

Architecture

jMetal 5的体系结构依赖于四个接口
在这里插入图片描述

This diagram captures the typical functionality provided by jMetal: an Algorithm solves a Problem by manipulating a set of potential Solution objects through the use of several Operators. The Solution interface represents the individuals in evolutionary algorithms and the particles in the case of particle swarm optmization algorithms. A Problem can create new solutions and evaluate them.
Compared to previous versions of jMetal, there is not a class for the concept of population or swarm. In jMetal 5 a population is merely a list of solutions (List<Solution> in Java).
此图捕获了 jMetal 提供的典型功能:“算法”通过使用多个“运算符”来操纵一组潜在的“解决方案”对象来解决“问题”。
“解决方案”界面代表进化算法中的个体和粒子群优化算法中的粒子。
一个“问题”可以创建新的解决方案并对其进行评估。
与以前的 jMetal 版本相比,没有人口或群体概念的类。
在 jMetal 5 中,人口只是解决方案的列表(Java 中的“List”)。

Generics

We can observe the use of parametrized types to model the use of Java generics, which are now widely applied.

The use of generics in the architecture allows to align all the components in metaheuristic so that the Java compiler can check that everything fit. For example, this code represents all the elements to configure a the well-known NSGA-II algorithm to solve a continuous problem:
我们可以观察到使用参数化类型来模拟 Java 泛型的使用,这些泛型现在已被广泛应用。
在架构中使用泛型允许在元启发式中对齐所有组件,以便 Java 编译器可以检查一切是否合适。
例如,此代码表示配置著名的 NSGA-II 算法以解决连续问题的所有元素:

    Problem<DoubleSolution> problem;
    Algorithm<List<DoubleSolution>> algorithm;
    CrossoverOperator<DoubleSolution> crossover;
    MutationOperator<DoubleSolution> mutation;
    SelectionOperator<List<DoubleSolution>, DoubleSolution> selection;

    ...

    algorithm = new NSGAIIBuilder<DoubleSolution>(problem, crossover, mutation)
        .setSelectionOperator(selection)
        .setMaxEvaluations(25000)
        .setPopulationSize(100)
        .build() ;

Hierarchy of Algorithm related classes

The Algorithm class is very simple and it contain only two methods, run() y getResult(), as can be observed in the following code snippet:
Algorithm 类非常简单,它只包含两个方法,run() y get Result(),如以下代码片段所示:

package org.uma.jmetal.algorithm;

/**
 * Interface representing an algorithm
 * @author Antonio J. Nebro
 * @version 0.1
 * @param <Result> Result
 */
public interface Algorithm<Result> extends Runnable, Serializable, DescribedEntity {
  void run() ;
  Result getResult() ;
}

jMetal 5 includes a hierarchy of classes that inherits from Algorithm, as depicted in the following diagram:
jMetal 5 包括继承自“算法”的类层次结构,如下图所示:
在这里插入图片描述

On the one hand, we found a level of abstract classes (e.g., AbstractEvolutionaryAlgorithm or AbstractParticleSwarmOptimization) which constitute templates than can be used to facilitate the implementation of algorithms by reusing an extending the already provided code. On the other hand, we can see two examples of algorithms, MOEA/D and NSGAII45, which do not follow none of the provided templates. This way you are free to implement a new algorithm on your own or by extending some of the existing classes.
一方面,我们发现构成模板的抽象类(例如,“抽象进化算法”或“抽象粒子群优化”)可用于通过重用已提供代码的扩展来促进算法的实现。
另一方面,我们可以看到两个算法示例,MOEA/D 和 NSGAII45,它们不遵循任何提供的模板。
通过这种方式,您可以自由地自行实现新算法,也可以通过扩展某些现有类来实现。
We can observe that, in the case of NSGA-II, it inherits from AbstractGeneticAlgorithm, which is a subclass of AbstractEvolutionaryAlgorithm. The diagram shows that a steady-state variant of NSGA-II can be defined by extending the NSGAII class.
我们可以观察到,在 NSGA-II 的情况下,它继承自“抽象遗传算法”,它是“抽象进化算法”的子类。
该图显示,可以通过扩展“NSGAII”类来定义 NSGA-II 的稳态变体。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值