pagmo icon indicating copy to clipboard operation
pagmo copied to clipboard

AttributeError: module 'pygmo' has no attribute 'problem'

Open kurosh-z opened this issue 6 years ago • 2 comments

Hi , I installed pagmo for cpp and pygmo for python , in Cpp it works but the python version could find nothing! no problem , no algorithm ... any Idea what might cause this problem?

image

kurosh-z avatar Sep 19 '18 21:09 kurosh-z

I did : conda config --add channels conda-forge conda install pygmo and after that pip install pygmo now it runs the quick start problem from here (https://esa.github.io/pagmo2/quickstart.html) but in my code I would like to use algo = pg.algorithm(pg.nlopt()) which causes Segmentation Error : image

kurosh-z avatar Sep 19 '18 22:09 kurosh-z

Try NLOPT on a standard problem. The segfault may be in your code and not in pagmo. try something like:

In [7]: class my_prob:
   ...:     def __init__(self, dim):
   ...:         self.dim = dim
   ...:     def fitness(self, dv):
   ...:         return (sum(dv),)
   ...:     def get_bounds(self):
   ...:         return  ([0]*self.dim, [1]*self.dim)
   ...: 
   ...: algo = pg.algorithm(pg.nlopt())
   ...: pop = pg.population(my_prob(3), 1)
   ...: pop = algo.evolve(pop)
In [11]: pop.champion_f
Out[11]: array([6.9388939e-18])

is this working?

darioizzo avatar Sep 20 '18 06:09 darioizzo