Linux Ubuntu16.04 pip安装pyscipopt
文章目录
一、pyscipoopt是什么?
SCIP 是一个解决约束整数规划 (CIP) 和混合整数非线性规划的框架。SCIP 结合了混合整数规划 (MIP) 求解器以及基于 LP 的混合整数非线性规划 (MINLP) 求解器,并且是分支切割和定价的框架。
SCIP is a framework to solve constraint integer programs (CIPs) and mixed-integer nonlinear programs. In particular, SCIP incorporates a mixed-integer programming (MIP) solver as well as an LP based mixed-integer nonlinear programming (MINLP) solver, and is a framework for branch-and-cut-and-price.
参考官方文档: doc
二、安装scipoptsuit组件
scip官网:https://scipopt.org/
1.下载scip安装文件
在Download下,选择平台类型和需要下载的版本型号,这里我选择4.0.0版本。下分别点击下面出现对应的下载文件链接。
点击下载链接,将跳转到信息统计界面。填写基本信息,选择非商用选项,点击Start Download进行下载。
下载完成scipoptsuite-4.0.0.tgz、scipoptheaders-4.0.0.tgz、
scip-4.0.0.tgz三个文件后在本地解压。
2.安装scipoptsuit
打开scipoptsuit-4.0.0文件夹并用gedit打开INSTALL文件,将会显示具体的安装步骤。
cd scipoptsuit-4.0.0
gedit ./INSTALL
The SCIP Optimization Suite consists of the following five software tools:
- ZIMPL - the Zuse Institute Mathematical Programming language
- SoPlex - the Sequential Object Oriented Simplex
- SCIP - Solving Constraint Integer Programs
- GCG - Generic Column Generation
- UG - Ubiquity Generator Framework
I Creating a SCIP binary and the individual libraries
II Creating a single library containing SCIP, SoPlex, and ZIMPL
III Creating GCG and UG
这里根据需求我需要执行I和II步骤。
I、 Creating a SCIP binary and the individual libraries
cd scipoptsuit-4.0.0
make
如果gcc 编译器版本<4.2 ,需要执行:
cd scipoptsuit-4.0.0
make LPSOPT=opt-gccold ZIMPLOPT=opt-gccold OPT=opt-gccold
其他特殊安装需求参考安装文档
安装成功后会显示:
** Build complete.
** Find your binary in “
** Enter “make test” to solve a number of easy instances in order to verify that SCIP runs correctly.
II、Creating a single library containing SCIP, SoPlex, and ZIMP
cd scipoptsuit-4.0.0
make scipoptlib SHARED=true
成功后显示:
** Build complete.
** Find your SCIP binary in “
** Enter “make test” to solve a number of easy instances in order to verify that SCIP runs correctly.
链接文件将放在lib文件夹
2.配置环境变量
打开~/.bashrc文件,在最后一行添加:
export PATH=$PATH:~/自己的路径/scipoptsuite-4.0.0/scip-4.0.0/bin/
终端中输入:
source ~/.bashrc
测试:
终端输入:
scip
显示下面结果说明scip可以正常使用
三、安装pyscipopt
解压之前下载的scipoptheaders-4.0.0.tgz文件得到include文件夹,将该文件家放到
然后终端输入:
pip install pyscipopt==2.0
注意版本必须要和scip版本配套,否则会报错。
安装成功后显示:
Successfully installed pyscipopt-2.0.0
参考资料
https://scipopt.org/index.php
https://blog.csdn.net/weixin_42690752/article/details/108429040
https://zhuanlan.zhihu.com/p/494450220