Maintainer: | Florian Schwendinger, Hans W. Borchers |
Contact: | R-optimization at mailbox.org |
Version: | 2022-12-07 |
URL: | https://CRAN.R-project.org/view=Optimization |
Source: | https://github.com/cran-task-views/Optimization/ |
Contributions: | Suggestions and improvements for this task view are very welcome and can be made through issues or pull requests on GitHub or via e-mail to the maintainer address. For further details see the Contributing guide. |
Citation: | Florian Schwendinger, Hans W. Borchers (2022). CRAN Task View: Optimization and Mathematical Programming. Version 2022-12-07. URL https://CRAN.R-project.org/view=Optimization. |
Installation: | The packages from this task view can be installed automatically using the ctv package. For example, ctv::install.views("Optimization", coreOnly = TRUE) installs all the core packages or ctv::update.views("Optimization") installs all packages that are not yet installed and up-to-date. See the CRAN Task View Initiative for more details. |
This CRAN Task View contains a list of packages which offer facilities for solving optimization problems. Although every regression model in statistics solves an optimization problem, they are not part of this view. If you are looking for regression methods, the following views will also contain useful starting points: MachineLearning, Econometrics, Robust The focus of this task view is on Optimization Infrastructure Packages, General Purpose Continuous Solvers, Mathematical Programming Solvers, Specific Applications in Optimization, or Multi Objective Optimization.
Packages are categorized according to these sections. See also the “Related Links” and “Other Resources” sections at the end.
Many packages provide functionality for more than one of the subjects listed at the end of this task view. E.g., mixed integer linear programming solvers typically offer standard linear programming routines like the simplex algorithm. Therefore following each package description a list of abbreviations describes the typical features of the optimizer (i.e., the problems which can be solved). The full names of the abbreviations given in square brackets can be found at the end of this task view under Classification According to Subject.
If you think that some package is missing from the list, please contact the maintainer via e-mail or submit an issue or pull request in the GitHub repository linked above.
The optimx package provides a replacement and extension of the optim()
function in Base R with a call to several function minimization codes in R in a single statement. These methods handle smooth, possibly box constrained functions of several or many parameters. Function optimr()
in this package extends the optim()
function with the same syntax but more ‘method’ choices. Function opm()
applies several solvers to a selected optimization task and returns a dataframe of results for easy comparison.
The R Optimization Infrastructure (ROI) package provides a framework for handling optimization problems in R. It uses an object-oriented approach to define and solve various optimization tasks from different problem classes (e.g., linear, quadratic, non-linear programming problems). This makes optimization transparent for the user as the corresponding workflow is abstracted from the underlying solver. The approach allows for easy switching between solvers and thus enhances comparability. For more information see the ROI home page .
The package CVXR provides an object-oriented modeling language for Disciplined Convex Programming (DCP). It allows the user to formulate convex optimization problems in a natural way following mathematical convention and DCP rules. The system analyzes the problem, verifies its convexity, converts it into a canonical form, and hands it off to an appropriate solver such as ECOS or SCS to obtain the solution. (CVXR is derived from the MATLAB toolbox CVX, developed at Stanford University, cf. CVXR home page .)
Package stats offers several general purpose optimization routines. For one-dimensional unconstrained function optimization there is optimize()
which searches an interval for a minimum or maximum. Function optim()
provides an implementation of the Broyden-Fletcher-Goldfarb-Shanno (BFGS) method, bounded BFGS, conjugate gradient (CG), Nelder-Mead, and simulated annealing (SANN) optimization methods. It utilizes gradients, if provided, for faster convergence. Typically it is used for unconstrained optimization but includes an option for box-constrained optimization.
Additionally, for minimizing a function subject to linear inequality constraints, stats contains the routine constrOptim()
. Then there is nlm
which is used for solving nonlinear unconstrained minimization problems. nlminb()
offers box-constrained optimization using the PORT routines. [RGA, QN]
Package lbfgs wraps the libBFGS C library by Okazaki and Morales (converted from Nocedal’s L-BFGS-B 3.0 Fortran code), interfacing both the L-BFGS and the OWL-QN algorithm, the latter being particularly suited for higher-dimensional problems.
lbfgsb3c interfaces J.Nocedal’s L-BFGS-B 3.0 Fortran code, a limited memory BFGS minimizer, allowing bound constraints and being applicable to higher-dimensional problems. It has an ‘optim’-like interface based on ‘Rcpp’.
Package roptim provides a unified wrapper to call C++ functions of the algorithms underlying the optim() solver; and optimParallel provides a parallel version of the L-BFGS-B method of optim(); using these packages can significantly reduce the optimization time.
RcppNumerical is a collection of open source libraries for numerical computing and their integration with ‘Rcpp’. It provides a wrapper for the L-BFGS algorithm, based on the LBFGS++ library (based on code of N. Okazaki).
Package ucminf implements an algorithm of quasi-Newton type for nonlinear unconstrained optimization, combining a trust region with line search approaches. The interface of ucminf()
is designed for easy interchange with optim()
.[QN]
The following packages implement optimization routines in pure R, for nonlinear functions with bounds constraints: Rcgmin: gradient function minimization similar to GC; Rvmmin: variable metric function minimization; Rtnmin: truncated Newton function minimization.
mize implements optimization algorithms in pure R, including conjugate gradient (CG), Broyden-Fletcher-Goldfarb-Shanno (BFGS) and limited memory BFGS (L-BFGS) methods. Most internal parameters can be set through the calling interface.
n1qn1 provides an R port of the n1qn1
optimization procedure ported from Scilab, a quasi-Newton BFGS method without constraints.
stochQN provides implementations of stochastic, limited-memory quasi-Newton optimizers, similar in spirit to the LBFGS. It includes an implementation of online LBFGS, stochastic quasi-Newton and adaptive quasi-Newton.
nonneg.cg realizes a conjugate-gradient based method to minimize functions subject to all variables being non-negative.
Package dfoptim, for derivative-free optimization procedures, contains quite efficient R implementations of the Nelder-Mead and Hooke-Jeeves algorithms (unconstrained and with bounds constraints). [DF]
Package nloptr provides access to NLopt, an LGPL licensed library of various nonlinear optimization algorithms. It includes local derivative-free (COBYLA, Nelder-Mead, Subplex) and gradient-based (e.g., BFGS) methods, and also the augmented Lagrangian approach for nonlinear constraints. [DF, GO, QN]
Package alabama provides an implementations of the Augmented Lagrange Barrier minimization algorithm for optimizing smooth nonlinear objective functions with (nonlinear) equality and inequality constraints.
Package Rsolnp provides an implementation of the Augmented Lagrange Multiplier method for solving nonlinear optimization problems with equality and inequality constraints (based on code by Y. Ye).
NlcOptim solves nonlinear optimization problems with linear and nonlinear equality and inequality constraints, implementing a Sequential Quadratic Programming (SQP) method; accepts the input parameters as a constrained matrix.
In package Rdonlp2 (see the rmetrics project) function donlp2()
, a wrapper for the DONLP2 solver, offers the minimization of smooth nonlinear functions and constraints. DONLP2 can be used freely for any kind of research purposes, otherwise it requires licensing. [GO, NLP]
psqn provides quasi-Newton methods to minimize partially separable functions; the methods are largely described in “Numerical Optimization” by Nocedal and Wright (2006).
clue contains the function sumt()
for solving constrained optimization problems via the sequential unconstrained minimization technique (SUMT).
BB contains the function spg()
providing a spectral projected gradient method for large scale optimization with simple constraints. It takes a nonlinear objective function as an argument as well as basic constraints.
Package SCOR solves optimization problems under the constraint that the combined parameters lie on the surface of a unit hypersphere.
GrassmannOptim is a package for Grassmann manifold optimization. The implementation uses gradient-based algorithms and embeds a stochastic gradient method for global search.
ManifoldOptim is an R interface to the ‘ROPTLIB’ optimization library. It optimizes real-valued functions over manifolds such as Stiefel, Grassmann, and Symmetric Positive Definite matrices.
Package gsl provides BFGS, conjugate gradient, steepest descent, and Nelder-Mead algorithms. It uses a “line search” approach via the function multimin()
. It is based on the GNU Scientific Library (GSL). [RGA, QN]
An R port of the Scilab neldermead module is packaged in neldermead offering several direct search algorithms based on the simplex approach.
optimsimplex provides building blocks for simplex-based optimization algorithms such as the Nelder-Mead, Spendley, Box method, or multi-dimensional search by Torczon, etc.
Several derivative-free optimization algorithms are provided with package minqa; e.g., the functions bobyqa()
, newuoa()
, and uobyqa()
allow to minimize a function of many variables by a trust region method that forms quadratic models by interpolation. bobyqa()
additionally permits box constraints (bounds) on the parameters. [DF]
subplex provides unconstrained function optimization based on a subspace searching simplex method.
In package trust, a routine with the same name offers local optimization based on the “trust region” approach.
trustOptim implements “trust region” for unconstrained nonlinear optimization. The algorithm is optimized for objective functions with sparse Hessians.
Package quantreg contains variations of simplex and of interior point routines ( nlrq()
, crq()
). It provides an interface to L1 regression in the R code of function rq()
. [SPLP, LP, IPM]
marqLevAlg implements a parallelized version of the Marquardt-Levenberg algorithm. It is particularly suited
for complex problems and when starting from points very far from the final optimum. The package is designed to be used for unconstrained local optimization. [NLP]
solve.QP()
solves quadratic programming problems with linear equality and inequality constraints. (The matrix has to be positive definite.) quadprogXT extends this with absolute value constraints and absolute values in the objective function. [QP]ipop
for solving quadratic programming problems using interior point methods. (The matrix can be positive semidefinite.) [IPM, QP]Function solve.qr()
(resp. qr.solve()
) handles over- and under-determined systems of linear equations, returning least-squares solutions if possible. And package stats provides nls()
to determine least-squares estimates of the parameters of a nonlinear model. nls2 enhances function nls()
with brute force or grid-based searches, to avoid being dependent on starting parameters or getting stuck in local solutions.
nlfb
and nlxb
are intended to eventually supersede the ‘nls()’ function in Base R, by applying a variant of the Marquardt procedure for nonlinear least-squares, with bounds constraints and optionally Jacobians described as R functions.nls.lm()
for solving nonlinear least-squares problems by a modification of the Levenberg-Marquardt algorithm, with support for lower and upper parameter bounds, as found in MINPACK.lm()
.DEoptim()
function.gafit()
uses a genetic algorithm approach to find the minimum of a one-dimensional function.rbga()
, an implementation of a genetic algorithm for multi-dimensional function optimization.genoud()
, a routine which is capable of solving complex function minimization/maximization problems by combining evolutionary algorithms with a derivative-based (quasi-Newtonian) approach.ppso
available from rforge.net/ppso .SCEoptim
function for Shuffled Compex Evolution (SCE) optimization, an evolutionary algorithm, combined with a simplex method.cmaes
, in adagio as pureCMAES
, and in rCMA as cmaOptimDP
, interfacing Hansen’s own Java implementation.This section provides an overview of open source as well as commercial optimizers. Which type of mathematical programming problem can be solved by a certain package or function can be seen from the abbreviations in square brackets. For a Classification According to Subject see the list at the end of this task view.
solveLP()
(the solver is based on lpSolve) and can read model files in MPS format. [LP]simplex()
which realizes the two-phase tableau simplex method for (relatively small) linear programming problems. [LP]lpcdd()
for solving linear programs with exact arithmetic using the GNU Multiple Precision (GMP) library. [LP]lp()
to solve LPs and MILPs by calling the freely available solver lp_solve . This solver is based on the revised simplex method and a branch-and-bound (B&B) approach. It supports semi-continuous variables and Special Ordered Sets (SOS). Furthermore lp.assign()
and lp.transport()
are aimed at solving assignment problems and transportation problems, respectively. Additionally, there is the package lpSolveAPI which provides an R interface to the low level API routines of lp_solve (see also project lpsolve on R-Forge). lpSolveAPI supports reading linear programs from files in lp and MPS format. [BP, IP, LP, MILP, SPLP]Rglpk_solve_LP()
to solve MILPs using GLPK. Both packages offer the possibility to use models formulated in the MPS format. [BP, IP, IPM, LP, MILP]Rsymphony_solve_LP()
that interfaces the SYMPHONY solver for mixed-integer linear programs. (SYMPHONY is part of the Computational Infrastructure for Operations Research (COIN-OR) project.) Package lpsymphony
in Bioconductor provides a similar interface to SYMPHONY that is easier to install. [LP, IP, MILP]snomadr()
function and is primarily designed for constrained optimization of blackbox functions. [MILP]This section surveys interfaces to commercial solvers. Typically, the corresponding libraries have to be installed separately.
Some more commercial companies, e.g. ‘Artelys Knitro’ or ‘FICO Xpress Optimization’, have R interfaces that are installed while the software gets installed. Trial licenses are available, see the corresponding websites for more information.
solve_LSAP()
enables the user to solve the linear sum assignment problem (LSAP) using an efficient C implementation of the Hungarian algorithm. [SPLP]solve_TSP()
solves the TSP through several heuristics. In addition, it provides an interface to the Concorde TSP Solver , which has to be downloaded separately. [SPLP]caRamel
in package caRamel is a multi-objective optimizer, applying a combination of the multi-objective evolutionary annealing-simplex (MEAS) method and the non-dominated sorting genetic algorithm (NGSA-II); it was initially developed for the calibration of hydrological models.lab.optimize()
which is the front-end to a series of heuristic routines for optimizing some bivariate graph statistic. [GRAPH]What follows is an attempt to provide a by-subject overview of packages. The full name of the subject as well as the corresponding MSC 2010 code (if available) are given in brackets.
optim()
), gsloptim()
), gsl, lbfgs, lbfgsb3c, nloptr, optimParallel, ucminf, n1qn1