Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MOEA/D - DE #269

Merged
merged 128 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 121 commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
0419469
- Import previous work
jonpsy Mar 7, 2021
19425d4
- wrap mating in a function
jonpsy Mar 8, 2021
91df706
crossover inside mainloop
jonpsy Mar 8, 2021
3d91ccc
differential crossover
jonpsy Mar 8, 2021
a52f1ad
cast to vector only at EvaluateObjectives
jonpsy Mar 8, 2021
bb414e6
convention
jonpsy Mar 8, 2021
3cd94ae
scalingFactor getter setter
jonpsy Mar 8, 2021
28be655
numVariables
jonpsy Mar 8, 2021
ded4a43
1.f / numVariables, should pass float
jonpsy Mar 8, 2021
b01e7fa
* scalingFactor in ctor
jonpsy Mar 8, 2021
5a07b38
evaluatedCandidate => candidateFval
jonpsy Mar 8, 2021
f4c348a
MatingSelection needs popIdx
jonpsy Mar 8, 2021
a3b812a
weightNeighborIndex fix
jonpsy Mar 8, 2021
ad8383e
Add enum for P type
jonpsy Mar 9, 2021
09ec4a2
Scalingfactor in impl
jonpsy Mar 9, 2021
0ae8035
- add TODO
jonpsy Mar 9, 2021
89f6b8f
- fix compile errors
jonpsy Mar 9, 2021
d69c899
Add params
jonpsy Mar 9, 2021
a4dcccd
rename
jonpsy Mar 9, 2021
99f6f2b
rm:
jonpsy Mar 9, 2021
73a3b90
tchebycheff is max
jonpsy Mar 10, 2021
d67ed85
remove
jonpsy Mar 10, 2021
c281336
fix chronology in docs
jonpsy Mar 10, 2021
d794746
styling fix
jonpsy Mar 10, 2021
7d50c87
Nits on MatingSelection
jonpsy Mar 10, 2021
ed5ad0e
DE done
jonpsy Mar 10, 2021
1011370
mutation fixed
jonpsy Mar 10, 2021
41d58bc
minor
jonpsy Mar 10, 2021
8b8fe49
use arma::datum::eps
jonpsy Mar 10, 2021
b1ba5a2
- n_rows
jonpsy Mar 10, 2021
08b24f1
- Everything compiles
jonpsy Mar 11, 2021
fefcaa6
minor style change test
jonpsy Mar 12, 2021
57815a5
Shuffle func is wrong
jonpsy Mar 12, 2021
8b2ae13
rm preserve diversity
jonpsy Mar 12, 2021
aecbe43
- Removed preserveDiversity for now
jonpsy Mar 12, 2021
2e8ba4d
undo nsga2_test changes
jonpsy Mar 12, 2021
c067fcc
fonseca shuffle fix
jonpsy Mar 12, 2021
ee92ed0
HISTORY.md updated
jonpsy Mar 12, 2021
cf9ec55
some work on optimizer.md
jonpsy Mar 12, 2021
e04519b
fix authors
jonpsy Mar 12, 2021
c380dd5
rname MOEAD => MOEA/D-DE
jonpsy Mar 12, 2021
cab48a0
Update doc/optimizers.md
jonpsy Mar 14, 2021
eaf86e9
Update doc/optimizers.md
jonpsy Mar 14, 2021
e73e79d
Update include/ensmallen_bits/moead/moead.hpp
jonpsy Mar 14, 2021
b1bd144
numGenerations => maxGenerations
jonpsy Mar 13, 2021
288b3d7
change def args:
jonpsy Mar 13, 2021
33bcfca
optimizer.md updated
jonpsy Mar 13, 2021
c388bde
rm redundant args
jonpsy Mar 13, 2021
be8e45b
rm
jonpsy Mar 14, 2021
3f30929
=> test with def args : pass
jonpsy Mar 14, 2021
f1488ab
candidateFval => candidateFitness
jonpsy Mar 14, 2021
5e27bdf
minor doc changes
jonpsy Mar 14, 2021
d2615d5
optimizer.MD update
jonpsy Mar 14, 2021
73ef983
maxreplace is always positive
jonpsy Mar 14, 2021
f38f6a1
modify test a bit
jonpsy Mar 14, 2021
a95c0e6
Remove shuffle from problems
jonpsy Mar 15, 2021
8a52d9a
add callbacktest
jonpsy Mar 16, 2021
9c88815
fix bounds
jonpsy Mar 16, 2021
c602dc1
bound fix in optimizer.MD
jonpsy Mar 16, 2021
f516864
arma::square
jonpsy Mar 17, 2021
83e0850
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Mar 18, 2021
faa94ab
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Mar 18, 2021
c849873
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Mar 18, 2021
9d7eec8
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Mar 18, 2021
bfde39d
tab v space
jonpsy Mar 18, 2021
47c981e
fix indendations pt2
jonpsy Mar 18, 2021
e515851
author fix impl
jonpsy Mar 18, 2021
2ce3bd3
tab v space pt3
jonpsy Mar 18, 2021
1149301
use ParetoSet & ParetoFront in declaration file
jonpsy Jun 8, 2021
391e164
moead_impl.hpp
jonpsy Jun 8, 2021
e086bf2
Doc fix
jonpsy Jun 8, 2021
410eb50
Maintain EvaluateObjectives of NSGA-II
jonpsy Jun 8, 2021
6703d07
Tab fix
jonpsy Jun 8, 2021
a44da08
rm StepTaken
jonpsy Jun 8, 2021
57c8d70
ideal point uses ElemType
jonpsy Jun 8, 2021
80a2f85
g => generation: main loop
jonpsy Jun 8, 2021
b4f862d
] => )
jonpsy Jun 8, 2021
efa5a2e
Additional docs
jonpsy Jun 8, 2021
5c11b53
=> Indent fix.
jonpsy Jun 9, 2021
2822fae
Additional docs in declare file
jonpsy Jun 9, 2021
5fb082a
distributionIndex => perturbationIndex
jonpsy Jun 9, 2021
274f9f0
=> Use cleaner Mutate code.
jonpsy Jun 9, 2021
34366e7
perturbationIndex pt.2
jonpsy Jun 9, 2021
556ded8
Everything compiles.
jonpsy Jun 9, 2021
62dc590
use MatType lowerBound
jonpsy Jun 9, 2021
7d7ad34
=> cache converted upper and lowerBound
jonpsy Jun 9, 2021
dd4b475
All tests compile
jonpsy Jun 9, 2021
0f597dd
initialize fitness
jonpsy Jun 9, 2021
08fa726
Tests pass
jonpsy Jun 9, 2021
5adfba0
use distributionIndex again
jonpsy Jun 10, 2021
a068a6e
Fix docs for optimizers.md
jonpsy Jun 10, 2021
b5f49a0
Fix callbacks
jonpsy Jun 10, 2021
d2a396c
Update moead.hpp
jonpsy Jun 10, 2021
950e36c
Update moead_impl.hpp
jonpsy Jun 10, 2021
6acbe14
minor style
jonpsy Jun 10, 2021
fb58722
fix error
jonpsy Jun 10, 2021
bd25226
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 11, 2021
7505121
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 11, 2021
0828c7b
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 11, 2021
4e4fa69
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 11, 2021
3404708
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 11, 2021
4824e72
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 11, 2021
9d93405
Update moead_impl.hpp
jonpsy Jun 11, 2021
cf850f5
Update moead_impl.hpp
jonpsy Jun 11, 2021
27404cd
Update moead_impl.hpp
jonpsy Jun 11, 2021
ad9f355
Mating more clear
jonpsy Jun 12, 2021
80fbf6c
Mate fix
jonpsy Jun 12, 2021
1dadc1b
delta indent fix
jonpsy Jun 12, 2021
604209a
added epsilon
jonpsy Jun 12, 2021
81e07bf
minor style + numobjectives remvoed from opt
jonpsy Jun 12, 2021
a646f7c
re-ordered state variables
jonpsy Jun 12, 2021
3267c42
RequireDenseFloatingCheck
jonpsy Jun 12, 2021
b0c4c1b
reorder tests
jonpsy Jun 12, 2021
aa54aad
BaseMatType
jonpsy Jun 12, 2021
5d9e73c
Update moead_impl.hpp
jonpsy Jun 12, 2021
287bf82
style fix
jonpsy Jun 12, 2021
60d19c4
if(
jonpsy Jun 12, 2021
edd089a
2. => 2.0
jonpsy Jun 12, 2021
b7178fe
Added epsilon to docs
jonpsy Jun 12, 2021
53cae18
fix default arg in ctor
jonpsy Jun 12, 2021
e893dfd
weights are fixed bruh
jonpsy Jun 12, 2021
b1fa440
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 13, 2021
a2a7ef1
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 13, 2021
7d794cb
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 13, 2021
40e44d4
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 13, 2021
5cd6bc8
Update tests/moead_test.cpp
jonpsy Jun 13, 2021
da7683b
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 13, 2021
973d4a7
Update include/ensmallen_bits/moead/moead.hpp
jonpsy Jun 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
* Make Callback flexible for MultiObjective Optimizers
([#289](https://github.com/mlpack/ensmallen/pull/289)).

* Add MOEA-D/DE Optimizer
([#269](https://github.com/mlpack/ensmallen/pull/269)).

### ensmallen 2.16.1: "Severely Dented Can Of Polyurethane"
###### 2021-03-02
* Fix test compilation issue when `ENS_USE_OPENMP` is set
Expand Down
1 change: 1 addition & 0 deletions doc/function_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ front.

The following optimizers can be used with multi-objective functions:
- [NSGA2](#nsga2)
- [MOEA/D-DE](#moead)

## Constrained functions

Expand Down
62 changes: 61 additions & 1 deletion doc/optimizers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,66 @@ optimizer.Optimize(f, coordinates);
* [SGD in Wikipedia](https://en.wikipedia.org/wiki/Stochastic_gradient_descent)
* [Differentiable separable functions](#differentiable-separable-functions)

## MOEA/D-DE
*An optimizer for arbitrary multi-objective functions.*
MOEA/D-DE (Multi Objective Evolutionary Algorithm based on Decomposition - Differential Evolution) is a multi
objective optimization algorithm. It works by decomposing the problem into a number of scalar optimization
subproblems which are solved simultaneously per generation. MOEA/D in itself is a framework, this particular
algorithm uses Differential Crossover followed by Polynomial Mutation to create offsprings which are then
decomposed to form a Single Objective Problem. A diversity preserving mechanism is also employed which encourages
a varied set of solution.

#### Constructors
* `MOEAD()`
* `MOEAD(`_`populationSize, maxGenerations, crossoverProb, neighborProb, neighborSize, distributionIndex, differentialWeight, maxReplace, epsilon, lowerBound, upperBound`_`)`

#### Attributes

| **type** | **name** | **description** | **default** |
|----------|----------|-----------------|-------------|
| `size_t` | **`populationSize`** | The number of candidates in the population. | `150` |
| `size_t` | **`maxGenerations`** | The maximum number of generations allowed. | `300` |
| `double` | **`crossoverProb`** | Probability that a crossover will occur. | `1.0` |
| `double` | **`neighborProb`** | The probability of sampling from neighbor. | `0.9` |
| `size_t` | **`neighborSize`** | The number of nearest-neighbours to consider per weight vector. | `20` |
| `double` | **`distributionIndex`** | The crowding degree of the mutation. | `20` |
| `double` | **`differentialWeight`** | Amplification factor of the differentiation. | `0.5` |
| `size_t` | **`maxReplace`** | The limit of solutions allowed to be replaced by a child. | `2`|
| `double` | **`epsilon`** | Handles numerical stability after weight initialization. | `1E-10`|
| `double`, `arma::vec` | **`lowerBound`** | Lower bound of the coordinates on the coordinates of the whole population during the search process. | `0` |
| `double`, `arma::vec` | **`upperBound`** | Lower bound of the coordinates on the coordinates of the whole population during the search process. | `1` |

Attributes of the optimizer may also be changed via the member methods
`PopulationSize()`, `MaxGenerations()`, `CrossoverRate()`, `NeighborProb()`, `NeighborSize()`, `DistributionIndex()`,
`DifferentialWeight()`, `MaxReplace()`, `Epsilon()`, `LowerBound()` and `UpperBound()`.

#### Examples:

<details open>
<summary>Click to collapse/expand example code.
</summary>

```c++
SchafferFunctionN1<arma::mat> SCH;
arma::vec lowerBound("-10 -10");
arma::vec upperBound("10 10");
MOEAD opt(150, 300, 1.0, 0.9, 20, 20, 0.5, 2, 1E-10, lowerBound, upperBound);
typedef decltype(SCH.objectiveA) ObjectiveTypeA;
typedef decltype(SCH.objectiveB) ObjectiveTypeB;
arma::mat coords = SCH.GetInitialPoint();
std::tuple<ObjectiveTypeA, ObjectiveTypeB> objectives = SCH.GetObjectives();
// obj will contain the minimum sum of objectiveA and objectiveB found on the best front.
double obj = opt.Optimize(objectives, coords);
// Now obtain the best front.
arma::cube bestFront = opt.ParetoFront();
```
</details>

#### See also
* [MOEA/D-DE Algorithm](https://ieeexplore.ieee.org/document/4633340)
* [Multi-objective Functions in Wikipedia](https://en.wikipedia.org/wiki/Test_functions_for_optimization#Test_functions_for_multi-objective_optimization)
* [Multi-objective functions](#multi-objective-functions)

## NSGA2

*An optimizer for arbitrary multi-objective functions.*
Expand Down Expand Up @@ -1619,7 +1679,7 @@ std::tuple<ObjectiveTypeA, ObjectiveTypeB> objectives = SCH.GetObjectives();
// obj will contain the minimum sum of objectiveA and objectiveB found on the best front.
double obj = opt.Optimize(objectives, coords);
// Now obtain the best front.
std::vector<arma::mat> bestFront = opt.Front();
arma::cube bestFront = opt.Front();
```

</details>
Expand Down
1 change: 1 addition & 0 deletions include/ensmallen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
#include "ensmallen_bits/katyusha/katyusha.hpp"
#include "ensmallen_bits/lbfgs/lbfgs.hpp"
#include "ensmallen_bits/lookahead/lookahead.hpp"
#include "ensmallen_bits/moead/moead.hpp"
#include "ensmallen_bits/nsga2/nsga2.hpp"
#include "ensmallen_bits/padam/padam.hpp"
#include "ensmallen_bits/parallel_sgd/parallel_sgd.hpp"
Expand Down
Loading