我运行以下脚本(这是PyGMO网站上的一个示例): 链接:http://pagmo.sourceforge.net/pygmo/tutorials/adding_a_new_optimization_problem.html
---------------------------- CODE -------------------------------
from PyGMO.problem import base
import PyGMO as pgg
class my_problem(base):
def init(self, dim = 10):
super(my_problem,self).init(dim)
self.set_bounds(-5.12,5.12)
self.dim = dim
def _objfun_impl(self,x):
f = 0;
for i in range(self.dim):
f = f + (x[i])*(x[i])
return (f,)
def human_readable_extra(self):
return "\n\t Problem dimension: " + str(self.__dim)
prob = my_problem(dim=10)
algo = pgg.algorithm.bee_colony(gen=5)
isl = pgg.island(algo,prob,20)
isl.evolve(1); isl.join()
print isl.population.champion.f
---------------------------- CODE -------------------------------
在执行之后,它会在没有任何错误或警告的情况下启动优化。如果你检查任务管理器,会有大量的python.exe过程和数量越来越多。最后撞到了窗户。同样的代码在使用PyCharm时有相同的问题。在
我正在使用: Spyder 2.2.5/Pycharm 2.6.3-win32 Python 2.7.3 Windows 7-64位 PyGMO的最新版本
stochastic optimization problem tutorial中的代码也有相同的问题。在
在IDEL中运行代码,效果很好!!在
有人遇到过同样的问题吗?我在PyGMO的网站上报告了这个错误,但是还没有答案。 有什么解决办法吗?在
目前没有回答
相关问题 更多 >
编程相关推荐