在Cygwin上安装和使用IPopt-还是更好的选择? [英] Installing and using IPopt with Cygwin - or even better alternative?

查看:89
本文介绍了在Cygwin上安装和使用IPopt-还是更好的选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是优化领域的新手.但是使用fmincon进行了一些项目,现在正在寻找在OpenSource中可用的替代方式,最好在Python中以某种方式使用.因此,我找到了IPopt.还有其他与fmincon一样好的建议吗?

我尝试通过编译来安装IPopt.我必须说,这看起来像一团糟.我尝试了所有版本,最后得到了手册中最有前途的一个使用MSVC ++编译器安装Cygwin".因此,我必须安装CYGwin并更改make.exe.完毕.将Visual Studio(在我的情况下为Visual Studio 1)中的cl.exe添加到Apth环境中.完毕.将"call"调用"C:\ Program Files(x86)\ Microsoft Visual Studio 14 \ VC \ vcvarsall.bat"添加到cygwin.bat.完成.

现在有两件事.当我对下载的IPopt源执行"./configure"时,我得到:配置:错误:/pop/sh'./configure'对于Ipopt失败"

也像手动调用"./configure -enable-doscompile = msvc"中所建议的那样,告诉cygwin使用Windows编译器会给我配置:错误:--enable-doscompile = mscv不再受支持."

所以.基本上,我无法安装Ipopt.使用它似乎是不可能的,因为在Win10 64bit上所有其他构建它的方法也都失败了.手册似乎过时了,或者我找不到执行该手册的核心方法,希望你们中的一些人能提供帮助.编译是相当新的东西,我很高兴学习.提前预定.

解决方案

确保在Cygwin中安装了以下软件包.

  • 开发:gcc
  • 开发:gfortran
  • 开发:pkg-config
  • 开发:颠覆
  • 存档:解压缩
  • 实用程序:补丁程序
  • 网站:wget
  • 实用程序:dos2unix

假设您要构建64位,请在Cygwin.bat(位于Cygwin的安装位置的根目录中)中向cl.exe添加路径,以便可以从Cygwin使用msvc –调用"C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ bin \ amd64 \ vcvars64.bat" (vcvarsall需要您指定体系结构版本)

您将需要Intel Fortran编译器.它与Parallel Studio一起提供.对学生,教师和开放源代码贡献者免费.


.bash_profile (位于 pathto/cygwin64/home/username/中)中添加以下行,以便ifort识别msvc链接器(上面给出的路径应为msvc的link.exe)–
alias ifort ='ifort -Qlocation,link,"C:/程序文件(x86)/Microsoft Visual Studio 12.0/VC/bin/amd64"'

英特尔Fortran已集成到Visual Studio Shell中.运行这个shell.从此shell执行cygwin.bat.检查链接的版本( link --version ).如果不是Microsoft链接程序,则可能必须从Cygwin文件夹中删除Cygwin link.exe 文件.

请注意,其他bash终端(例如Git Bash)可能会干扰.您将仅在运行 configure 脚本时才知道.它尝试从那些bash终端访问软件包.您可能需要暂时将它们放置在其他位置,以便cygwin找不到它们.

我了解您已经阅读了该手册,因此您必须下载了Ipopt所需的第三方工具(asl,lapck,blas和一个线性求解器).

您现在可以运行(在Ipopt根文件夹中):

  mkdir构建光盘制作../configure --enable-msvc = MD制作进行安装 

I am new to the optimization field. Did some projects with fmincon though, and am now looking for an alternative usable in OpenSource, preferrably somehow usable in Python. Therefore I found IPopt. Any other suggestions which are equally good as fmincon?

I tried to install IPopt by compiling it. And I must say, it seems like a mess. I tried all version and ended up with the most promising one "Installation with Cygwin using the MSVC++ compiler " from the Manual. Therefore I have to install CYGwin and change the make.exe. Done. Add the cl.exe from Visual Studio (Visual Studio 1 in my case) to the Apth environment. Done. add "call "call "C:\Program Files (x86)\Microsoft Visual Studio 14\VC\vcvarsall.bat" " to the cygwin.bat. Done.

Now two things. When I do "./configure" with the downloaded IPopt sources I get: "configure: error: /bin/sh './configure' failed for Ipopt"

Also like suggested in the manual calling "./configure -enable-doscompile=msvc" to tell cygwin to use the windows compiler gives me "configure: error: --enable-doscompile=mscv not supported anymore."

So. Basically I am not able to install Ipopt. Using it seem like impossible, as all other methods to build it also failed on my Win10 64bit. It seems that the manual is outdated or I am not finding the corect way to do it, hope some of u guys probably can help. Compiling is something rather new and I am happy to learn. Tahnks in advance.

解决方案

Ensure that you have the following packages installed in Cygwin.

  • Devel: gcc
  • Devel: gfortran
  • Devel: pkg-config
  • Devel: subversion
  • Archive: unzip
  • Utils: patch
  • Web: wget
  • Utils: dos2unix

Assuming you are building for 64-bit, add path to cl.exe in Cygwin.bat (located in root directory of location where Cygwin was installed) so that msvc can be used from Cygwin – call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat" (vcvarsall needs you to specify architecture version)

You will need the Intel Fortran Compiler. It comes along with Parallel Studio. Free for students, faculty, open source contributors.


In .bash_profile (located in pathto/cygwin64/home/username/) add this line so that ifort recognizes msvc linker (path given above should be to link.exe of msvc) –
alias ifort='ifort -Qlocation,link,"C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64"'

Intel Fortran gets integrated to a visual studio shell. Run this shell. Execute cygwin.bat from this shell. Check the version of link (link --version). If it is not the microsoft linker, you may have to remove the Cygwin link.exe file from Cygwin folder.

Note that any other bash terminals (e.g. Git Bash) might interfere. You will come to know only while running the configure script. It tries to access packages from those bash terminals. You may have to place them elsewhere temporarily, so cygwin does not find them.

I understand you have read the manual, so you must have downloaded the required third-party tools for Ipopt (asl, lapck, blas and one linear solver) .

You can now run (in Ipopt root folder):

mkdir build  
cd build  
../configure --enable-msvc=MD  
make  
make  install

这篇关于在Cygwin上安装和使用IPopt-还是更好的选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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