0

I am installing docplex using pip install docplex and it shows:

Successfully installed docplex-2.22.213

When I run the code it says:

- CP Optimizer 12.10.0.0 -

But since the latest ILOG CPLEX Optimization Studio is 20.1 I would expect to see CP Optimizer 20.1.

What is the reason for pip not installing the latest version?

  • OS : macOS Big Sur version 11.2
  • Python : 3.7.3
S.Perera
  • 874
  • 3
  • 9
  • 24
  • It doesn't really install the solver-suite, right (["Solving with CPLEX locally requires that IBM ILOG CPLEX Optimization Studio V12.8 or later is installed on your machine."](https://pypi.org/project/docplex/#description))? I guess, you either did only install 12.10, or it's not picking up the right path (when it could chose). If 20.1 is installed, you will find the python package installers in it's distribution-directories and installing it right from *there* (shell or such) should be safe in regards being *linked* to the right version. (Assuming, that cplex=cplex(mp) + cpopt irt. the quote) – sascha Sep 27 '21 at 22:42
  • 1
    To complement Sascha's answer: docplex is a modeling layer, it does not include the runtimes (CPLEX and CPO) . Runtimes have to be installed and linked to Docplex to run the algorithms. – Philippe Couronne Sep 28 '21 at 08:21

1 Answers1

1

In the solve you can select which version of cplex you want to call on your machine.

Let me show this with the zoo example:

from docplex.cp.model import CpoModel

mdl = CpoModel(name='buses')
nbbus40 = mdl.integer_var(0,1000,name='nbBus40')
nbbus30 = mdl.integer_var(0,1000,name='nbBus30')
mdl.add(nbbus40*40 + nbbus30*30 >= 300)
mdl.minimize(nbbus40*500 + nbbus30*400)

msol=mdl.solve(execfile='C:\\ILOG\\CPLEX_Studio201\\cpoptimizer\\bin\\x64_win64\\cpoptimizer.exe')
msol=mdl.solve(execfile='C:\\ILOG\\CPLEX_Studio1210\\cpoptimizer\\bin\\x64_win64\\cpoptimizer.exe')

print(msol[nbbus40]," buses 40 seats")
print(msol[nbbus30]," buses 30 seats") 
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15