IBMDecisionOptimization / docplex-examples

These samples demonstrate how to use the DOcplex library to model and solve optimization problems.
https://ibmdecisionoptimization.github.io/
Apache License 2.0
392 stars 228 forks source link

docplex.mp.utils.DOcplexException: Cannot solve model: no CPLEX runtime found. #61

Closed lu3e closed 2 years ago

lu3e commented 2 years ago

Hi

This is the first time I use github.

I am trying to follow the example in this page

but I cannot get the output correctly and got an error message of docplex.mp.utils.DOcplexException: Cannot solve model: no CPLEX runtime found.

and

-- cannot find parameters matching version: , using: 20.1.0.0

additional info: I use pycharm and the python version is 3.8

Can anyone else please pinpoint the misstep I took? thanks

Regards Louis

vberaudi commented 2 years ago

Hello, you need to have a CPLEX runtime in the PYTHONPATH. It should be something like CPLEX_Studio201/cplex/python/3.8/x86-64_osx (check your cplex version and platform). or use the setup.py to copy it in your python libraries.

lu3e commented 2 years ago

Thanks vberaudi. i found that it requires me to install cplex also but not just docplex. it successes now. indeed, what are the differences between them?

vberaudi commented 2 years ago

The CPLEX module contains the engine written in C which solves the model written via arrays of coefficients, values, indexes. It also contains a python layer also "matrix oriented" in the sense that you create also the model via lists of coefs, values, indexes to define the matrix. The docplex is a pure modeling layer where you "write" constraints with mathematical operators, aggregated sums, ... relying on the previous module and hiding all those lists. It offers an easier way to manipulate a model, its solution, interact with the engine...

lu3e commented 2 years ago

thanks for the clarification. i will close this thread as well.