[R] The best solver for non-smooth functions?
Cren
oscar.soppelsa at bancaakros.it
Thu Jul 19 10:19:27 CEST 2012
Hans W Borchers wrote
>
> The most robust solver for non-smooth functions I know of in R is
> Nelder-Mead
> in the 'dfoptim' package (that also allows for box constraints).
>
> First throw out the equality constraint by using c(w1, w1, 1-w1-w2) as
> input.
> This will enlarge the domain a bit, but comes out allright in the end.
>
> sharpe2 <- function(w) {
> w <- c(w[1], w[2], 1-w[1]-w[2])
> - (t(w) %*% y) / cm.CVaR(M, lgd, w, N, n, r, rho, alpha, rating)
> }
>
> nmkb(c(1/3,1/3), sharpe2, lower=c(0,0), upper=c(1,1))
> ## $par
> ## [1] 0.1425304 0.1425646
> ## $value
> ## [1] -0.03093439
>
> This is still in the domain of definition, and is about the same optimum
> that
> solnp() finds.
>
> There are some more solvers, especially aimed at non-smooth functions, in
> the
> making. For low-dimensional problems like this Nelder-Mead is a reasonable
> choice.
# Thank you, I'll try it :)
--
View this message in context: http://r.789695.n4.nabble.com/The-best-solver-for-non-smooth-functions-tp4636934p4637000.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list