简体   繁体   English

导入模型时,SCIP:PySCIPOpt错误

[英]SCIP: PySCIPOpt error when importing Model

`dfg@dfg:~/prog/scipoptsuite-4.0.1/build$ cmake .. -DREADLINE=off -- Build type: Release -- Build shared libraries: ON -- Build type: Release -- LEGACY mode for old compilers: OFF -- Could NOT find IPOPT (missing: IPOPT_LIBRARIES) -- Could NOT find CRITERION (missing: CRITERION_LIBRARY CRITERION_INCLUDE_DIR) -- The following OPTIONAL packages have been found: dfg @ dfg:〜/ prog / scipoptsuite-4.0.1 / build $ cmake .. -DREADLINE = off-构建类型:Release-构建共享库:ON-构建类型:Release-旧编译器的LEGACY模式:关-找不到IPOPT(缺少:IPOPT_LIBRARIES)-找不到CRITERION(缺少:CRITERION_LIBRARY CRITERION_INCLUDE_DIR)-找到了以下可选软件包:

  • ZLIB ZLIB
  • GMP GMP

-- The following REQUIRED packages have been found: -已找到以下必需的软件包:

  • BISON BISON
  • FLEX 柔性
  • SOPLEX SOPLEX
  • SCIP SCIP

-- The following OPTIONAL packages have not been found: -找不到以下可选软件包:

  • IPOPT IPOPT
  • Criterion 标准

-- Configuring done -- Generating done -- Build files have been written to: /home/dfg/prog/scipoptsuite-4.0.1/build` -配置完成-生成完成-构建文件已写入:/ home / dfg / prog / scipoptsuite-4.0.1 / build`

error : libscip.so not found I am trying to run the 'atsp.py' example provided in github but I encountered an error: 错误:找不到libscip.so,我正在尝试运行github中提供的“ atsp.py”示例,但遇到错误:

/home/dfg/thesis/programming/python_envs/scip_env/bin/python3.6 atsp.py
Traceback (most recent call last):
  File "atsp.py", line 10, in <module>
    from pyscipopt import Model, quicksum, multidict
  File "/home/dfg/thesis/programming/python_envs/scip_env/lib/python3.6/site-packages/pyscipopt/__init__.py", line 3, in <module>
    from pyscipopt.scip      import Model
ImportError: /opt/scipoptsuite-4.0.1/lib/libscip.so: undefined symbol: history_length

My machine is Ubuntu 16.04 64 bits with SCIP Optimization 4.0.1 installed in /opt/scipoptsuite-4.0.1 我的机器是Ubuntu 16.04 64位,在/opt/scipoptsuite-4.0.1中安装了SCIP Optimization 4.0.1

I am using a virtualenv Python environment with Python 3.6 and the Python editor Pycharm. 我正在将virtualenv Python环境与Python 3.6和Python编辑器Pycharm一起使用。

I am really stuck. 我真的被困住了。

在此处输入图片说明

I re-installed scipoptsuite with CMake Then make test within scipoptdir works fine. 我用CMake重新安装了scipoptsuite,然后在scipoptdir中进行测试可以正常工作。 I also have the sub-directories lib and include as mentioned at [ https://github.com/SCIP-Interfaces/PySCIPOpt/blob/master/INSTALL.rst] . 我还拥有子目录lib,并包含[ https://github.com/SCIP-Interfaces/PySCIPOpt/blob/master/INSTALL.rst]中提到的内容。 I also run this command make install INSTALLDIR=$SCIPOPTDIR SHARED=true . 我还运行此命令make install INSTALLDIR=$SCIPOPTDIR SHARED=true Then I obtained the following error (scip_env) dfg@dfg:~/thesis/programming/scip-pfd$ python3.6 atsp.py Traceback (most recent call last): File "atsp.py", line 10, in <module> from pyscipopt import Model, quicksum, multidict File "/home/dfg/thesis/programming/python_envs/scip_env/lib/python3.6/site-packages/pyscipopt/__init__.py", line 3, in <module> from pyscipopt.scip import Model ImportError: libscip.so: cannot open shared object file: No such file or directory Do I have to make some link or export a variable ? 然后,我得到以下错误(scip_env) dfg@dfg:~/thesis/programming/scip-pfd$ python3.6 atsp.py Traceback (most recent call last): File "atsp.py", line 10, in <module> from pyscipopt import Model, quicksum, multidict File "/home/dfg/thesis/programming/python_envs/scip_env/lib/python3.6/site-packages/pyscipopt/__init__.py", line 3, in <module> from pyscipopt.scip import Model ImportError: libscip.so: cannot open shared object file: No such file or directory我是否必须进行某些链接或导出变量? Thank You very much ! 非常感谢你 ! Regards 问候

Thank You @mattmillen, I have done what you advised. 谢谢@mattmillen,我已经完成了您的建议。 I have deleted my previous scipsuiteopt then re-install with cmake and readline off. 我已经删除了以前的scipsuiteopt,然后使用cmake重新安装并关闭了readline。 That works fine in command line (scip_env) dfg@dfg:~/thesis/programming/scip-pfd$ python atsp.py Miller-Tucker-Zemlin's model: Optimal value: 330.0 x(1,4) = 1.0 x(2,3) = 1.0 x(3,5) = 1.0 x(4,2) = 1.0 x(5,1) = 1.0 u(5) = 4.0 u(2) = 2.0 在命令行(scip_env) dfg@dfg:~/thesis/programming/scip-pfd$ python atsp.py Miller-Tucker-Zemlin's model: Optimal value: 330.0 x(1,4) = 1.0 x(2,3) = 1.0 x(3,5) = 1.0 x(4,2) = 1.0 x(5,1) = 1.0 u(5) = 4.0 u(2) = 2.0

Moreover, I copied libscip.so located at ./scipoptsuite/build/lib/libscip.so to /usr/local/lib/libscip.so . 此外,我复制libscip.so位于./scipoptsuite/build/lib/libscip.so/usr/local/lib/libscip.so Then that also works with the editor PyCharm :) 然后这也可以与编辑器PyCharm一起使用:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM