[我之前在StackOverflow上问过我的问题,但这个网站可能更合适]
在 Matlab 中,我目前在计算机集群的并行设置中使用MultiStart作为优化算法。例如,这是我的 Matlab 代码:
opts = optimoptions(@fmincon,'Algorithm','sqp','Use Parallel','Always'); %The options for the algo. The key here is the Use Parallel
problem = createOptimProblem('fmincon','objective',...
@(x) x.^2 + 4*sin(5*x),'x0',3,'lb',-5,'ub',5,'options',opts); %x is the variable I wish to min/max
ms = MultiStart;
[x,f] = run(ms,problem,20) %20 stands for the number of initial random variables
当我在集群上为 X 处理器提交批处理作业时,此代码运行良好。我正在网上寻找可以使用 Python 并行实现的类似算法,但我有点不知所措。任何类似的算法可用于 Python?
更新
至于我的集群要求,多线程是不可接受的。通常我使用mpi4py
.