并行多维度优化 [英] Parallel many dimensional optimization

查看:97
本文介绍了并行多维度优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个脚本,该脚本会生成输入数据[参数],供另一个程序计算.我想优化结果数据.以前,我一直在使用numpy powell优化.伪代码看起来像这样.

I am building a script that generates input data [parameters] for another program to calculate. I would like to optimize the resulting data. Previously I have been using the numpy powell optimization. The psuedo code looks something like this.

def value(param):
     run_program(param)
     #Parse output
     return value

scipy.optimize.fmin_powell(value,param) 

这很好用;但是,它非常慢,因为该程序的每次迭代都可能需要几天才能运行.我想做的是粗粒度并行化.因此,而不是一次运行单个迭代,而是一次运行(参数数量)* 2.例如:

This works great; however, it is incredibly slow as each iteration of the program can take days to run. What I would like to do is coarse grain parallelize this. So instead of running a single iteration at a time it would run (number of parameters)*2 at a time. For example:

Initial guess: param=[1,2,3,4,5]

#Modify guess by plus minus another matrix that is changeable at each iteration
jump=[1,1,1,1,1]
#Modify each variable plus/minus jump.
for num,a in enumerate(param):
    new_param1=param[:]
    new_param1[num]=new_param1[num]+jump[num]
    run_program(new_param1)
    new_param2=param[:]
    new_param2[num]=new_param2[num]-jump[num]
    run_program(new_param2)

#Wait until all programs are complete -> Parse Output
Output=[[value,param],...]
#Create new guess
#Repeat

变量的数量可以在3到12之间变化,因此诸如此类的事情可能会使代码从一年缩短到一周的速度加快.所有变量都相互依赖,我只是从最初的猜测中寻找局部最小值.我已经开始使用粗麻布矩阵实现;但是,这是相当复杂的.有没有其他办法做到这一点,是否有更简单的方法,或者有任何入门建议?

Number of variable can range from 3-12 so something such as this could potentially speed up the code from taking a year down to a week. All variables are dependent on each other and I am only looking for local minima from the initial guess. I have started an implementation using hessian matrices; however, that is quite involved. Is there anything out there that either does this, is there a simpler way, or any suggestions to get started?

因此,主要问题如下: 是否有一种算法可以进行初始猜测,生成多个猜测,然后使用这些多个猜测来创建新的猜测,并重复进行直到找到阈值.仅分析导数可用.解决这个问题的好方法是什么,是否已经建立了某些功能,还有其他选择吗?

So the primary question is the following: Is there an algorithm that takes a starting guess, generates multiple guesses, then uses those multiple guesses to create a new guess, and repeats until a threshold is found. Only analytic derivatives are available. What is a good way of going about this, is there something built already that does this, is there other options?

谢谢您的时间.

作为一个小小的更新,我确实可以通过计算每个维度的三个点的简单抛物线,然后将最小值用作下一个猜测来进行这项工作.这似乎工作得不错,但不是最佳选择.我仍在寻找其他选项.

As a small update I do have this working by calculating simple parabolas through the three points of each dimension and then using the minima as the next guess. This seems to work decently, but is not optimal. I am still looking for additional options.

当前最佳实现是并行化鲍威尔方法的内部循环.

Current best implementation is parallelizing the inner loop of powell's method.

谢谢大家的评论.不幸的是,对于这个特殊问题似乎根本没有一个简明的答案.如果我打算执行某项操作,则将其粘贴到此处;否则,将其粘贴到此处.但是,由于该项目不是特别重要,或者需要紧迫的结果,我可能会很满意让它占据一个节点.

Thank you everyone for your comments. Unfortunately it looks like there is simply not a concise answer to this particular problem. If I get around to implementing something that does this I will paste it here; however, as the project is not particularly important or the need of results pressing I will likely be content letting it take up a node for awhile.

推荐答案

我上大学时遇到了同样的问题,我们有一个fortran算法,用于基于一组变量来计算引擎的效率.在我们使用modeFRONTIER的时候,如果我没记错的话,没有一种算法能够产生多个猜测.

I had the same problem while I was in the university, we had a fortran algorithm to calculate the efficiency of an engine based on a group of variables. At the time we use modeFRONTIER and if I recall correctly, none of the algorithms were able to generate multiple guesses.

通常的方法是拥有一个DOE,并在那里生成一些算法来最适合您的问题的DOE.之后,我们将并行运行单个DOE条目,并且算法将监视"显示当前最佳设计的优化开发.

The normal approach would be to have a DOE and there where some algorithms to generate the DOE to best fit your problem. After that we would run the single DOE entries parallely and an algorithm would "watch" the development of the optimizations showing the current best design.

侧面说明:如果您没有群集并且需要更多的计算能力,HTCondor可能会为您提供帮助.

Side note: If you don't have a cluster and needs more computing power HTCondor may help you.

这篇关于并行多维度优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