esa / pagmo2

A C++ platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
https://esa.github.io/pagmo2/
GNU General Public License v3.0
816 stars 161 forks source link

AttributeError: module 'pygmo' has no attribute 'ipopt' #261

Closed KaiyouHu closed 5 years ago

KaiyouHu commented 5 years ago

I tried to reappaear the code of tutorials/coding_udp_minlp.But I got a error as follow

E:\IDE\Anaconda3\envs\mo\python.exe E:/Workspace/PyCharm-workspace/Evolutionary/src/com/kaiyouhu/pygmo/problem/udp_minpl.py Traceback (most recent call last): Problem name: Function minpl File "E:/Workspace/PyCharm-workspace/Evolutionary/src/com/kaiyouhu/pygmo/problem/udp_minpl.py", line 57, in Global dimension: 6 archi = pg.archipelago(n=20, algo=pg.ipopt(), prob=my_minlp(), pop_size=1) AttributeError: module 'pygmo' has no attribute 'ipopt' Integer dimension: 2 Fitness dimension: 7 Number of objectives: 1 Equality constraints dimension: 0 Inequality constraints dimension: 6 Tolerances on constraints: [0, 0, 0, 0, 0, ... ] Lower bounds: [-5, -5, -5, -5, -5, ... ] Upper bounds: [5, 5, 5, 5, 5, ... ]

Has gradient: true
User implemented gradient sparsity: false
Expected gradients: 42
Has hessians: false
User implemented hessians sparsity: false

Fitness evaluations: 0
Gradient evaluations: 0

Thread safety: none

Process finished with exit code 1

I used pip and conda,but they didn't work. Does pygmo not contain ipopt?

darioizzo commented 5 years ago

from the docs:

In general, we recommend the use of conda: in addition to making the installation of pygmo easy, 
it also provides user-friendly access to a wealth of packages from the scientific Python ecosystem. 
Conda is a good default choice in Linux and OSX.

In Windows, the situation is a bit more complicated. The first issue is that the compiler used by conda 
for Python 2.7 is too old to compile pygmo, and thus we cannot provide conda packages for Python 2.7 
(however, we do provide conda packages for Python 3.x). The second issue is that the Windows 
platform lacks a free Fortran compiler that can interoperate with Visual C++ (the compiler used by 
conda on Windows). Thus, the pygmo packages for conda on Windows might lack some Fortran-based 
features available on Linux and OSX (e.g., the wrapper for the Ipopt solver).
darioizzo commented 5 years ago

Try with pip.

bluescarni commented 5 years ago

There's no support in Windows for ipopt, in either pip or conda.

darioizzo commented 5 years ago

my bad ... :)

bluescarni commented 5 years ago

To expand a bit, the lack of ipopt on Windows is due to the fact that, when we started packaging pagmo/pygmo for windows, it was exceedingly complicated to get a free Fortran compiler working on Windows (certain parts of ipopt are written in Fortran).

Today, there's flang - a free Windows fortran compiler based on LLVM which is also available in conda:

https://anaconda.org/conda-forge/flang

The current conda ipopt package, however, does not support Windows yet, and I suspect that the conda folks would gladly accept patches/PR to make ipopt compilable on Windows with flang:

https://github.com/conda-forge/ipopt-feedstock

bluescarni commented 5 years ago

Will go ahead can close this for the time being.