开发者

Parallel optimization in R

This question came at the right time, as I'm struggling with optimization as well. I am aware of the different "normal" optimization routines in R, and I am aware of parallel packages like snow, snowfall, Rmpi and the likes. Yet, I didn't manage to get an optimization running in parallel on my computer.

Some toy code to illustrate :

f <- function(x) sum((x-1:length(x))^2)
a <- 1:5
optim(a,f)
nlm(f,a)

What I want to do, is to parallel开发者_如何学Cize the optim() function ( or the nlm() function, which does basically the same). My real function f() is a lot more complicated, and one optimization round lasts about half an hour. If I want to run a simulation of 100 samples, that one takes ages. I'd like to avoid writing my own Newton-like algorithm for parallel computing, so I hope somebody could give me some hints on how to use parallel computing for complex optimization problems in R.


I reckon this problem is of a different nature than the one in the related question. My request is specifically directed towards parallel computing, not some faster alternative for optim.


The R package optimParallel could be helpful in your case. The package provides parallel versions of the gradient-based optimization methods of optim(). The main function of the package is optimParallel(), which has the same usage and output as optim(). Using optimParallel() can significantly reduce optimization times as illustrated in the following figure (p is the number of paramters).

Parallel optimization in R

See https://cran.r-project.org/package=optimParallel and http://arxiv.org/abs/1804.11058 for more information.


To answer my own question :

There is a package in development that looks promising. It has Particle Swarm Optimization methods and builds on the Rmpi package for parallel computing. It can be found on Rforge :

http://www.rforge.net/ppso/index.html

It's still in beta AFAIK, but it looks promising. I'm going to take a look at it later on, I'll report back when I know more. Still, I leave the question open, so if anybody else has another option...


Sprint might be of interest. I know nothing about it but stumbled across it recently.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