简体   繁体   English

适用于Python的DOcplex的model.solve()方法不起作用(“找不到CPLEX DLL”)

[英]model.solve() method is not working (“CPLEX DLL not found”) for DOcplex for Python

I build my mathematical model using DOcplex IBM package for Python. 我使用适用于Python的DOcplex IBM软件包构建了数学模型。 I am sure that the other part of the modeling is correct, however when the call to Model.solve() is executed, and I get the following error: 我确定建模的其他部分是正确的,但是当执行对Model.solve()的调用时, Model.solve()以下错误:

"CPLEX DLL not found: please provide DOcplexcloud credentials"

I have CPLEX Studio 12.6 installed on my pc, and I want to solve the problem locally not on cloud. 我的PC上安装了CPLEX Studio 12.6,我想在本地而不是在云上解决问题。

It sounds like you do not have the CPLEX Python API "installed". 听起来您没有“安装” CPLEX Python API。 By default, when you install CPLEX Optimization Studio (aka COS) the Python bindings are copied onto your disk, but they aren't associated with any of your local Python installations. 默认情况下,当您安装CPLEX Optimization Studio(aka COS)时,Python绑定被复制到磁盘上,但是它们与您的任何本地Python安装都不相关。

If you follow the instructions on the Setting up the Python API of CPLEX page, you should be able to do a local solve. 如果按照“ 设置CPLEX的Python API”页面上的说明进行操作,则应该能够进行本地求解。 In short, you can either run the setup.py script under yourCPLEXhome/python/VERSION/PLATFORM , or you can set the PYTHONPATH environment variable. 简而言之,您可以在yourCPLEXhome/python/VERSION/PLATFORM下运行setup.py脚本,也可以设置PYTHONPATH环境变量。

Are you using Anaconda? 您正在使用Anaconda吗? I solved it by running the following in the CPLEX install directory: 我通过在CPLEX安装目录中运行以下命令解决了该问题:

python setup.py install --home <PackagesHome>\cplex

with <PackagesHome> as <user>\\AppData\\Local\\Continuum\\Anaconda2\\Lib\\site-packages 使用<PackagesHome>作为<user>\\AppData\\Local\\Continuum\\Anaconda2\\Lib\\site-packages

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

相关问题 在 Python 中运行 Docplex package “docplex.mp.utils.DOcplexException:无法解决 model:未找到 CPLEX 运行时” - Running Docplex package in Python "docplex.mp.utils.DOcplexException: Cannot solve model: no CPLEX runtime found" Python + CPLEX:没有名为“docplex”的模块 - Python + CPLEX : No module named 'docplex' python - 如何使用pulp在python中不显示任何消息model.solve()? - How to do model.solve() not show any message in python using pulp? Python+ Cplex 错误:没有名为“docplex”的模块 - Python+ Cplex error : No module named 'docplex' Python exe 和 cplex.dll - Python exe and cplex .dll 如何在CPLEX-PYTHON(非docplex)中生成一些可行的解决方案? - How to generate some feasible solutions in CPLEX-PYTHON (Not docplex)? 有没有办法将 cplex 表达式 (docplex.mp.LinearExpr(...)) 提高到 python 中的 -1 或 3 次方? - Is there a way to raise a cplex expression (docplex.mp.LinearExpr(...)) to the power -1 or 3 in python? 由于 Python w/Cplex/Docplex 中的空列“x1”,双重不可行 - Dual infeasible due to empty column 'x1' in Python w/Cplex/Docplex 在 cplex python API 中重置 model - reseting a model in cplex python API 如何使用 DOcplex (python) 向模型添加二次约束? - How to add quadratic constraints to the model by using DOcplex (python)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM