CPLEX错误1016:推广版,使用学术版CPLEX

2024-06-25 22:43:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我将python与clpex一起使用,当我完成模型时,我运行程序,它会抛出以下错误:

CplexSolverError:CPLEX错误1016:促销版本。超出问题大小限制。在

我已经安装了IBM学术CPLEX,如何让python识别这个而不是推广版本?在


Tags: 模型程序版本错误ibm学术cplexcplexsolvererror
3条回答

正如另一个答案中建议的那样,您可以使用PYTHONPATH环境变量。另一种选择是在免费“社区版”的顶部安装学术版的cplex。这对您的系统Python或virtualenv都是有效的。例如,可以执行以下操作:

$ cd <COSDIR>/cplex/python/2.7/<platform>/
$ pip install .
Processing /home/rkersh/opt/CPLEX_Studio128/cplex/python/2.7/x86-64_linux
Building wheels for collected packages: cplex
  Running setup.py bdist_wheel for cplex ... done
  Stored in directory: /home/rkersh/.cache/pip/wheels/88/19/c6/6545d3d5ac65b18b796b44986272e17f3a8429df7b12472624
Successfully built cplex
Installing collected packages: cplex
  Found existing installation: cplex 12.8.0.1
    Uninstalling cplex-12.8.0.1:
      Successfully uninstalled cplex-12.8.0.1
Successfully installed cplex-12.8.0.0

对于第一个命令,COSDIR是安装CPLEX Optimization Studio的位置,platform类似于x86-64_linuxx64_win64x86-64_osx等等。在上面的示例中,您可以看到COSDIR是{},而{}是{}。完成此操作后,不应再获得CPXERR_RESTRICTED_VERSION。在

https://www.ibm.com/support/knowledgecenter/SSSA5P_12.7.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html

Setting the environment variable PYTHONPATH

If you run multiple versions of CPLEX side-by-side, then use this way of declaring the location of CPLEX and its Python API to your Python installation by means of the environment variable PYTHONPATH.

To start using the CPLEX Python API, set the Python path environment variable PYTHONPATH to the value of yourCplexhome/python/VERSION/PLATFORM. Setting this environment variable enables that version of Python to find the CPLEX modules that it needs to run Python commands and scripts that use the CPLEX Python API.

您可以转到安装CPLEX的方向。例如,D:\Cplex 之后,您将看到一个文件夹名cplex,然后单击该文件夹,>;python>;选择python的版本(例如:3.6),然后选择文件夹x64\u win64,您将看到另一个文件名cplex。 将此文件复制到python站点包^^中,就不会受到限制

相关问题 更多 >