最可爱的优化测试环境的python包装器
pycutest的Python项目详细描述
pycutest是一个python接口,CUTEst,一个用于测试优化软件的fortran包。它基于interface originally developed for CUTErby Prof. Arpad Buermen。
有关如何使用pycutest的详细信息,请参见documentation。
要求
pycutest需要安装以下软件:
- python 2.7或python 3(http://www.python.org/)
- 最可爱(见下文)
此外,还应安装以下python包(如果使用pip,这些包将自动安装,请参见Installation using pip):
- numpy 1.11或更高(http://www.numpy.org/)
- scipy 0.18或更高(http://www.scipy.org/)
请注意:当前pycutest仅支持Mac和Linux。对于windows 10用户,pycutest可以通过Windows Subsystem for Linux使用,遵循linux安装说明。
在Linux上安装Cutest
这些说明不包括安装Matlab接口。您需要安装四个软件包:archdefs、sifdecode、cutest和mastsif。为了简单起见,请将所有四个软件包安装在同一目录中:
$ mkdir cutest
$ cd cutest
$ git clone https://github.com/ralna/ARCHDefs ./archdefs
$ git clone https://github.com/ralna/SIFDecode ./sifdecode
$ git clone https://github.com/ralna/CUTEst ./cutest
$ git clone https://bitbucket.org/optrove/sif ./mastsif
注意mastsif
包含所有测试问题定义和
因此相当大。如果空间不足,您可能需要复制
只有*.SIF文件用于您要测试的问题。
接下来在~/.bashrc
中设置以下环境变量以指向上面使用的安装目录:
# CUTEst exportARCHDEFS=/path/to/cutest/archdefs/ exportSIFDECODE=/path/to/cutest/sifdecode/ exportMASTSIF=/path/to/cutest/mastsif/ exportCUTEST=/path/to/cutest/cutest/ exportMYARCH="pc64.lnx.gfo"
现在我们准备好以双精度安装cutest(需要gfortran
和gcc
):
$ cd ./cutest $ ${ARCHDEFS}/install_optrove Do you wish to install GALAHAD (Y/n)? N Do you wish to install CUTEst (Y/n)? Y Do you require the CUTEst-Matlab interface (y/N)? N Select platform: 6# PC with generic 64-bit processor Select operating system: 3# Linux Would you like to review and modify the system commands (y/N)? N Select fortran compiler: 5# GNU gfortran compiler Would you like to review and modify the fortran compiler settings (y/N)? N Select C compiler: 2# generic GCC Would you like to review and modify the C compiler settings (y/N)? N Would you like to compile SIFDecode (Y/n)? Y Would you like to compile CUTEst (Y/n)? Y CUTEst may be compiled in (S)ingle or (D)ouble precision or (B)oth. Which precision do you require for the installed subset (D/s/b) ? D
最可爱的应该从这里跑出来。要测试安装是否正常,请发出以下命令:
$ cd$SIFDECODE/src ; make -f $SIFDECODE/makefiles/$MYARCHtest $ cd$CUTEST/src ; make -f $CUTEST/makefiles/$MYARCHtest
请注意:当前pycutest只支持gfortran并使用路径上的默认版本(由gfortran -v
返回)。请确保此版本与上面安装cutest的版本相同,如果您在上面的安装程序中选择通用的GNU gfortran compiler
作为Fortran编译器,则会出现这种情况。
在Mac上安装Cutest
为了简单起见,我们建议使用以下详细说明的自制程序安装cutest(但您也可以按照上面的Linux安装说明手动安装cutest)。首先,确保安装了最新版本的xcode命令行工具(或最新版本的xcode)非常重要,请按照this guide来确保这是正确的。现在安装自制包管理器:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后您就可以轻松地安装cutest:
$ brew tap optimizers/cutest $ brew install cutest --without-single --with-matlab # if using Matlab interface $ brew install mastsif # if you want all the test problems $ for f in "archdefs""mastsif""sifdecode""cutest";do\ $ echo". $(brew --prefix $f)/$f.bashrc" >> ~/.bashrc;\ $ done
使用PIP安装
为了便于安装,请使用pip作为根目录:
$ [sudo] pip install pycutest
或者easy_install:
$ [sudo] easy_install pycutest
如果您没有根权限,或者您想安装pycutest供您私人使用,您可以使用:
$ pip install --user pycutest
它将在您的主目录中安装pycutest。
请注意,如果您的系统上有pycutest的旧安装,则可以使用:
$ [sudo] pip install --upgrade pycutest
将pycutest升级到最新版本。
然后,您需要创建一个文件夹来存储所有编译的问题:
$ mkdir pycutest_cache
并通过添加到~/.bashrc
文件中,设置一个环境变量来告诉pycutest有关此目录的信息:
exportPYCUTEST_CACHE="/path/to/pycutest_cache"exportPYTHONPATH="${PYCUTEST_CACHE}:${PYTHONPATH}"
手动安装
或者,您可以从Github下载源代码并按如下方式解压缩:
$ git clone https://github.com/jfowkes/pycutest
$ cd pycutest
pycutest是用纯python编写的,不需要编译。它可以通过以下方式安装:
$ [sudo] pip install .
如果您没有根权限,或者您想安装pycutest供您私人使用,您可以使用:
$ pip install --user .
它将在您的主目录中安装pycutest。
不要忘记设置缓存和相关的环境变量(见上文)。
要将pycutest升级到最新版本,请导航到顶级目录(即包含setup.py
)并重新运行使用pip
安装,如上所述:
$ git pull $ [sudo] pip install . # with root privileges
测试
如果您手动安装pycutest,则可以运行以下命令来测试安装:
$ python setup.py test
卸载
如果pycutest是使用pip安装的,则可以按如下方式卸载:
$ [sudo] pip uninstall pycutest
否则,您必须手动删除已安装的文件(位于python站点包目录中)。
错误
请使用Github的问题跟踪程序报告任何错误。
许可证
该算法在gnu gpl许可下发布。