1

I want to use docplex to solve a MIP model locally but error.

mdl = Model('name', agent='local')

docplex.mp.utils.DOcplexException: No CPLEX DLL and no DOcplexcloud credentials: model cannot be solved!

my python version is 3.6.6, the version of docplex is 2.8.125, CPLEX is 12.8(academics) and I use Pycharm to run code.

setup.py has been run successfully with python setup.py install.

I also use <cosdir>/<cplexdir>/python/<python_version>/<platform> to my PYTHONPATH with

sys.path.append(r'C:\ProgramFiles\IBM\ILOG\CPLEX_Studio_Community128\cplex\python\3.6\x64_win64') in Pycharm.

but they seem to be useless, is there any wrong in my operation?

1 Answers1

1

I have done this. First, mdl = Model('name', agent='local') is wrong, replace with solution = model.solver(agent='local'), this code is to force solve locally.

if prcharm's venc is unuseful, you can choose original python as interpreter. and open terminal in pycharm or add your cplex python api into pythonpath. In cmd run python setup.py install

in this way, in your cplex->python->win64 file (there are only cplex and setup.py originally), will have a new file named build.

if you want to check whether solver is local or not you can use `

solution = model.solver(agent='local')` 
print(solution.solved_by)

will print cplex_local or in cloud

and in the last, i find that maybe docplex is firstly call CPLEX python API and then call CPLEX, rather than directly call CPLEX.

I am a freshbird, hope you can get some useful things.

Hope IBM could continue to improve DOcplex, don't cut that, I don't want to change tools, lol.