I am looking for an optimization routine that can optimize a non-linear objective function with integer constraints. NuOPT for S-Plus, CPLEX, or Matlab include powerful optimization packages for these kinds of optimizations?

Is there any similar kind of package for R? Or is there an optimization procedure (perhaps genetic algorithms) that can solve this problem?

For what it's worth I'm performing a portfolio mean-variance optimization.

  • 5
    $\begingroup$ Interesting question. Did (or do) you see anything relevant under the Optimisation CRAN Task View cran.r-project.org/web/views/Optimization.html $\endgroup$ Commented Jul 14, 2011 at 5:54
  • $\begingroup$ @user603, in a deleted reply, has pointed out that this is likely a quadratic program (because that is what CPLEX does and, I would like to add, portfolio mean-variance optimization is usually formulated as a quadratic program). Usually one is much better off using optimizers written specifically for quadratic programs rather than with general-purpose nonlinear optimizers. That can help limit the search for packages. $\endgroup$
    – whuber
    Commented Jul 14, 2011 at 14:19

2 Answers 2


The most recent issue of The R Journal contains Differential Evolution with DEoptim, which illustrates how to use DEoptim for portfolio optimization.


If you are willing to pay for it, there is an interface between R and NAG NAGFWrappers

That includes all sort of optimization algorithms, if you know NAG, all chapter E04 is in there.

Obviously you could interface R with NAG writing some C++ code before the package was available, but now it's easier.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.