Description Usage Arguments Details Value Author(s) References See Also Examples
Solve constrained nonlinear minimization problem.
1 2 3 4 5 6 7 8 |
par |
parameter vector(vector object). |
fun |
the objective function to be minimized. Currently, |
par.lower, par.upper |
upper and lower bounds for parameter vector,
respectively. Their length must equal to
|
eqA, ineqA |
the matrix objects that represents linear constraints. Its
columns must be equal to |
eqA.bound |
equality bounds for linear constraints, respectively. Their length must equal to the number of linear constraints. |
ineqA.lower, ineqA.upper |
upper and lower bounds for linear constraints, respectively. Their length must equal to the number of linear constraints. |
eqFun |
list object whose elements are functions that represents nonlinear equality constraints. |
eqFun.bound |
equality bounds for nonlinear constraints, respectively. |
ineqFun |
list object whose elements are functions that represents nonlinear lower and upper constraints. |
ineqFun.lower, ineqFun.upper |
lower and upper bounds for nonlinear constraints, respectively. |
control |
list of control parameters that define the behaviour of the
solver. See |
An alternative interface which may be suited better for portfolio
optimization compared with the default interface function
solnp2
.
A list with following elements:
opt |
a list of information on the optimal solution as returned by
the function |
par |
a numeric vector, the optimal solution. |
objective |
a numeric value, the value at the optimal solution |
convergence |
an integer code. 0 indicates successful convergence. |
message |
a character string giving any additional information returned by the optimizer, or NULL. For details, see PORT documentation. |
The R port of dnonlp2
was written by Ryuichi Tamura,
the R/Rmetrics interface solnp2NLP
was written by Diethem Wuertz,
the underlying C code called by the R function solnp2
was
written by Peter Sperucci.
The PORT documentation is at http://netlib.bell-labs.com/cm/cs/cstr/153.pdf.
nlminb
, nlminb2
, nlminb2Control
,
and packages Rdonlp2
and Rsolnp2
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Example:
# Feasible Start Solution:
start = c(10, 10)
# Objective Function: x^2 + y^2
fun <- function(x) sum(x^2)
# Bounds: -100 <= x,y <= 100
par.lower = c(-100, -100)
par.upper = c(100, 100)
# Equality Constraints: x*y = 2
eqFun <- list(
function(x) x[1]*x[2])
eqFun.bound = 2
# Solution: x = c(sqrt(2), sqrt(2)), f(x) = 4
solnp2NLP(par = start, fun = fun,
par.lower = par.lower, par.upper = par.upper,
eqFun = eqFun, eqFun.bound = eqFun.bound)[-1]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.