pagmo
pagmo copied to clipboard
AttributeError: module 'pygmo' has no attribute 'problem'
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?
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 :
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?