An R package that performs black-box global minimization of a general function subject to finite bounds on the unknown parameters using a variant of the OSCARS-II algorithm (https://doi.org/10.1007/s10898-020-00928-6). A parallel version of OSCARS and a version incorporating intermittent quasi-Newton steps are also included (https://doi.org/10.1007/s43069-024-00403-y).
Oscars performs black-box minimization (or maximization) of a general function subject to bounds on the unknown parameters. If all bounds are finite, oscars acts as a global optimization algorithm. It has been adapted to handle infinite upper and lower bounds, in which case the method has the characteristics of a local method for non smooth problems. Oscars does not use or assume the existence of derivatives of the objective function. It is a low overhead method for cheaply evaluated black-box functions.
Oscars is a stochastic direct search method which uses only function values at selected points. It generates a finite sequence of nested boxes around a control point, and randomly samples each box once, in turn. A new set of nested boxes is formed if the current set is exhausted or a point better than the control point is found. In the latter case the better point replaces the control. The name 'Oscars' is a contraction of One Side Cut Accelerated Random Search, where the "one side cut" refers to how the nested boxes are generated. The original accelerated random search method of Radulovic et al. used a different strategy to generate the nested boxes.
Initially the control point is set to the better of an internal initial point and a user supplied start point (if given). From time to time the control is reset alternately to a random point, or to the best known point. Each reset marks the end of one cycle and the start of the next. All even numbered cycles start with control points chosen randomly from the feasible region. All odd numbered cycles (other than the first) set the control point equal to the best known point.
Oscars either performs a fixed number of function evaluations, or it halts if progress stalls for a significant period of time. In both cases it returns the best known point and the function evaluated at that point.
A parallel version is also included in the package along with a version which uses analytic (if provided) or finite difference gradients to implement quasi-Newton steps.
To use oscars, an objective function is required. This
regular R function
must take a vector of parameter values as its first argument, and return a scalar.
Additional arguments, beyond the parameters, can be included in the function
definition.
The function may return missing (NaN and NA) values. Once the objective function
is defined, supply its name to oscars along with the number of
parameters, parameter bounds and
any other (fixed) parameters that are needed to complete objective function
calculations.
The following is one of the examples in the oscars documentation. This
example minimizes Branin's camel function, which has a global minimum
of f = -1.0316 at
(-0.0898,0.7127) and (0.0898,-0.7127) with four other local minimums. Here n = 2 is the
number of parameters over which the function is minimized, and lwr and upr are
the vectors of bounds defining the search region.
# the camel objective function
camel <- function(par) {
x = par[1]
y = par[2]
f = 4*x^2 - 2.1*x^4 + (1/3)*x^6 + x*y + 4*(y^4-y^2)
return(f) }
# Minimize in box (-5,5)
out <- oscars(camel, n = 2, lwr = c(-5,-5), upr = c(5,5))
Result is
> out
Minimum value found at -0.0898420652018077, 0.712656434215101
> summary(out)
Minimum value -1.03162845348986 achieved in 1332 evaluations at
-0.0898420652018077, 0.712656434215101
Evaluations stopped because Optimum function value tolerance reached.

The camel function near (0,0). Note the two global and four local minimums.
OSCARS searched the larger box (-5,5) X (-5,5) and found one of the two
global minimums. This figure was produced by script
tools/make-camel-figure.R.
Once R is installed, install the current stable release or the development release with the following commands:
install.packages("OSCARS")
oscarsGlobal is under active development.
The development version often contains patches between
official releases. Inspect commit messages for commits following the
most recent release for a description of the patches. Install the
development version from
GitHub using:if( !require("devtools") ){
install.packages("devtools")
}
# devtools::install_github("OscarsGlobal/OSCARS")
install.packages("OSCARS", repos = c('https://oscarsglobal.r-universe.dev', 'https://cloud.r-project.org'))
Keep the following in mind: Black-box optimization methods for arbitrary functions do not and cannot provide certificates of optimality if halted after a finite amount of time. In other words, it is theoretically impossible for any routine, including OSCARS, to be absolutely sure a global optimum has been found.