Skip to content

Commit

Permalink
Some url fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Nov 28, 2023
1 parent ca2b8e3 commit 751f717
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 49 deletions.
42 changes: 21 additions & 21 deletions vignettes/lbfgsb3c.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ the updated code using a `.Fortran` call after removing a very large number
of Fortran output statements. Matthew Fidler used this Fortran code and
an `Rcpp` interface to produce package `lbfgsb3c` where the function
`lbfgsb3c()` returns an object similar to that of base-R `optim()` and
that of `optimx::optimr()`. Subsequently, in a fine example of the
collaborations that have made **R** so useful, we have merged the
that of `optimx::optimr()`. Subsequently, in a fine example of the
collaborations that have made **R** so useful, we have merged the
functionality of package `lbfgsb3` into `lbfgsb3c`, as explained
in this vignette. Note that this document is intended primarily to
document our efforts to check the differences in variants of the
in this vignette. Note that this document is intended primarily to
document our efforts to check the differences in variants of the
code rather than be expository.


Expand Down Expand Up @@ -63,39 +63,39 @@ LiuN89. The definitive Fortran code was published as @Zhu1997LBFGS. This
is available as `toms/778.zip` on www.netlib.org. A side-by-side comparison of the
main subroutines in the two downloads from Netlib unfortunately shows a lot of
differences. I have not tried to determine if these affect performance or are
simply cosmetic.
simply cosmetic.

More seriously perhaps, there were some deficiencies in the code(s), and in 2011
More seriously perhaps, there were some deficiencies in the code(s), and in 2011
Nocedal's team published a Fortran code with some corrections (@Morales2011).
Since the **R** code predates this, I prepared package `lbfgsb3` (@lbfgsb3JN) to wrap
the Fortran code. However, I did not discover any test cases where the
`optim::L-BFGS-B` and `lbfgsb3` were different, though I confess to only
running some limited tests. There are, in fact, more in this vignette.

In 2016, I was at a Fields Institute optimization conference in Toronto
for the 70th birthday of Andy Conn. By sheer serendipity, Nocedal did not attend
for the 70th birthday of Andy Conn. By sheer serendipity, Nocedal did not attend
the conference, but
sat down next to me at the conference dinner. When I asked him about the key changes,
he said that the most important one was to fix the computation of the machine
precision, which was not always correct in the 1995 code. Since **R** gets this
number as `.Machine$double.eps`, the offending code is irrelevant.
he said that the most important one was to fix the computation of the machine
precision, which was not always correct in the 1995 code. Since **R** gets this
number as `.Machine$double.eps`, the offending code is irrelevant.

Within @Morales2011, there is also reported an improvement in the subspace
minimization that is applied in cases of bounds constraints. Since few of the
tests I have applied impose such constraints, it is reasonable that I will
tests I have applied impose such constraints, it is reasonable that I will
not have observed performance differences between the base-R `optim` code
and my `lbfsgb3` package. More appropriate tests are welcome, and on my agenda.

Besides the ACM TOMS code, there are two related codes from the Northwestern team on NETLIB:
http://netlib.org/opt/lbfgs_um.shar
is for unconstrained minimization, while http://netlib.org/opt/lbfgs_bcm.shar handles bounds
https://netlib.org/opt/lbfgs_um.shar
is for unconstrained minimization, while https://netlib.org/opt/lbfgs_bcm.shar handles bounds
constrained problems. To these are attached references @LiuN89 and @Byrd1995 respectively,
most likely reflecting the effort required to implement the constraints.

