Skip to content

Introduction

Debabrata Acharya edited this page Sep 21, 2020 · 9 revisions

Since NSGA-II is more like a set of protocols to follow as an algorithm rather than a concrete implementation of every aspect, this package has been re-written from scratch keeping complete customizability in mind. Apart from the core concepts of the algorithm, everything is considered to be a plugin external to the algorithm that can be implemented by the user and dynamically plugged into the algorithm during runtime as needed. This opens up the possibility of the package to be used simply as a PoC or be converted into something much more complex according to the users needs.

By default, all the customizable aspects of the algorithm is provided with a default implementation. This lets the user to implement only the aspects they would like to change while keeping the others untouched. Visit the documentation to for more in-depth explanation of each plugin.

Before deep-diving into the implementation details, let us first understand how this package works and how it is structured. An Allele is the atomic element for this implementation. A set of alleles of similar type forms a Chromosome. In other words, a set of alleles form the genetic code of a Chromosome. A set of chromosomes in turn, make a Population. These are the basics of any Genetic Algorithm and is implemented as the basic data structures of this package.

Aspects that can be provided as a plugin to the core algorithm

  1. Since an Allele can be of various types depending on whether the Chromosome is binary encoded or, say, permutation encoded, this aspect of the algorithm can be changed as required within the package. Every allele must extend the AbstractAllele class. The implementation details completely depends on the user. By default, a BooleanAllele is provided which is used for binary encoding. Other types such as IntegerAllele and ValueAllele have also been implemented.

  2. The crossover operator can be implemented by the user as deemed necessary. The user's implementation must extend the AbstractCrossover class. By default, an implementation of uniform crossover is provided through the UniformCrossover class. OrderCrossover and SimulatedBinaryCrossover have also been implemented.

  3. While the crossover operator decides how to perform the crossover on two or more chromosomes once chosen, the package provides even further customizability by allowing to change how the chromosomes to be crossed over are chosen in the first place. This can be done by providing a concrete implementation of the CrossoverParticipantCreator interface. By default, two chromosomes are selected at random by performing crowded binary tournament selection over a population. This default implementation is provided in CrossoverParticipantCreatorProvider#selectByBinaryTournamentSelection method.

  4. The mutation operator can be implemented by the user as deemed necessary. The user's implementation must extend the AbstractMutation class. By default, an implementation of single point mutation is provided through the SingePointMutation class. PolynomialMutation and SwapMutation have also been implemented.

  5. The genetic code of each chromosome can be generated in various ways as required by the user. This can be done by providing a concrete implementation of the GeneticCodeProducer interface. By default, a GeneticCodeProducer producing binary encoded alleles of BooleanAllele instance is provided by DefaultPluginProvider#defaultGeneticCodeProducer.

  6. The implementation details of how the parent population and the child population shall be generated changes from user to user based on their requirements. This is why, these aspects of the package can also be custom implemented by the user as deemed necessary.

    • The implementation details of the parent population generation can be provided by implementing the PopulationProducer interface. A default implementation of taking the fixed chromosome length (genetic code length) and population size and creating a population using the GeneticCodeProducer available is provided in DefaultPluginProvider#defaultPopulationProducer.
    • The implementation details of the child population generation can be provided by implementing the ChildPopulationProducer interface. A default implementation of taking a parent population, child population size, the available crossover operator and the available mutation operator is provided in DefaultPluginProvider#defaultChildPopulationProducer.
  7. The objective functions used with this package can be written as required by the user by extending the AbstractObjectiveFunction class. Your instance may have as many objective functions as necessary and the algorithm shall scale to it. By default, the SCH_1 and SCH_2 are implemented and provided, but you can use any objective function to your liking. The default objectives are provided through the ObjectiveProvider#provideSCHObjectives method.

  8. Finally, a FitnessCalculator may or may not be implemented which computes some fitness of a Chromosome. NSGA-II does not have any direct fitness calculation and this is not necessary by default. But this can be used either (i) as some extra parameter computation that the user may want to add to the algorithm as required, or (ii) as a parameter to objective functions if they require any extra computational parameter.

Refer to the Documentation for more information or Getting Started section to see the package in action.

Clone this wiki locally