Skip to content

Commit 686bea0

Browse files
Upgrade ensmallen to 2.22.1 (#68)
* Upgrade ensmallen to 2.22.1 * Update requirements listed in description --------- Co-authored-by: coatless <[email protected]> Co-authored-by: [email protected] <[email protected]>
1 parent 84f286d commit 686bea0

File tree

14 files changed

+215
-192
lines changed

14 files changed

+215
-192
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2024-12-03 James Balamuta <[email protected]>
2+
3+
* DESCRIPTION: Updated requirements for Armadillo and C++ compiler
4+
5+
* DESCRIPTION (Version): Release 2.22.1
6+
* NEWS.md: Update for Ensmallen release 2.22.1
7+
* inst/include/ensmallen_bits: Upgraded to Ensmallen 2.22.1
8+
* inst/include/ensmallen.hpp: ditto
9+
110
2024-11-29 James Balamuta <[email protected]>
211

312
* inst/include/ensmallen_bits/agemoea/agemoea.hpp: removed unused private field variable

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: RcppEnsmallen
22
Title: Header-Only C++ Mathematical Optimization Library for 'Armadillo'
3-
Version: 0.2.22.0.1
3+
Version: 0.2.22.1.1
44
Authors@R: c(
55
person("James Joseph", "Balamuta", email = "[email protected]",
66
role = c("aut", "cre", "cph"),
@@ -22,15 +22,15 @@ Description: 'Ensmallen' is a templated C++ mathematical optimization library
2222
'RcppArmadillo' (the 'Rcpp' bindings/bridge to 'Armadillo') is licensed under
2323
the GNU GPL version 2 or later. Thus, 'RcppEnsmallen' is also licensed under
2424
similar terms. Note that 'Ensmallen' requires a compiler that supports
25-
'C++11' and 'Armadillo' 9.800 or later.
25+
'C++14' and 'Armadillo' 10.8.2 or later.
2626
Depends: R (>= 4.0.0)
2727
License: GPL (>= 2)
2828
URL: https://github.com/coatless-rpkg/rcppensmallen, https://r-pkg.thecoatlessprofessor.com/rcppensmallen/, https://github.com/mlpack/ensmallen, https://ensmallen.org/
2929
BugReports: https://github.com/coatless-rpkg/rcppensmallen/issues
3030
Encoding: UTF-8
31-
LinkingTo: Rcpp, RcppArmadillo (>= 0.9.800.0.0)
31+
LinkingTo: Rcpp, RcppArmadillo (>= 0.10.8.2.0)
3232
Imports: Rcpp
33-
RoxygenNote: 7.2.3
33+
RoxygenNote: 7.3.2
3434
Roxygen: list(markdown = TRUE)
3535
Suggests:
3636
knitr,

NEWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# RcppEnsmallen 0.2.22.1.1
2+
3+
- Upgraded to ensmallen 2.22.1: "E-Bike Excitement" (2024-12-03)
4+
- Remove unused variables to fix compiler warnings
5+
([#413](https://github.com/mlpack/ensmallen/pull/413)).
6+
- DESCRIPTION now emphasizes a C++14 or greater compiler and a requirement for
7+
Armadillo 10.8.2 or higher library.
8+
([#68](https://github.com/coatless-rpkg/rcppensmallen/pull/68)).
9+
110
# RcppEnsmallen 0.2.22.0.1
211

312
- Upgraded to ensmallen 2.22.0: "E-Bike Excitement" (2024-11-29)

inst/include/ensmallen_bits/agemoea/agemoea.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ class AGEMOEA
347347
size_t idxQ,
348348
const std::vector<size_t>& ranks,
349349
const std::vector<typename MatType::elem_type>& survivalScore);
350-
350+
351351
/**
352352
* Normalizes the front given the extreme points in the current front.
353353
*
@@ -363,7 +363,7 @@ class AGEMOEA
363363
arma::Col<typename MatType::elem_type>& normalization,
364364
const std::vector<size_t>& front,
365365
const arma::Row<size_t>& extreme);
366-
366+
367367
/**
368368
* Get the geometry information p of Lp norm (p > 0).
369369
*
@@ -377,7 +377,7 @@ class AGEMOEA
377377
std::vector<arma::Col<typename MatType::elem_type> >& calculatedObjectives,
378378
const std::vector<size_t>& front,
379379
const arma::Row<size_t>& extreme);
380-
380+
381381
/**
382382
* Finds the pairwise Lp distance between all the points in the front.
383383
*
@@ -395,7 +395,7 @@ class AGEMOEA
395395

396396
/**
397397
* Finding the indexes of the extreme points in the front.
398-
*
398+
*
399399
* @param indexes vector containing the slected indexes.
400400
* @param calculatedObjectives The current population objectives.
401401
* @param front The front of the current generation.
@@ -405,11 +405,11 @@ class AGEMOEA
405405
arma::Row<size_t>& indexes,
406406
std::vector<arma::Col<typename MatType::elem_type> >& calculatedObjectives,
407407
const std::vector<size_t>& front);
408-
408+
409409
/**
410410
* Finding the distance of each point in the front from the line formed
411411
* by pointA and pointB.
412-
*
412+
*
413413
* @param distance The vector containing the distances of the points in the fron from the line.
414414
* @param calculatedObjectives Reference to the current population evaluated Objectives.
415415
* @param front The front of the current generation(indices of population).
@@ -423,10 +423,10 @@ class AGEMOEA
423423
const std::vector<size_t>& front,
424424
const arma::Col<typename MatType::elem_type>& pointA,
425425
const arma::Col<typename MatType::elem_type>& pointB);
426-
426+
427427
/**
428428
* Find the Diversity score corresponding the solution S using the selected set.
429-
*
429+
*
430430
* @param selected The current selected set.
431431
* @param pairwiseDistance The current pairwise distance for the whole front.
432432
* @param S The relative index of S being considered within the front.

inst/include/ensmallen_bits/ens_version.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
// The minor version is two digits so regular numerical comparisons of versions
1717
// work right. The first minor version of a release is always 10.
1818
#define ENS_VERSION_MINOR 22
19-
#define ENS_VERSION_PATCH 0
19+
#define ENS_VERSION_PATCH 1
2020
// If this is a release candidate, it will be reflected in the version name
2121
// (i.e. the version name will be "RC1", "RC2", etc.). Otherwise the version
2222
// name will typically be a seemingly arbitrary set of words that does not
2323
// contain the capitalized string "RC".
2424
#define ENS_VERSION_NAME "E-Bike Excitement"
2525
// Incorporate the date the version was released.
2626
#define ENS_VERSION_YEAR "2024"
27-
#define ENS_VERSION_MONTH "11"
28-
#define ENS_VERSION_DAY "29"
27+
#define ENS_VERSION_MONTH "12"
28+
#define ENS_VERSION_DAY "02"
2929

3030
namespace ens {
3131

inst/include/ensmallen_bits/problems/dtlz/dtlz2_function.hpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace test {
2323
* \f[
2424
* x_M = [x_i, n - M + 1 <= i <= n]
2525
* g(x) = \Sigma{i = n - M + 1}^n (x_i - 0.5)^2
26-
*
27-
* 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))
26+
*
27+
* 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))
2828
* 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))
2929
* .
3030
* .
@@ -35,9 +35,9 @@ namespace test {
3535
* 0 <= x_i <= 1 for i = 1,...,n.
3636
*
3737
* This should be optimized to x_i = 0.5 (for all x_i in x_M), at:
38-
*
38+
*
3939
* For more information, please refer to:
40-
*
40+
*
4141
* @code
4242
* @incollection{deb2005scalable,
4343
* title={Scalable test problems for evolutionary multiobjective optimization},
@@ -62,7 +62,7 @@ namespace test {
6262
size_t numParetoPoints;
6363

6464
public:
65-
65+
6666
/**
6767
* Object Constructor.
6868
* Initializes the individual objective functions.
@@ -82,10 +82,10 @@ namespace test {
8282
// Convenience typedef.
8383
typedef typename MatType::elem_type ElemType;
8484
return arma::Col<ElemType>(numVariables, 1, arma::fill::zeros);
85-
}
86-
85+
}
86+
8787
// Get the private variables.
88-
88+
8989
// Get the number of objectives.
9090
size_t GetNumObjectives ()
9191
{ return this -> numObjectives; }
@@ -113,16 +113,16 @@ namespace test {
113113

114114
// Convenience typedef.
115115
typedef typename MatType::elem_type ElemType;
116-
116+
117117
arma::Row<ElemType> innerSum(size(coords)[1], arma::fill::zeros);
118-
118+
119119
for(size_t i = numObjectives - 1; i < numVariables; i++)
120120
{
121-
innerSum += arma::pow((coords.row(i) - 0.5), 2);
122-
}
123-
121+
innerSum += arma::pow((coords.row(i) - 0.5), 2);
122+
}
123+
124124
return innerSum;
125-
}
125+
}
126126

127127
/**
128128
* Evaluate the objectives with the given coordinate.
@@ -140,21 +140,21 @@ namespace test {
140140
arma::Row<ElemType> value = 0.5 * (1.0 + G);
141141
for(size_t i = 0; i < numObjectives - 1; i++)
142142
{
143-
objectives.row(i) = value %
143+
objectives.row(i) = value %
144144
arma::sin(coords.row(i) * arma::datum::pi * 0.5);
145-
value = value % arma::cos(coords.row(i) * arma::datum::pi * 0.5);
145+
value = value % arma::cos(coords.row(i) * arma::datum::pi * 0.5);
146146
}
147147
objectives.row(numObjectives - 1) = value;
148-
return objectives;
148+
return objectives;
149149
}
150-
150+
151151
// Individual Objective function.
152-
// Changes based on stop variable provided.
152+
// Changes based on stop variable provided.
153153
struct DTLZ2Objective
154154
{
155155
DTLZ2Objective(size_t stop, DTLZ2& dtlz): stop(stop), dtlz(dtlz)
156-
{/* Nothing to do here. */}
157-
156+
{/* Nothing to do here. */}
157+
158158
/**
159159
* Evaluate one objective with the given coordinate.
160160
*
@@ -181,8 +181,8 @@ namespace test {
181181
}
182182

183183
value = value * (1.0 + dtlz.g(coords)[0]);
184-
return value;
185-
}
184+
return value;
185+
}
186186

187187
DTLZ2& dtlz;
188188
size_t stop;
@@ -192,12 +192,12 @@ namespace test {
192192
std::tuple<DTLZ2Objective, DTLZ2Objective, DTLZ2Objective> GetObjectives()
193193
{
194194
return std::make_tuple(objectiveF1, objectiveF2, objectiveF3);
195-
}
195+
}
196196

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

216-
#endif
216+
#endif

inst/include/ensmallen_bits/problems/dtlz/dtlz4_function.hpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace test {
2323
* \f[
2424
* x_M = [x_i, n - M + 1 <= i <= n]
2525
* g(x) = \Sigma{i = n - M + 1}^n (x_i - 0.5)^2
26-
*
27-
* 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))
26+
*
27+
* 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))
2828
* 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))
2929
* .
3030
* .
@@ -35,9 +35,9 @@ namespace test {
3535
* 0 <= x_i <= 1 for i = 1,...,n.
3636
*
3737
* This should be optimized to x_i = 0.5 (for all x_i in x_M), at:
38-
*
38+
*
3939
* For more information, please refer to:
40-
*
40+
*
4141
* @code
4242
* @incollection{deb2005scalable,
4343
* title={Scalable test problems for evolutionary multiobjective optimization},
@@ -85,8 +85,8 @@ namespace test {
8585
// Convenience typedef.
8686
typedef typename MatType::elem_type ElemType;
8787
return arma::Col<ElemType>(numVariables, 1, arma::fill::zeros);
88-
}
89-
88+
}
89+
9090
// Get the private variables.
9191

9292
// Get the number of objectives.
@@ -116,16 +116,16 @@ namespace test {
116116

117117
// Convenience typedef.
118118
typedef typename MatType::elem_type ElemType;
119-
119+
120120
arma::Row<ElemType> innerSum(size(coords)[1], arma::fill::zeros);
121-
121+
122122
for(size_t i = numObjectives - 1; i < numVariables; i++)
123123
{
124-
innerSum += arma::pow((coords.row(i) - 0.5), 2);
125-
}
126-
124+
innerSum += arma::pow((coords.row(i) - 0.5), 2);
125+
}
126+
127127
return innerSum;
128-
}
128+
}
129129

130130
/**
131131
* Evaluate the objectives with the given coordinate.
@@ -143,21 +143,21 @@ namespace test {
143143
arma::Row<ElemType> value = 0.5 * (1.0 + G);
144144
for(size_t i = 0; i < numObjectives - 1; i++)
145145
{
146-
objectives.row(i) = value %
146+
objectives.row(i) = value %
147147
arma::sin(arma::pow(coords.row(i), alpha) * arma::datum::pi * 0.5);
148-
value = value % arma::cos(arma::pow(coords.row(i), alpha) * arma::datum::pi * 0.5);
148+
value = value % arma::cos(arma::pow(coords.row(i), alpha) * arma::datum::pi * 0.5);
149149
}
150150
objectives.row(numObjectives - 1) = value;
151-
return objectives;
151+
return objectives;
152152
}
153-
153+
154154
// Individual Objective function.
155-
// Changes based on stop variable provided.
155+
// Changes based on stop variable provided.
156156
struct DTLZ4Objective
157157
{
158158
DTLZ4Objective(size_t stop, DTLZ4& dtlz): stop(stop), dtlz(dtlz)
159-
{/* Nothing to do here.*/}
160-
159+
{/* Nothing to do here.*/}
160+
161161
/**
162162
* Evaluate one objective with the given coordinate.
163163
*
@@ -184,8 +184,8 @@ namespace test {
184184
}
185185

186186
value = value * (1 + dtlz.g(coords)[0]);
187-
return value;
188-
}
187+
return value;
188+
}
189189

190190
DTLZ4& dtlz;
191191
size_t stop;
@@ -195,12 +195,12 @@ namespace test {
195195
std::tuple<DTLZ4Objective, DTLZ4Objective, DTLZ4Objective> GetObjectives()
196196
{
197197
return std::make_tuple(objectiveF1, objectiveF2, objectiveF3);
198-
}
198+
}
199199

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

219-
#endif
219+
#endif

0 commit comments

Comments
 (0)