The unconstrained code has been converted to **C** under the leadership of
Naoaki Okazaki (see http://www.chokkan.org/software/liblbfgs/, or the fork at https://github.com/MIRTK/LBFGS).
The unconstrained code has been converted to **C** under the leadership of
Naoaki Okazaki (see http://www.chokkan.org/software/liblbfgs/, or the fork at https://github.com/MIRTK/LBFGS).
This has been wrapped for **R** as @Coppola2014 as the
`lbfgs` package. This can be called from `optimx::optimr()`.
`lbfgs` package. This can be called from `optimx::optimr()`.

Using Rcpp (see @RCppDERF2011) and the Fortran code in package
`lbfgs3`, Matthew Fidler developed package `lbfgsb3c`
Expand All @@ -108,12 +108,12 @@ both under the same name `lbfgsb3c`.
There is really only one optimizer function in the package, but it may be called
by four (4) names:

- `lbfgsb3c()` uses Rcpp (@RCppDE2013, @RCppDERF2011, @RCppDEJJB2017) to streamline the call
- `lbfgsb3c()` uses Rcpp (@RCppDE2013, @RCppDERF2011, @RCppDEJJB2017) to streamline the call
to the underlying Fortran. This is the base function used.
- `lbfgsb3x()` is an alias of `lbfgsb3c()`. We were using this name for a while, and
have kept the alias to avoid having to edit test scripts.
- `lbfgsb3`, which imitates a `.Fortran` call of the compiled 2011 Fortran code. The
object returned by this routine is NOT equivalent to the object returned by
- `lbfgsb3`, which imitates a `.Fortran` call of the compiled 2011 Fortran code. The
object returned by this routine is NOT equivalent to the object returned by
base-R `optim()` or by `optimx::optimr()`. Instead, it includes a structure `info`
which contains the detailed diagnostic information of the Fortran code. For most
users, this is not of interest, and I only recommend use of this function for those
Expand Down Expand Up @@ -253,7 +253,7 @@ extensions to interface compiled code with this function, see
it is sometimes more convenient to use your own compiled code.

The following example shows how this is done using the file `jrosen.f`. We have unfortunately
found that compilation is not always portable across systems, so this example is
found that compilation is not always portable across systems, so this example is
presented without execution.

```
Expand All @@ -271,7 +271,7 @@ presented without execution.
end
```

Here is the example script. Note that we must have the file `jrosen.f` available.
Here is the example script. Note that we must have the file `jrosen.f` available.
Because the executable files on different systems use different conventions and
structures, we have turned evaluation off here so this vignette can be built
on multiple platforms. However, we wished to provide examples of how compiled code
Expand Down
55 changes: 27 additions & 28 deletions vignettes/lbfgsb3c.bib
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ @article{Byrd1995
acmid = {210980},
publisher = {Society for Industrial and Applied Mathematics},
address = {Philadelphia, PA, USA}
}
}

@article{Nocedal80,
title = "Updating Quasi-Newton Matrices with Limited Storage",
Expand All @@ -125,7 +125,7 @@ @article{Nocedal80
}

@article{LiuN89,
author = {Dong C. Liu and
author = {Dong C. Liu and
Jorge Nocedal},
title = {On the limited memory {BFGS} method for large scale optimization},
journal = {Math. Program.},
Expand Down Expand Up @@ -159,8 +159,8 @@ @article{Sorenson1969
doi = {10.1016/0016-0032(69)90253-1}
}

@incollection{Beale1972,
author = {Beale, E. M. L.},
@incollection{Beale1972,
author = {Beale, E. M. L.},
title = {A Derivation of Conjugate Gradients},
booktitle = {Numerical Methods for Nonlinear Optimization},
editor = {F. A. Lootsma},
Expand All @@ -181,12 +181,12 @@ @article{Gorn1960
year = {1960},
issn = {0001-0782},
pages = {174--},
url = {http://doi.acm.org/10.1145/367149.367173},
url = {https://doi.acm.org/10.1145/367149.367173},
doi = {10.1145/367149.367173},
acmid = {367173},
publisher = {ACM},
address = {New York, NY, USA},
}
}

@article{Rader1961,
author = {Rader, Patty Jane},
Expand All @@ -199,12 +199,12 @@ @article{Rader1961
year = {1961},
issn = {0001-0782},
pages = {153--},
url = {http://doi.acm.org/10.1145/366199.366275},
url = {https://doi.acm.org/10.1145/366199.366275},
doi = {10.1145/366199.366275},
acmid = {366275},
publisher = {ACM},
address = {New York, NY, USA},
}
}


@article{Muller56,
Expand Down Expand Up @@ -838,7 +838,7 @@ @Article{Domini02
}

@Article{Dominici2002,
Title = {On the Use of Generalized Additive Models in Time-Series
Title = {On the Use of Generalized Additive Models in Time-Series
Studies of Air Pollution and Health.},
Author = {F. Dominici},
Journal = {American Journal of Epidemiology},
Expand Down Expand Up @@ -875,7 +875,7 @@ @Article{Dugg84
}

@Article{Duggleby1984,
Title = {Regression Analysis of Nonlinear {Arrhenius} Plots: An Empirical Model and
Title = {Regression Analysis of Nonlinear {Arrhenius} Plots: An Empirical Model and
a Computer Program.},
Author = {Duggleby, R G},
Journal = {Computers in Biology and Medicine},
Expand Down Expand Up @@ -1095,7 +1095,7 @@ @Book{Gentle:1998
}

@Article{Bioc04,
Title = {Bioconductor: Open Software Development for Computational Biology and
Title = {Bioconductor: Open Software Development for Computational Biology and
Bioinformatics},
Author = {Robert C Gentleman and Vincent J. Carey and Douglas M. Bates and {others}},
Journal = {Genome Biology},
Expand Down Expand Up @@ -1290,7 +1290,7 @@ @Article{Hager2006b
}

@Article{Hager2005,
Title = {A new conjugate gradient method with
Title = {A new conjugate gradient method with
guaranteed descent and an efficient line search},
Author = {William W. Hager and Hongchao Zhang},
Journal = {SIAM J. Optim.},
Expand Down Expand Up @@ -1434,7 +1434,7 @@ @Article{Hooke61
Volume = {8},

Bibsource = {DBLP, http://dblp.uni-trier.de},
Ee = {http://doi.acm.org/10.1145/321062.321069}
Ee = {https://doi.acm.org/10.1145/321062.321069}
}

@Manual{p-ROI,
Expand Down Expand Up @@ -1535,7 +1535,7 @@ @Article{Joh03
}

@Article{Johannesen2003,
Title = {Mineralization of Aged Atrazine, Terbuthylazine, 2,4-D, and Mecoprop
Title = {Mineralization of Aged Atrazine, Terbuthylazine, 2,4-D, and Mecoprop
in Soil and Aquifer Sediment},
Author = {H. Johannesen and J. Aamand},
Journal = {Environmental Toxicology and Chemistry},
Expand Down Expand Up @@ -2029,7 +2029,7 @@ @Article{Morales2011
Issue_date = {November 2011},
Numpages = {4},
Publisher = {ACM},
Url = {http://doi.acm.org/10.1145/2049662.2049669}
Url = {https://doi.acm.org/10.1145/2049662.2049669}
}

@Article{More92linesearch,
Expand Down Expand Up @@ -2258,7 +2258,7 @@ @Article{nashderive95
}

@Book{cnm79,
Title = {Compact Numerical Methods for Computers: Linear Algebra and Function
Title = {Compact Numerical Methods for Computers: Linear Algebra and Function
Minimisation},
Author = {John C. Nash},
Publisher = {Adam Hilger},
Expand Down Expand Up @@ -2292,13 +2292,13 @@ @Book{Nash1979b
@InProceedings{jnkp79tsl,
Title = {Fitting two straight lines},
Author = {Nash, John C. and Kevin Price},
Booktitle = {Proceedings of Computer Science and Statistics:
12th annual Symposium on the Interface : May 10 \& 11, 1979, University of Waterloo,
Booktitle = {Proceedings of Computer Science and Statistics:
12th annual Symposium on the Interface : May 10 \& 11, 1979, University of Waterloo,
Waterloo, Ontario, Canada,
Jane Gentleman (ed.)},
Year = {1979},
Month = {May},
Note = {JNFile: 78Fitting2StraightLines.pdf. Page numbers may be in error.
Note = {JNFile: 78Fitting2StraightLines.pdf. Page numbers may be in error.
Also Engineering and Statistical Research Institute, Agriculture
Canada, Contribution No. I-99, 1978},
Pages = { 363--367 },
Expand Down Expand Up @@ -2752,7 +2752,7 @@ @Article{Schnabel1985
Owner = {john},
Publisher = {ACM},
Timestamp = {2018.11.16},
Url = {http://doi.acm.org/10.1145/6187.6192}
Url = {https://doi.acm.org/10.1145/6187.6192}
}

@Article{Schnabel85,
Expand Down Expand Up @@ -2940,7 +2940,7 @@ @Article{Thacher1960
Owner = {john},
Publisher = {ACM},
Timestamp = {2018.08.29},
Url = {http://doi.acm.org/10.1145/367368.367385}
Url = {https://doi.acm.org/10.1145/367368.367385}
}

@Manual{p-Rglpk,
Expand Down Expand Up @@ -3007,7 +3007,7 @@ @Manual{p-dfoptim
Title = {dfoptim: Derivative-free Optimization},
Author = {Ravi Varadhan and Hans W. Borchers},
Note = {R package version 2011.12-9},
Organization = {Johns Hopkins University and
Organization = {Johns Hopkins University and
ABB Corporate Research.},
Year = {2011},

Expand All @@ -3030,7 +3030,7 @@ @Article{p-BB
}

@Article{Vara09,
Title = {{BB}: An {\R} Package for Solving a Large System of
Title = {{BB}: An {\R} Package for Solving a Large System of
Nonlinear Equations and for Optimizing a High-Dimensional Nonlinear Objective Function},
Author = {Ravi Varadhan and Paul Gilbert},
Journal = {Journal of Statistical Software},
Expand All @@ -3043,8 +3043,8 @@ @Article{Vara09
}

@Article{Varadhan2009,
Title = {{\pkg{BB}}: An {\R} Package for Solving a Large System of
Nonlinear Equations and for Optimizing a High-Dimensional
Title = {{\pkg{BB}}: An {\R} Package for Solving a Large System of
Nonlinear Equations and for Optimizing a High-Dimensional
Nonlinear Objective Function},
Author = {Ravi Varadhan and Paul Gilbert},
Journal = {Journal of Statistical Software},
Expand Down Expand Up @@ -3120,7 +3120,7 @@ @Article{Wegstein1960
Owner = {john},
Publisher = {ACM},
Timestamp = {2018.08.29},
Url = {http://doi.acm.org/10.1145/367297.367337}
Url = {https://doi.acm.org/10.1145/367297.367337}
}

@Article{Wenzel99,
Expand Down Expand Up @@ -3294,7 +3294,7 @@ @Article{Zhu1997LBFGS
Keywords = {large-scale optimization, limited-memory method, nonlinear optimization, variable metric method},
Numpages = {11},
Publisher = {ACM},
Url = {http://doi.acm.org/10.1145/279232.279236}
Url = {https://doi.acm.org/10.1145/279232.279236}
}

@Book{Rauch83,
Expand All @@ -3307,4 +3307,3 @@ @Book{Rauch83

Booktitle = {Applications of Nonlinear Programming to Optimization and Control}
}

0 comments on commit 751f717

Please sign in to comment.