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

Introduce Policy Methods for MOEA/D-DE #293

Merged
merged 43 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9e6b3ca
Fixed minor indent
jonpsy Jun 13, 2021
c66ee3a
Make MOEA/D-DE policy based
jonpsy Jun 14, 2021
2749d31
Added decomposition policies
jonpsy Jun 14, 2021
d41c265
Added Init policies
jonpsy Jun 14, 2021
9242279
Re-configure tests
jonpsy Jun 14, 2021
e08c0c8
fix moead doc
jonpsy Jun 15, 2021
7505ecc
fix decomposition policy docs
jonpsy Jun 15, 2021
dbc24bb
moead doc fix
jonpsy Jun 15, 2021
6868e2c
restore all tests
jonpsy Jun 15, 2021
945e21a
history fix
jonpsy Jun 16, 2021
ee41faa
Tested against ZDT1
jonpsy Jun 16, 2021
6e1164e
remove uniform_init.hpp as of now
jonpsy Jun 16, 2021
cfed986
Update include/ensmallen_bits/moead/moead.hpp
jonpsy Jun 16, 2021
4692047
Update include/ensmallen_bits/moead/moead.hpp
jonpsy Jun 16, 2021
e092c4d
Update include/ensmallen_bits/moead/moead.hpp
jonpsy Jun 16, 2021
ade51c9
Update include/ensmallen_bits/moead/decomposition_policies/pbi_decomp…
jonpsy Jun 16, 2021
4ec1f2e
Update include/ensmallen_bits/moead/moead.hpp
jonpsy Jun 16, 2021
8952378
Update include/ensmallen_bits/moead/decomposition_policies/weighted_d…
jonpsy Jun 16, 2021
2c02c5f
Update include/ensmallen_bits/moead/decomposition_policies/tchebychef…
jonpsy Jun 16, 2021
9beaa5f
InitPolicy, Generate const
jonpsy Jun 16, 2021
de612d3
using DefaultMOEAD
jonpsy Jun 16, 2021
6e3e323
doc decomposition policy
jonpsy Jun 16, 2021
8d81b42
indent
jonpsy Jun 16, 2021
4997f55
add doc for bbs
jonpsy Jun 16, 2021
d02d5e4
extra doc for decomp policy
jonpsy Jun 16, 2021
77bd44b
added template doc in optimizer.md
jonpsy Jun 16, 2021
23ff190
minor fix
jonpsy Jun 16, 2021
40c9aaa
Start RDP
jonpsy Jun 16, 2021
c79f593
no need to build redundant tests
jonpsy Jun 16, 2021
7d86a46
Update include/ensmallen_bits/moead/decomposition_policies/pbi_decomp…
jonpsy Jun 16, 2021
be9f8b6
Update include/ensmallen_bits/moead/decomposition_policies/tchebychef…
jonpsy Jun 16, 2021
c1fbf16
Update include/ensmallen_bits/moead/decomposition_policies/weighted_d…
jonpsy Jun 16, 2021
79aa3f6
Update include/ensmallen_bits/moead/decomposition_policies/pbi_decomp…
jonpsy Jun 16, 2021
d7f2be2
Update include/ensmallen_bits/moead/moead.hpp
jonpsy Jun 16, 2021
955e7db
Update include/ensmallen_bits/moead/weight_init_policies/bbs_init.hpp
jonpsy Jun 16, 2021
e2b883d
Update include/ensmallen_bits/moead/moead_impl.hpp
jonpsy Jun 16, 2021
e3b865f
revert moead test
jonpsy Jun 16, 2021
d66c3d0
Merge branch 'moead+' of https://github.com/jonpsy/ensmallen into moead+
jonpsy Jun 16, 2021
91ed336
remove stackoverflow link
jonpsy Jun 16, 2021
a8b9018
use arma::diff
jonpsy Jun 16, 2021
18a4ca6
revert appveyor.yml
jonpsy Jun 16, 2021
bd6cf8a
Set bad threshold as of now.
jonpsy Jun 16, 2021
ff03b06
restore cmake
jonpsy Jun 16, 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
5 changes: 4 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@

