Skip to content

Commit

Permalink
Create algorithms.md
Browse files Browse the repository at this point in the history
  • Loading branch information
KRM7 committed Aug 10, 2023
1 parent 7c6549e commit 6bd2852
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions docs/algorithms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

1. [Introduction](introduction.md)
2. [Fitness functions](fitness-functions.md)
3. [Encodings](encodings.md)
4. **Algorithms**
5. [Genetic operators](genetic-operators.md)
6. [Stop conditions](stop-conditions.md)
7. [Metrics](metrics.md)
8. [Miscellaneous](miscellaneous.md)

------------------------------------------------------------------------------------------------

# Algorithms

The algorithms are used in the library to define different genetic algorithm
variants. They consist of the selection and population replacement methods,
which define the overall evolution process in combination with the genetic
operators.

The algorithms in the library belong to 2 categories: single-, and
multi-objective algorithms. These can only be used for single- and
multi-objective optimization problems respectively. It is possible
to implement general algorithms that work for any type of problem, but the
library currently doesn't have such an algorithm.

There are currently 3 algorithms provided by the library, these are:

- SingleObjective (single-objective)
- NSGA-II (multi-objective)
- NSGA-III (multi-objective)

All of these algorithms are in the `gapp::algorithm` namespace.

# Selecting the algorithm

By default, if no algorithm is specified for the GA, one will automatically
be selected based on the number of objectives of the fitness function used.
This means that the default algorithm used by the GA will always be compatible
with the fitness functions regardless of the number of objectives.

It is also possible to select a different algorithm to be used by the GA.
This can be done either in the constructor or by using the `algorithm` method:

```cpp
// single-objective
```

```cpp
// multi-objective
```

The only thing that should be kept in mind when selecting the algorithm this
way is that it needs to be compatible with the fitness function used.
This means that the single-objective algorithms can only be used with
single-objective fitness functions, and the multi-objective algorithms can
only be used with multi-objective fitness functions.

If an algorithm was explicitly set, it can be cleared by passing a `nullptr`
to the `algorithm` setter. This will result in the default algorithm being used,
as in the case where no algorithm was explicitly set.

```cpp
ga.algorithm(nullptr);
ga.solve(f); // uses the default algorithm
```

# The single-objective algorithm

The SingleObjective algorithm is not a concrete algorithm implementation
like the NSGA-II and NSGA-III algorithms are. It is simply a wrapper that
combines a selection and a population replacement method. These methods
can be selected independently of eachother in the SingleObjective algorithm.

The library implements several selection and population replacement methods
that can be used. These are in the `gapp::selection` and `gapp::replacement`
namespaces respectively.

```cpp
// default single-objective algo
```

```cpp
// selection and replacement methods
```

The single-objective algorithm is made up of 2 independent parts: the selection and
the population replacement strategy. These can be found in the selection:: and replacement::
namespaces respectively.

# Custom algorithms


# Custom selection and replacement methods (single-objective)

0 comments on commit 6bd2852

Please sign in to comment.