安装python的SCIP接口PySCIPOpt系列
https://blog.csdn.net/qq_40275637/article/details/109702809

1.安装环境

①cmake(https://cmake.org/)
②Visual Studio 2015,但是貌似以下版本都可以,而且要把SDK装好,我装的SDK8 和 SDK10

③SCIP 7.0.0 https://www.scipopt.org/index.php#download
④Java , eclipse
⑤SWIG拓展模块
(可以不装,建议装上)http://prdownloads.sourceforge.net/swig/swigwin-4.0.2.zip
以上我都装的64位版本。

2.环境配置


基本上需要的都在上面。

3. 安装步骤

参考: https://github.com/SCIP-interfaces
有一位博主给出的简洁明了的安装方式:(❤)
https://github.com/SCIP-Interfaces/JSCIPOpt/issues/28

①下载安装SCIP并配置好环境变量,可以再cmd中输入scip来检查
②下载JACIPOpt,我放在了D:\javaSCIPinterface 文件夹
(https://github.com/SCIP-Interfaces/JSCIPOpt/archive/master.zip)
③下载并安装拓展模块SWIG,我放在了D:\JSCIP_SWIG,运行并配置环境变量,可以在cmd中输入swig -help检查
(http://prdownloads.sourceforge.net/swig/swigwin-4.0.2.zip)
④确认cmake环境变量,可以在cmd输入cmake,java, eclipse环境变量也要配置好 ④打开这里:

⑤依次输入如下命令:

D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>cd D:\javaSCIPinterface\JSCIPOpt-master
D:\javaSCIPinterface\JSCIPOpt-master>mkdir build
D:\javaSCIPinterface\JSCIPOpt-master>set SCIP_DIR="C:\Program Files\SCIPOptSuite 7.0.0\lib\scip"
D:\javaSCIPinterface\JSCIPOpt-master>cd build
//这里会运行一下
D:\javaSCIPinterface\JSCIPOpt-master\build>nmake
//这里也会运行一下

具体是这样:

D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>cd D:\javaSCIPinterface\JSCIPOpt-masterD:\javaSCIPinterface\JSCIPOpt-master>mkdir buildD:\javaSCIPinterface\JSCIPOpt-master>set SCIP_DIR="C:\Program Files\SCIPOptSuite 7.0.0\lib\scip"D:\javaSCIPinterface\JSCIPOpt-master>cd buildD:\javaSCIPinterface\JSCIPOpt-master\build>cmake -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ../
CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found JNI: C:/Program Files/Java/jdk1.8.0_271/lib/jawt.lib
-- Found Java: C:/Program Files/Java/jdk1.8.0_271/bin/java.exe (found version "1.8.0_271")
-- Found SWIG: D:/JSCIP_SWIG/swigwin-4.0.2/swig.exe (found version "4.0.2")
-- Configuring done
-- Generating done
-- Build files have been written to: D:/javaSCIPinterface/JSCIPOpt-master/buildD:\javaSCIPinterface\JSCIPOpt-master\build>nmakeMicrosoft (R) 程序维护实用工具 14.00.24210.0 版
版权所有 (C) Microsoft Corporation。 保留所有权利。Scanning dependencies of target jscip
[ 7%] Building C object CMakeFiles/jscip.dir/src/scipjni_wrap.c.obj
scipjni_wrap.c
C:\PROGRA1\SCIPOP1.0\lib\cmake\scip......\include\scip/branch_distribution.h: warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 (The file contains characters that cannot be represented in the current code page (936). Please save the file in Unicode format to prevent data loss)
C:\PROGRA1\SCIPOP1.0\lib\cmake\scip......\include\scip/heur_randrounding.h: warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\PROGRA1\SCIPOP1.0\lib\cmake\scip......\include\scip/sepa_disjunctive.h: warning C4819: 该文件包含不能在当前代码 页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
[ 14%] Linking C shared library jscip.dll
正在创建库 jscip.lib 和对象 jscip.exp(Creating library jscip.lib And objects jscip.exp)
[ 21%] Built target jscip
Scanning dependencies of target scipjar
[ 28%] Building Java objects for scipjar.jar
[ 35%] Generating CMakeFiles/scipjar.dir/java_class_filelist
[ 42%] Creating Java archive scip.jar
[ 50%] Built target scipjar
Scanning dependencies of target examples
[ 57%] Building Java objects for examples.jar
[ 64%] Generating CMakeFiles/examples.dir/java_class_filelist
[ 71%] Creating Java archive examples.jar
[100%] Built target examples

⑥调试: 需要把创建成功的接口放到系统路径:
D:\javaSCIPinterface\JSCIPOpt-master\build
在eclipse 的项目中导入包:(与cplex导包的过程类似)

执行如下代码:没有报错即安装成功。

package myFirstProgram;import jscip.*;/** Example how to create a problem with linear constraints. */
public class Linear
{public static void main(String args[])
{// load generated C-library
System.loadLibrary("jscip"); //******importentScip scip = new Scip();// set up data structures of SCIPscip.create("LinearExample");// create variables (also adds variables to SCIP)Variable x = scip.createVar("x", 2.0, 3.0, 1.0, SCIP_Vartype.SCIP_VARTYPE_CONTINUOUS);Variable y = scip.createVar("y", 0.0, scip.infinity(), -3.0, SCIP_Vartype.SCIP_VARTYPE_INTEGER);// create a linear constraintVariable[] vars = {x, y};double[] vals = {1.0, 2.0};Constraint lincons = scip.createConsLinear("lincons", vars, vals, -scip.infinity(), 10.0);// add constraint to SCIPscip.addCons(lincons);// release constraint (if not needed anymore)scip.releaseCons(lincons);// set parametersscip.setRealParam("limits/time", 100.0);scip.setRealParam("limits/memory", 10000.0);scip.setLongintParam("limits/totalnodes", 1000);// solve problemscip.solve();System.out.println("final gap = " + scip.getGap());// print all solutionsSolution[] allsols = scip.getSols();for( int s = 0; allsols != null && s < allsols.length; ++s )System.out.println("solution (x,y) = (" + scip.getSolVal(allsols[s], x) + ", " + scip.getSolVal(allsols[s], y) + ") with objective value " + scip.getSolOrigObj(allsols[s]));// release variables (if not needed anymore)scip.releaseVar(y);scip.releaseVar(x);// free SCIPscip.free();

安装Java的SCIP接口JSCIPOpt系列相关推荐

  1. 安装python的SCIP接口PySCIPOpt亲测系列

    SCIP是一款免费的非商业求解器,可以求解非线性规划问题,并且具本博主亲测,万个以上的变量可以在一到两天内求解完成(大概).支持Python , Java接口,Python接口更加成熟,更容易装.Ja ...

  2. Java线上问题排查系列--后端接口响应慢的排查方法及解决方案

    原文网址:Java线上问题排查系列--后端接口响应慢的排查方法及解决方案_IT利刃出鞘的博客-CSDN博客 简介 说明 本文介绍Java后端接口响应慢的排查的方法以及如何解决. 如何发现接口响应慢了? ...

  3. JAVA入门基础6**(系列更新)———面向对象(二)的继承,抽象,接口

    **JAVA入门基础6**(系列更新)---面向对象(二)的继承,抽象,接口 面向对象2 大致总结 继承 @Override super();的应用 调用顺序 构造顺序 多态 什么是多态??? 多态有 ...

  4. 高薪程序员Java面试题精讲系列汇总

    因CSDN没有分类归纳博客的功能,所以特写本帖汇总<高薪程序员面试题精讲系列>教程,方便大家查阅!希望各位小伙伴可以从我的拙作中掌握Java的高频面试题,也希望各位可以多给予指教!目前本系 ...

  5. eclipse安装JAVA反编译插件

    前言:在实际的开发中几乎都会使用到一些框架来辅助项目的开发工作,对于一些框架的代码我们总怀有一些好奇之心,想一探究竟,有源码当然更好了,对于有些JAR包中的代码我们就需要利用反编译工具来看一下了,下面 ...

  6. Java I/O系统学习系列二:输入和输出

    编程语言的I/O类库中常使用流这个抽象概念,它代表任何有能力产出数据的数据源对象或者是有能力接收数据的接收端对象."流"屏蔽了实际的I/O设备中处理数据的细节. 在这个系列的第一篇 ...

  7. java.util (Collection接口和Map接口)

    1:Collection和Map接口的几个主要继承和实现类                  1.1  Collection接口 Collection是最基本的集合接口,一个Collection代表一 ...

  8. java语言sql接口_Java语言SQL接口

    Java语言SQL接口 编辑 锁定 讨论 上传视频 <Java语言SQL接口>是1997年清华大学出版社出版的图书,作者是孙元等.本书覆盖了JDBC的各个方面,适合于有一定的Java语言编 ...

  9. java安装了为什么运行不了_如何安装java(安装了java为什么不能使用)

    如何安装java 1.双击下载的程序包,它将如图所示. 2.单击下一步:在这里,我将路径更改为(D驱动器下的jdk1.8) 3.继续下一步,将出现一个弹出框,单击"确定". 4.单 ...

最新文章

  1. SAP 盘盈盘亏移动类型701702 Vs 711712
  2. 多delegate使用
  3. @valid 不生效_黑帽seo高手-实战细谈301生效周期+影响收录重要因素(探索)
  4. jython mysql_Jython
  5. mysql 存储过程已存在_sql存储过程实现 添加新用户,判断是否已存在
  6. pytorch nn.CrossEntropyLoss
  7. Unity3D实现按钮切换Panel的功能
  8. 解读Depth Map Prediction from a Single Image using a Multi-Scale Deep Network (2)
  9. 悦动圈跑步 随意提交步数 重大BUG漏洞 希望官方早些修复
  10. JAVA-读取excel转成html 将excel表格转换为HTML文件格式 转成前端表格样式
  11. 各国疫苗接种进度(气泡图可视化)
  12. SPAC第一家“吃螃蟹”的公司来了,港股等待“化学反应”?
  13. PS CC2019中英文切换方法
  14. 页面显示格式化的时间、倒计时效果、学成在线案例(创建、添加节点)、学生信息表(重点)、5秒钟之后跳转页面(location.href应用)、学生信息表(页面刷新数据不丢失)(重点)——API练习案例
  15. 订单系统订单表设计方案
  16. qt Type defaults to ‘int‘ in declaration of
  17. Python中的全局变量
  18. CentOS安装教程-解决“Warning:/dev/root does not exist”问题
  19. REACT HOOKS实现离开页面、刷新页面的时候,强制提醒
  20. 如何拖动末端使机器人运动仿真-使用Peter机器人工具箱

热门文章

  1. 桌面图标变成空白页如何处理?
  2. Problem B: 第K位数字
  3. 圆桌问题 二分多重匹配+输出解
  4. KPCA正交KLPP及两者结合改进的特征提取特征降维算法
  5. 促销套路or营销探索?万和周年庆引发的创新思考
  6. 如何在GitHub上搜索
  7. 睿尔曼超轻量仿人机械臂--示教器简介使用
  8. scrapy爬取京东的数据
  9. 通过requests库re库进行淘宝商品爬虫爬取(对中国大学mooc嵩天老师爬虫进行修改)
  10. 论文4:CottonGVD:栽培棉花基因组变异综合数据库