* Make Callback flexible for MultiObjective Optimizers
([#289](https://github.com/mlpack/ensmallen/pull/289)).

* Add ZDT Test Suite
([#273](https://github.com/mlpack/ensmallen/pull/273)).

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

* Introduce Policy Methods for MOEA/D-DE
([#293](https://github.com/mlpack/ensmallen/pull/293)).

### ensmallen 2.16.1: "Severely Dented Can Of Polyurethane"
###### 2021-03-02
* Fix test compilation issue when `ENS_USE_OPENMP` is set
Expand Down
31 changes: 27 additions & 4 deletions doc/optimizers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1573,8 +1573,29 @@ decomposed to form a Single Objective Problem. A diversity preserving mechanism
a varied set of solution.

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

The _`InitPolicyType`_ template parameter refers to the strategy used to
initialize the reference directions.

The following types are available:

* **`BayesianBootstrap`**

The _`DecompPolicyType`_ template parameter refers to the strategy used to
decompose the weight vectors to form a scalar objective function.

The following types are available:

* **`Tchebycheff`**
* **`WeightedAverage`**
* **`PenaltyBoundaryIntersection`**

For convenience the following types can be used:

* **`DefaultMOEAD`** (equivalent to `MOEAD<BayesianBootstrap, Tchebycheff>`): utilizes BayesianBootstrap for weight init
and Tchebycheff for weight decomposition.

#### Attributes

Expand All @@ -1591,10 +1612,12 @@ a varied set of solution.
| `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` |
| `InitPolicyType` | **`initPolicy`** | Instantiated init policy used to initialize weights. | `InitPolicyType()` |
| `DecompPolicyType` | **`decompPolicy`** | Instantiated decomposition policy used to create scalar objective problem. | `DecompPolicyType()` |

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

#### Examples:

Expand All @@ -1606,7 +1629,7 @@ Attributes of the optimizer may also be changed via the member methods
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);
DefaultMOEAD 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();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* @file pbi_decomposition.hpp
* @author Nanubala Gnana Sai
*
* The Penalty Based Boundary Intersection (PBI) decomposition policy.
*
* ensmallen is free software; you may redistribute it and/or modify it under
* the terms of the 3-clause BSD license. You should have received a copy of
* the 3-clause BSD license along with ensmallen. If not, see
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#ifndef ENSMALLEN_MOEAD_PBI_HPP
#define ENSMALLEN_MOEAD_PBI_HPP

namespace ens {

/**
* Penalty Based Boundary Intersection (PBI) method is a weight decomposition method,
* it tries to find the intersection between bottom-most boundary of the attainable
* objective set with the reference directions.
*
* The goal is to minimize the distance between objective vectors with the ideal point
* along the reference direction. To handle equality constraints, a penalty parameter
* theta is used.
*
* For more information, see the following:
* @code
* article{zhang2007moea,
* title={MOEA/D: A multiobjective evolutionary algorithm based on decomposition},
* author={Zhang, Qingfu and Li, Hui},
* journal={IEEE Transactions on evolutionary computation},
* pages={712--731},
* year={2007}
* @endcode
*/
class PenaltyBoundaryIntersection
{
public:
/**
* Constructor for Penalty Based Boundary Intersection decomposition
* policy.
*
* @param theta The penalty value.
*/
PenaltyBoundaryIntersection(const double theta = 5) :
jonpsy marked this conversation as resolved.
Show resolved Hide resolved
theta(theta)
{
/* Nothing to do. */
}

/**
* Decompose the weight vectors.
*
* @tparam VecType The type of the vector used in the decommposition.
* @param weight The weight vector corresponding to a subproblem.
* @param idealPoint The reference point in the objective space.
* @param candidateFitness The objective vector of the candidate.
*/
template<typename VecType>
typename VecType::elem_type Apply(const VecType& weight,
const VecType& idealPoint,
const VecType& candidateFitness)
{
typedef typename VecType::elem_type ElemType;
//! A unit vector in the same direction as the provided weight vector.
const VecType referenceDirection = weight / arma::norm(weight, 1);
//! Distance of F(x) from the idealPoint along the reference direction.
const ElemType d1 = arma::dot(candidateFitness - idealPoint, referenceDirection);
//! The perpendicular distance of F(x) from reference direction.
const ElemType d2 = arma::norm(candidateFitness - (idealPoint + d1 * referenceDirection), 1);

return d1 + static_cast<ElemType>(theta) * d2;
}

private:
double theta;
};

} // namespace ens

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* @file tchebycheff_decomposition.hpp
* @author Nanubala Gnana Sai
*
* The Tchebycheff Weight decomposition policy.
*
* ensmallen is free software; you may redistribute it and/or modify it under
* the terms of the 3-clause BSD license. You should have received a copy of
* the 3-clause BSD license along with ensmallen. If not, see
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#ifndef ENSMALLEN_MOEAD_TCHEBYCHEFF_HPP
#define ENSMALLEN_MOEAD_TCHEBYCHEFF_HPP

namespace ens {

/**
* The Tchebycheff method works by taking the maximum of element-wise product
* between reference direction and the line connecting objective vector and
* ideal point.
*
* Under mild conditions, for each Pareto Optimal point there exists a reference
* direction such that the given point is also the optimal solution
* to this scalar objective.
*
* For more information, see the following:
* @code
* article{zhang2007moea,
* title={MOEA/D: A multiobjective evolutionary algorithm based on decomposition},
* author={Zhang, Qingfu and Li, Hui},
* journal={IEEE Transactions on evolutionary computation},
* pages={712--731},
* year={2007}
* @endcode
*/
class Tchebycheff
{
public:
/**
* Constructor for Tchebycheff decomposition policy.
*/
Tchebycheff()
{
/* Nothing to do. */
}

/**
* Decompose the weight vectors.
*
* @tparam VecType The type of the vector used in the decommposition.
* @param weight The weight vector corresponding to a subproblem.
* @param idealPoint The reference point in the objective space.
* @param candidateFitness The objective vector of the candidate.
*/
template<typename VecType>
typename VecType::elem_type Apply(const VecType& weight,
const VecType& idealPoint,
const VecType& candidateFitness)
{
return arma::max(weight % arma::abs(candidateFitness - idealPoint));
}
};

} // namespace ens

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* @file weighted_decomposition.hpp
* @author Nanubala Gnana Sai
*
* The Weighted Average decomposition policy.
*
* ensmallen is free software; you may redistribute it and/or modify it under
* the terms of the 3-clause BSD license. You should have received a copy of
* the 3-clause BSD license along with ensmallen. If not, see
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#ifndef ENSMALLEN_MOEAD_WEIGHTED_HPP
#define ENSMALLEN_MOEAD_WEIGHTED_HPP

namespace ens {

/**
* The Weighted average method of decomposition. The working principle is to
* minimize the dot product between reference direction and the line connecting
* objective vector and ideal point.
*
* For more information, see the following:
* @code
* article{zhang2007moea,
* title={MOEA/D: A multiobjective evolutionary algorithm based on decomposition},
* author={Zhang, Qingfu and Li, Hui},
* journal={IEEE Transactions on evolutionary computation},
* pages={712--731},
* year={2007}
* @endcode
*/
class WeightedAverage
{
public:
/**
* Constructor for Weighted Average decomposition policy.
*/
WeightedAverage()
{
/* Nothing to do. */
}

/**
* Decompose the weight vectors.
*
* @tparam VecType The type of the vector used in the decommposition.
* @param weight The weight vector corresponding to a subproblem.
* @param idealPoint The reference point in the objective space.
* @param candidateFitness The objective vector of the candidate.
*/
template<typename VecType>
typename VecType::elem_type Apply(const VecType& weight,
const VecType& /* idealPoint */,
const VecType& candidateFitness)
{
return arma::dot(weight, candidateFitness);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one is so easy, love it.

}
};

} // namespace ens

#endif
Loading