本笔记介绍如何在windows操作系统下安装ipopt. 参考http://www.coin-or.org/Ipopt/documentation/node15.html#WindowsInstall
需要安装的软件:
1. MSVC
2. Intel fortran
在windows7系统安装Ipopt
1. 下载源码。
在目标文件夹右键,选择tortoiseSVN/checkout。网址为:https://projects.coin-or.org/svn/Ipopt/stable/3.12
该网址会进行更新,可参考IPOPT官方网站上的下载说明,进行相应修改。IPOPT代码下载官方链接
2. 下载ASL,BLAS,LAPACK.
Note that you only need to obtain the ASL if you intend to use IPOPT from AMPL. It is not required if you want to specify your optimization problem in a programming language (C++, C, or Fortran). Also, currently, Lapack is only required if you intend to use the quasi-Newton options implemented in IPOPT.
当前我借助linux操作系统下载需要的文件。可以用VMWare虚拟机安装ubuntu系统。
在第一步下载得到的ipopt文件夹下,可以找到 $IPOPTDIR/ThirdParty/Blas 文件夹下的 get.Blas 文件。将其拷贝到虚拟机下文件夹中 运行./get.Blas 即开始下载。ASL和LAPACK可以按同样的方法下载。
3.Download HSL Subroutines
- Go to http://hsl.rl.ac.uk/ipopt.
- Choose whether to download either the Archive code or the HSL 2011 code. To download, select the relevant ``source'' link.
- Follow the instructions on the website, read the license, and submit the registration form.
- Wait for an email containing a download link (this should take no more than one working day).
- Compile the HSL code as part of IPOPT. See the instructions below.
This section describes how you can compile IPOPT with the Microsoft Visual C++ compiler under Cygwin. Here you have two options for compiling the Fortran code in the third party dependencies:
- Using a Windows Fortran compiler, e.g., the Intel Fortran compiler, which is also able to compile Fortran 90 code. This would allow you to compile the MUMPS linear solver if you desire to do so.
- Using the f2c Fortran to C compiler, available for free at Netlib (see http://www.netlib.org/f2c). This can only compile Fortran 77 code (i.e., you won't be able to compile MUMPS). Before doing the following installation steps, you need to follow the instructions in
$IPOPTDIR/BuildTools/compile_f2c/INSTALL.
It is possible to build the IPOPT AMPL solver executable in Cygwin for general use in Windows. You can also hook up IPOPT to your own program if you compile it in the Cygwin environment10.
If you want to compile IPOPT under Cygwin, you first have to install Cygwin on your Windows system. This is pretty straight forward; you simply download the ``setup'' program fromhttp://www.cygwin.com and start it.
Then you do the following steps (assuming here that you don't have any complications with firewall settings etc - in that case you might have to choose some connection settings differently):
- Click next
- Select ``install from the internet'' (default) and click next
- Select a directory where Cygwin is to be installed (you can leave the default) and choose all other things to your liking, then click next
- Select a temp dir for Cygwin setup to store some files (if you put it on your desktop you will later remember to delete it)
- Select ``direct connection'' (default) and click next
- Select some mirror site that seems close by to you and click next
- OK, now comes the complicated part:
You need to select the packages that you want to have installed. By default, there are already selections, but the compilers are usually not pre-chosen. You need to make sure that you select the GNU compilers (for Fortran, C, and C++), Subversion, and some additional tools. For this, get the following packages from the associated branches:- ``Devel'': gcc4
- ``Devel'': gcc4-fortran
- ``Devel'': pkg-config
- ``Devel'': subversion
- ``Archive'': unzip
- ``Utils'': patch
- ``Web'': wget
- Then you click on next, and Cygwin will be installed (follow the rest of the instructions and choose everything else to your liking). At a later point you can easily add/remove packages with the setup program.
- The version of the GNU Make utility provided by the Cygwin installer will not work. Therefore, you need to download the fixed version from http://www.cmake.org/files/cygwin/make.exe and save it to C:
cygwin
bin. Double-check this new version by typing make -version in a Cygwin terminal (see next point). If you get an error -bash: /usr/bin/make: Bad address, then tryhttp://www.cmake.org/files/cygwin/make.exe-cygwin1.7 instead, rename it to make.exe and move it to C:
cygwin
bin. (Replace C:
cygwin with your installation location if different.)
- Now that you have Cygwin, you can open a Cygwin window, which is like a UNIX shell window.
Once you have settled on this, do the following:
- Follow the instructions in Section 2.5.1 until Step 11 and stop after your downloaded the third party code.
- Now you need to make sure that Cygwin knows about the native compilers. For this you need to edit the file cygwin.bat in the Cygwin base directory (usually C:
cygwin). Here you need to add a line like the following:
call "C:
Program Files
Microsoft Visual Studio 8
VC
vcvarsall.bat"
On my computer, this sets the environment variables so that I can use the MSVC++ compiler.
If you want to use also a native Fortran compiler, you need to include something like this
call "C:
Program Files
Intel
Fortran
compiler80
IA32
BIN
ifortvars.bat"
You might have to search around a bit. The important thing is that, after your change, you can type ``cl'' in a newly opened Cygwin windows, and it finds the Microsoft C++ compiler (and if you want to use it, the Fortran compiler, such as the Intel's ifort).
- Run the configuration script, and tell it that you want to use the native compilers:
./configure -enable-doscompile=msvc
Make sure the last message is
Main Ipopt configuration successful
- Now you can compile the code with
make,
test the installation with
make test,
and install everything with
make install