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

Upgrade ensmallen to 2.22.1 #68

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2024-12-03 James Balamuta <balamut2@illinois.edu>

* DESCRIPTION: Updated requirements for Armadillo and C++ compiler

* DESCRIPTION (Version): Release 2.22.1
* NEWS.md: Update for Ensmallen release 2.22.1
* inst/include/ensmallen_bits: Upgraded to Ensmallen 2.22.1
* inst/include/ensmallen.hpp: ditto

2024-11-29 James Balamuta <balamut2@illinois.edu>

* inst/include/ensmallen_bits/agemoea/agemoea.hpp: removed unused private field variable
Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RcppEnsmallen
Title: Header-Only C++ Mathematical Optimization Library for 'Armadillo'
Version: 0.2.22.0.1
Version: 0.2.22.1.1
Authors@R: c(
person("James Joseph", "Balamuta", email = "balamut2@illinois.edu",
role = c("aut", "cre", "cph"),
Expand All @@ -22,15 +22,15 @@ Description: 'Ensmallen' is a templated C++ mathematical optimization library
'RcppArmadillo' (the 'Rcpp' bindings/bridge to 'Armadillo') is licensed under
the GNU GPL version 2 or later. Thus, 'RcppEnsmallen' is also licensed under
similar terms. Note that 'Ensmallen' requires a compiler that supports
'C++11' and 'Armadillo' 9.800 or later.
'C++14' and 'Armadillo' 10.8.2 or later.
Depends: R (>= 4.0.0)
License: GPL (>= 2)
URL: https://github.com/coatless-rpkg/rcppensmallen, https://r-pkg.thecoatlessprofessor.com/rcppensmallen/, https://github.com/mlpack/ensmallen, https://ensmallen.org/
BugReports: https://github.com/coatless-rpkg/rcppensmallen/issues
Encoding: UTF-8
LinkingTo: Rcpp, RcppArmadillo (>= 0.9.800.0.0)
LinkingTo: Rcpp, RcppArmadillo (>= 0.10.8.2.0)
Imports: Rcpp
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
Suggests:
knitr,
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# RcppEnsmallen 0.2.22.1.1

- Upgraded to ensmallen 2.22.1: "E-Bike Excitement" (2024-12-03)
- Remove unused variables to fix compiler warnings
([#413](https://github.com/mlpack/ensmallen/pull/413)).
- DESCRIPTION now emphasizes a C++14 or greater compiler and a requirement for
Armadillo 10.8.2 or higher library.
([#68](https://github.com/coatless-rpkg/rcppensmallen/pull/68)).

# RcppEnsmallen 0.2.22.0.1

- Upgraded to ensmallen 2.22.0: "E-Bike Excitement" (2024-11-29)
Expand Down
16 changes: 8 additions & 8 deletions inst/include/ensmallen_bits/agemoea/agemoea.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class AGEMOEA
size_t idxQ,
const std::vector<size_t>& ranks,
const std::vector<typename MatType::elem_type>& survivalScore);

/**
* Normalizes the front given the extreme points in the current front.
*
Expand All @@ -363,7 +363,7 @@ class AGEMOEA
arma::Col<typename MatType::elem_type>& normalization,
const std::vector<size_t>& front,
const arma::Row<size_t>& extreme);

/**
* Get the geometry information p of Lp norm (p > 0).
*
Expand All @@ -377,7 +377,7 @@ class AGEMOEA
std::vector<arma::Col<typename MatType::elem_type> >& calculatedObjectives,
const std::vector<size_t>& front,
const arma::Row<size_t>& extreme);

/**
* Finds the pairwise Lp distance between all the points in the front.
*
Expand All @@ -395,7 +395,7 @@ class AGEMOEA

/**
* Finding the indexes of the extreme points in the front.
*
*
* @param indexes vector containing the slected indexes.
* @param calculatedObjectives The current population objectives.
* @param front The front of the current generation.
Expand All @@ -405,11 +405,11 @@ class AGEMOEA
arma::Row<size_t>& indexes,
std::vector<arma::Col<typename MatType::elem_type> >& calculatedObjectives,
const std::vector<size_t>& front);

/**
* Finding the distance of each point in the front from the line formed
* by pointA and pointB.
*
*
* @param distance The vector containing the distances of the points in the fron from the line.
* @param calculatedObjectives Reference to the current population evaluated Objectives.
* @param front The front of the current generation(indices of population).
Expand All @@ -423,10 +423,10 @@ class AGEMOEA
const std::vector<size_t>& front,
const arma::Col<typename MatType::elem_type>& pointA,
const arma::Col<typename MatType::elem_type>& pointB);

/**
* Find the Diversity score corresponding the solution S using the selected set.
*
*
* @param selected The current selected set.
* @param pairwiseDistance The current pairwise distance for the whole front.
* @param S The relative index of S being considered within the front.
Expand Down
6 changes: 3 additions & 3 deletions inst/include/ensmallen_bits/ens_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
// The minor version is two digits so regular numerical comparisons of versions
// work right. The first minor version of a release is always 10.
#define ENS_VERSION_MINOR 22
#define ENS_VERSION_PATCH 0
#define ENS_VERSION_PATCH 1
// If this is a release candidate, it will be reflected in the version name
// (i.e. the version name will be "RC1", "RC2", etc.). Otherwise the version
// name will typically be a seemingly arbitrary set of words that does not
// contain the capitalized string "RC".
#define ENS_VERSION_NAME "E-Bike Excitement"
// Incorporate the date the version was released.
#define ENS_VERSION_YEAR "2024"
#define ENS_VERSION_MONTH "11"
#define ENS_VERSION_DAY "29"
#define ENS_VERSION_MONTH "12"
#define ENS_VERSION_DAY "02"

namespace ens {

Expand Down
52 changes: 26 additions & 26 deletions inst/include/ensmallen_bits/problems/dtlz/dtlz2_function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace test {
* \f[
* x_M = [x_i, n - M + 1 <= i <= n]
* g(x) = \Sigma{i = n - M + 1}^n (x_i - 0.5)^2
*
* f_1(x) = 0.5 * cos(x_1 * pi * 0.5) * cos(x_2 * pi * 0.5) * ... cos(x_2 * pi * 0.5) * (1 + g(x_M))
*
* f_1(x) = 0.5 * cos(x_1 * pi * 0.5) * cos(x_2 * pi * 0.5) * ... cos(x_2 * pi * 0.5) * (1 + g(x_M))
* f_2(x) = 0.5 * cos(x_1 * pi * 0.5) * cos(x_2 * pi * 0.5) * ... sin(x_M-1 * pi * 0.5) * (1 + g(x_M))
* .
* .
Expand All @@ -35,9 +35,9 @@ namespace test {
* 0 <= x_i <= 1 for i = 1,...,n.
*
* This should be optimized to x_i = 0.5 (for all x_i in x_M), at:
*
*
* For more information, please refer to:
*
*
* @code
* @incollection{deb2005scalable,
* title={Scalable test problems for evolutionary multiobjective optimization},
Expand All @@ -62,7 +62,7 @@ namespace test {
size_t numParetoPoints;

public:

/**
* Object Constructor.
* Initializes the individual objective functions.
Expand All @@ -82,10 +82,10 @@ namespace test {
// Convenience typedef.
typedef typename MatType::elem_type ElemType;
return arma::Col<ElemType>(numVariables, 1, arma::fill::zeros);
}

}
// Get the private variables.

// Get the number of objectives.
size_t GetNumObjectives ()
{ return this -> numObjectives; }
Expand Down Expand Up @@ -113,16 +113,16 @@ namespace test {

// Convenience typedef.
typedef typename MatType::elem_type ElemType;

arma::Row<ElemType> innerSum(size(coords)[1], arma::fill::zeros);

for(size_t i = numObjectives - 1; i < numVariables; i++)
{
innerSum += arma::pow((coords.row(i) - 0.5), 2);
}

innerSum += arma::pow((coords.row(i) - 0.5), 2);
}
return innerSum;
}
}

/**
* Evaluate the objectives with the given coordinate.
Expand All @@ -140,21 +140,21 @@ namespace test {
arma::Row<ElemType> value = 0.5 * (1.0 + G);
for(size_t i = 0; i < numObjectives - 1; i++)
{
objectives.row(i) = value %
objectives.row(i) = value %
arma::sin(coords.row(i) * arma::datum::pi * 0.5);
value = value % arma::cos(coords.row(i) * arma::datum::pi * 0.5);
value = value % arma::cos(coords.row(i) * arma::datum::pi * 0.5);
}
objectives.row(numObjectives - 1) = value;
return objectives;
return objectives;
}

// Individual Objective function.
// Changes based on stop variable provided.
// Changes based on stop variable provided.
struct DTLZ2Objective
{
DTLZ2Objective(size_t stop, DTLZ2& dtlz): stop(stop), dtlz(dtlz)
{/* Nothing to do here. */}

{/* Nothing to do here. */}
/**
* Evaluate one objective with the given coordinate.
*
Expand All @@ -181,8 +181,8 @@ namespace test {
}

value = value * (1.0 + dtlz.g(coords)[0]);
return value;
}
return value;
}

DTLZ2& dtlz;
size_t stop;
Expand All @@ -192,12 +192,12 @@ namespace test {
std::tuple<DTLZ2Objective, DTLZ2Objective, DTLZ2Objective> GetObjectives()
{
return std::make_tuple(objectiveF1, objectiveF2, objectiveF3);
}
}

//! Get the Reference Front.
//! Front. The implementation has been taken from pymoo.
arma::mat GetReferenceFront()
{
{
Uniform refGenerator;
arma::mat refDirs = refGenerator.Generate<arma::mat>(3, this -> numParetoPoints, 0);
arma::colvec x = arma::normalise(refDirs, 2, 1);
Expand All @@ -213,4 +213,4 @@ namespace test {
} //namespace test
} //namespace ens

#endif
#endif
48 changes: 24 additions & 24 deletions inst/include/ensmallen_bits/problems/dtlz/dtlz4_function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace test {
* \f[
* x_M = [x_i, n - M + 1 <= i <= n]
* g(x) = \Sigma{i = n - M + 1}^n (x_i - 0.5)^2
*
* f_1(x) = 0.5 * cos(x_1^alpha * pi * 0.5) * cos(x_2^alpha * pi * 0.5) * ... cos(x_2^alpha * pi * 0.5) * (1 + g(x_M))
*
* f_1(x) = 0.5 * cos(x_1^alpha * pi * 0.5) * cos(x_2^alpha * pi * 0.5) * ... cos(x_2^alpha * pi * 0.5) * (1 + g(x_M))
* f_2(x) = 0.5 * cos(x_1^alpha * pi * 0.5) * cos(x_2^alpha * pi * 0.5) * ... sin(x_M-1^alpha * pi * 0.5) * (1 + g(x_M))
* .
* .
Expand All @@ -35,9 +35,9 @@ namespace test {
* 0 <= x_i <= 1 for i = 1,...,n.
*
* This should be optimized to x_i = 0.5 (for all x_i in x_M), at:
*
*
* For more information, please refer to:
*
*
* @code
* @incollection{deb2005scalable,
* title={Scalable test problems for evolutionary multiobjective optimization},
Expand Down Expand Up @@ -85,8 +85,8 @@ namespace test {
// Convenience typedef.
typedef typename MatType::elem_type ElemType;
return arma::Col<ElemType>(numVariables, 1, arma::fill::zeros);
}

}
// Get the private variables.

// Get the number of objectives.
Expand Down Expand Up @@ -116,16 +116,16 @@ namespace test {

// Convenience typedef.
typedef typename MatType::elem_type ElemType;

arma::Row<ElemType> innerSum(size(coords)[1], arma::fill::zeros);

for(size_t i = numObjectives - 1; i < numVariables; i++)
{
innerSum += arma::pow((coords.row(i) - 0.5), 2);
}

innerSum += arma::pow((coords.row(i) - 0.5), 2);
}
return innerSum;
}
}

/**
* Evaluate the objectives with the given coordinate.
Expand All @@ -143,21 +143,21 @@ namespace test {
arma::Row<ElemType> value = 0.5 * (1.0 + G);
for(size_t i = 0; i < numObjectives - 1; i++)
{
objectives.row(i) = value %
objectives.row(i) = value %
arma::sin(arma::pow(coords.row(i), alpha) * arma::datum::pi * 0.5);
value = value % arma::cos(arma::pow(coords.row(i), alpha) * arma::datum::pi * 0.5);
value = value % arma::cos(arma::pow(coords.row(i), alpha) * arma::datum::pi * 0.5);
}
objectives.row(numObjectives - 1) = value;
return objectives;
return objectives;
}

// Individual Objective function.
// Changes based on stop variable provided.
// Changes based on stop variable provided.
struct DTLZ4Objective
{
DTLZ4Objective(size_t stop, DTLZ4& dtlz): stop(stop), dtlz(dtlz)
{/* Nothing to do here.*/}

{/* Nothing to do here.*/}
/**
* Evaluate one objective with the given coordinate.
*
Expand All @@ -184,8 +184,8 @@ namespace test {
}

value = value * (1 + dtlz.g(coords)[0]);
return value;
}
return value;
}

DTLZ4& dtlz;
size_t stop;
Expand All @@ -195,12 +195,12 @@ namespace test {
std::tuple<DTLZ4Objective, DTLZ4Objective, DTLZ4Objective> GetObjectives()
{
return std::make_tuple(objectiveF1, objectiveF2, objectiveF3);
}
}

//! Get the Reference Front.
//! Front. The implementation has been taken from pymoo.
arma::mat GetReferenceFront()
{
{
Uniform refGenerator;
arma::mat refDirs = refGenerator.Generate<arma::mat>(3, this -> numParetoPoints, 0);
arma::colvec x = arma::normalise(refDirs, 2, 1);
Expand All @@ -216,4 +216,4 @@ namespace test {
} //namespace test
} //namespace ens

#endif
#endif
Loading
Loading