Skip to content

Commit c9956a0

Browse files
Upgrade ensmallen to 2.14.1 (#31)
* Upgrade ensmallen to 2.14.1 * Fix NEWS.md entry. Add GitHub Action development note. * Add ChangeLog Update * Switch to HTTPS for ensmallen and mlpack websites Co-authored-by: coatless <[email protected]> Co-authored-by: James Balamuta <[email protected]>
1 parent 7ddc299 commit c9956a0

File tree

14 files changed

+1059
-14
lines changed

14 files changed

+1059
-14
lines changed

ChangeLog

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
2020-08-22 James Balamuta <[email protected]>
22

3+
* DESCRIPTION (Version): Release 2.14.1
4+
* NEWS.md: Update for Ensmallen release 2.14.1
5+
* inst/include/ensmallen_bits: Upgraded to Ensmallen 2.14.1
6+
* inst/include/ensmallen.hpp: ditto
7+
38
* .github/workflows/R-CMD-check.yaml: Re-enable devel build check by
4-
using Linux instead of macOS to perform the check.
9+
using Linux instead of macOS to perform the check. Disables release
10+
testing on Linux.
511

612
* .github/workflows/upstream-refresh.yaml: Fix NEWS.md entry formatting
713
issues.
14+
15+
2020-08-21 James Balamuta <[email protected]>
16+
17+
* .github/workflows/upstream-refresh.yaml: Add GitHub Action to
18+
automatically retrieve and apply a new upstream release.
819

920
2020-07-24 James Balamuta <[email protected]>
1021

DESCRIPTION

Lines changed: 1 addition & 1 deletion
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.13.0.2
3+
Version: 0.2.14.1.1
44
Authors@R: c(
55
person("James Joseph", "Balamuta", email = "[email protected]",
66
role = c("aut", "cre", "cph"),

NEWS.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
# RcppEnsmallen 0.2.13.0.2
2-
1+
# RcppEnsmallen 0.2.14.1.1
2+
3+
- Upgraded to ensmallen 2.14.1: "No Direction Home" (2020-08-21)
4+
- Fix release script (remove hardcoded information, trim leading
5+
whitespaces introduced by `wc -l` in MacOS)
6+
([#216](https://github.com/mlpack/ensmallen/pull/216), [#220](https://github.com/mlpack/ensmallen/pull/220)).
7+
- Adjust tolerance for AugLagrangian convergence based on element type ([#217](https://github.com/mlpack/ensmallen/pull/217)).
8+
- Add NSGA2 optimizer for multi-objective functions ([#149](https://github.com/mlpack/ensmallen/pull/149)).
9+
- Update automatic website update release script ([#207](https://github.com/mlpack/ensmallen/pull/207)).
10+
- Clarify and fix documentation for constrained optimizers ([#201](https://github.com/mlpack/ensmallen/pull/201)).
11+
- Fix L-BFGS convergence when starting from a minimum ([#201](https://github.com/mlpack/ensmallen/pull/201)).
312
- Switch GitHub Actions to use reference tags to always be up-to-date with
4-
CRAN's check grid (`oldrel`, `release`, `devel`).
13+
CRAN's check grid (`oldrel`, `release`, `devel`). ([#29](https://github.com/coatless/rcppensmallen/pull/29),
14+
[#32](https://github.com/coatless/rcppensmallen/pull/32))
15+
- Added a GitHub Action to automatically create a PR with the new version of
16+
Ensmallen when a new release is detected. ([#30](https://github.com/coatless/rcppensmallen/pull/30), [#33](https://github.com/coatless/rcppensmallen/pull/33))
517

6-
718
# RcppEnsmallen 0.2.13.0.1
819

920
- Upgraded to ensmallen 2.13.0: "Automatically Automated Automation" (2020-07-15)
@@ -177,4 +188,3 @@
177188
- The crux of this package has largely been developed by
178189
Ensmallen development team that consists of Conrad Sanderson, Ryan Curtin,
179190
and the MLPACK developers
180-

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
## Overview
1111

12-
[Ensmallen](http://ensmallen.org/) is a C++ header-only mathematical optimization
13-
library written by developers behind [MLPACK](http://www.mlpack.org/) that
12+
[Ensmallen](https://ensmallen.org/) is a C++ header-only mathematical optimization
13+
library written by developers behind [MLPACK](https://www.mlpack.org/) that
1414
provides a simple set of abstractions for writing an objective function to
1515
optimize. Provided within are various standard and cutting-edge optimizers that
1616
include full-batch gradient descent techniques, small-batch techniques,

inst/include/ensmallen.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,22 @@
3535

3636
#include <cctype>
3737
#include <cfloat>
38+
#include <climits>
3839
#include <cmath>
3940
#include <cstdint>
4041
#include <cstdio>
4142
#include <cstdlib>
4243
#include <cstring>
4344
#include <iostream>
45+
#include <map>
46+
#include <set>
4447
#include <limits>
4548
#include <sstream>
4649
#include <stdexcept>
4750
#include <string>
4851
#include <tuple>
4952
#include <utility>
53+
#include <vector>
5054

5155
// On Visual Studio, disable C4519 (default arguments for function templates)
5256
// since it's by default an error, which doesn't even make any sense because
@@ -94,6 +98,7 @@
9498
#include "ensmallen_bits/katyusha/katyusha.hpp"
9599
#include "ensmallen_bits/lbfgs/lbfgs.hpp"
96100
#include "ensmallen_bits/lookahead/lookahead.hpp"
101+
#include "ensmallen_bits/nsga2/nsga2.hpp"
97102
#include "ensmallen_bits/padam/padam.hpp"
98103
#include "ensmallen_bits/parallel_sgd/parallel_sgd.hpp"
99104
#include "ensmallen_bits/pso/pso.hpp"

inst/include/ensmallen_bits/aug_lagrangian/aug_lagrangian_impl.hpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ inline AugLagrangian::AugLagrangian(const size_t maxIterations,
2727
penaltyThresholdFactor(penaltyThresholdFactor),
2828
sigmaUpdateFactor(sigmaUpdateFactor),
2929
lbfgs(lbfgs),
30-
terminate(false)
30+
terminate(false),
31+
sigma(0.0)
3132
{
3233
}
3334

@@ -107,6 +108,10 @@ AugLagrangian::Optimize(
107108
// Track the last objective to compare for convergence.
108109
ElemType lastObjective = function.Evaluate(coordinates);
109110

111+
// Convergence tolerance---depends on the epsilon of the type we are using for
112+
// optimization.
113+
ElemType tolerance = 1e3 * std::numeric_limits<ElemType>::epsilon();
114+
110115
// Then, calculate the current penalty.
111116
ElemType penalty = 0;
112117
for (size_t i = 0; i < function.NumConstraints(); i++)
@@ -134,6 +139,7 @@ AugLagrangian::Optimize(
134139
if (!lbfgs.Optimize(augfunc, coordinates, callbacks...))
135140
Info << "L-BFGS reported an error during optimization."
136141
<< std::endl;
142+
Info << "Done with L-BFGS: " << coordinates << "\n";
137143

138144
const ElemType objective = function.Evaluate(coordinates);
139145

@@ -142,7 +148,7 @@ AugLagrangian::Optimize(
142148

143149
// Check if we are done with the entire optimization (the threshold we are
144150
// comparing with is arbitrary).
145-
if (std::abs(lastObjective - objective) < 1e-10 &&
151+
if (std::abs(lastObjective - objective) < tolerance &&
146152
augfunc.Sigma() > 500000)
147153
{
148154
lambda = std::move(augfunc.Lambda());
@@ -196,6 +202,13 @@ AugLagrangian::Optimize(
196202
// We multiply sigma by a constant value.
197203
augfunc.Sigma() *= sigmaUpdateFactor;
198204
Info << "Updated sigma to " << augfunc.Sigma() << "." << std::endl;
205+
if (augfunc.Sigma() >= std::numeric_limits<ElemType>::max() / 2.0)
206+
{
207+
Warn << "AugLagrangian::Optimize(): sigma too large for element type; "
208+
<< "terminating." << std::endl;
209+
Callback::EndOptimization(*this, function, coordinates, callbacks...);
210+
return false;
211+
}
199212
}
200213

201214
terminate |= Callback::StepTaken(*this, function, coordinates,

inst/include/ensmallen_bits/ens_version.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
#define ENS_VERSION_MAJOR 2
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.
18-
#define ENS_VERSION_MINOR 13
18+
#define ENS_VERSION_MINOR 14
1919
#define ENS_VERSION_PATCH 0
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".
24-
#define ENS_VERSION_NAME "Automatically Automated Automation"
24+
#define ENS_VERSION_NAME "No Direction Home"
2525

2626
namespace ens {
2727

inst/include/ensmallen_bits/lbfgs/lbfgs_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ L_BFGS::Optimize(FunctionType& function,
391391
//
392392
// But don't do this on the first iteration to ensure we always take at
393393
// least one descent step.
394-
if (itNum > 0 && (arma::norm(gradient, 2) < minGradientNorm))
394+
if (arma::norm(gradient, 2) < minGradientNorm)
395395
{
396396
Info << "L-BFGS gradient norm too small (terminating successfully)."
397397
<< std::endl;

0 commit comments

Comments
 (0)