Description Usage Arguments Details Value Control Note Author(s) References Examples
Solve constrained nonlinear minimization problem with nonlinear constraints.
1 2 3 |
par |
a numeric vector, parameter vector(vector object). |
fun |
the objective function to be minimized. |
grad |
a function, tue gradient of |
eqfun |
the equality constraint function returning the vector of evaluated equality constraints. |
eqB |
the equality constraints. |
eqgrad |
the equality constraints gradient function, not currently implemented. |
ineqfun |
the inequality constraint function returning the vector of evaluated inequality constraints. |
ineqLB, ineqUB |
the lower and upper bounds of the inequality constraints. |
ineqgrad |
the inequality constraints grdient function, not currently implemented. |
LB, UB |
the lower and upper bounds of the inequality constraints. |
control |
list of control parameters that define the behaviour of the
solver. See |
... |
optional arguments. |
The solnp function is based on the solver by Yinyu Ye which solves
the general nonlinear programming problem:
minimize f(x)
subject to g(x) = 0
l_h ≤ h(x) ≤ u_h
l_x ≤ x ≤ u_x
where, f(x), g(x) and g(x) are smooth functions.
The solver belongs to the class of indirect solvers and implements the augmented Lagrange multiplier method with an SQP interior algorithm.
A list containing the following values:
pars |
Optimal Parameters. |
convergence |
Indicates whether the solver has converged (0) or not (1). |
values |
Vector of function values during optimization with last one the value at the optimal. |
lagrange |
The vector of Lagrange multipliers. |
hessian |
The Hessian at the optimal solution. |
ineqx0 |
The estimated optimal inequality vector of slack variables used for transforming the inequality into an equality constraint. |
nfuneval |
The number of function evaluations. |
elapsed |
Time taken to compute solution. |
Penalty parameter (default 1).
Maximum number of major (outer) iterations (default 400).
Maximum number of minor (inner) iterations (default 800).
Relative step size in forward difference evaluation (default 1.0e-8).
Tolerance on feasibility and optimality (default 1e-6).
The value of the objective function and the parameters is printed at every major iteration (default 0).
The control parameters tol
and delta
are key in getting
any possibility of successful convergence, therefore it is suggested
that the user change these appropriately to reflect their problem
specification.
The solver is a local solver, therefore for problems with rough surfaces and many local minima there is absolutely no reason to expect anything other than a local solution.
Alexios Ghalanos and Stefan Theussl
Y.Ye (original matlab version of solnp)
Y.Ye,Interior algorithms for linear, quadratic, and linearly constrained non linear programming, PhD Thesis, Department of EES Stanford University, Stanford CA.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Powell Problem -
# From the original paper by Y.Ye
# see the unit tests for more....
fn1 = function(x) {
exp(x[1]*x[2]*x[3]*x[4]*x[5]) }
## Equality Constraints -
eqn1 <- function(x){
z1 = x[1]*x[1]+x[2]*x[2]+x[3]*x[3]+x[4]*x[4]+x[5]*x[5]
z2 = x[2]*x[3]-5*x[4]*x[5]
z3 = x[1]*x[1]*x[1]+x[2]*x[2]*x[2]
return(c(z1,z2,z3)) }
## Start Values -
x0 = c(-2, 2, 2, -1, -1)
## Solve -
powell = solnp2(x0, fun = fn1, eqfun = eqn1, eqB = c(10, 0, -1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.