-1

I have installed Cplex (Optimization Studio 12.9.0 - Community Edition) and need to write Python APIs in it.

After installing setup.py as per https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.2/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html?view=embed,

I get error that

DOcplexException: CPLEX runtime not found: please install CPLEX or solve this model on DOcplexcloud

How can i solve this error?

ncica
  • 7,015
  • 1
  • 15
  • 37

1 Answers1

0

Have you set the Python path environment variable PYTHONPATH to the value of yourCplexhome/python/VERSION/PLATFORM?

Or you could try to use docplexcloud. For instance the following example from https://www.ibm.com/developerworks/community/forums/html/topic?id=80146d62-1e2b-490e-b5f8-6fbf38a51e18&ps=25

from docplex.mp.model import Model
from docplex.mp.context import Context

url = "https://api-oaas.docloud.ibmcloud.com/job_manager/rest/v1"
key = "YOUR API KEY"

ctx = Context.make_default_context(url=url, key=key)

mdl = Model(name='buses',context=ctx)
mdl.nbbus40 = mdl.integer_var(name='nbBus40')
mdl.nbbus30 = mdl.integer_var(name='nbBus30')
mdl.add_constraint(mdl.nbbus40*40 + mdl.nbbus30*30 >= 300, 'kids')
mdl.minimize(mdl.nbbus40*500 + mdl.nbbus30*400)

mdl.solve()

print(mdl.nbbus40.solution_value);
print(mdl.nbbus30.solution_value);

This works fine.

halfer
  • 19,824
  • 17
  • 99
  • 186
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
  • Thanks for the reply. I have used Cloud solving and works fine. But need local solutions. I have set the PYTHONPATH. Though this does not appear when I use 'print(os.environ['PYTHONPATH'])'. Which version of anaconda (and so, python) is compatible with CPLEX 12.9.0? Canot find answer to this in https://www.ibm.com/software/reports/compatibility/clarity-reports/report/html/softwareReqsForProduct?deliverableId=0B4041D05CC611E7B14781FC94CC4741&osPlatform=Windows – ShraddhaBG Jul 10 '19 at 13:15
  • With CPLEX 12.9 and the CPLEX Python API, Python 2.7, 3.6, and 3.7 are supported. This can be found in the [detailed system requirements](http://www-01.ibm.com/support/docview.wss?uid=swg27019100). – rkersh Jul 10 '19 at 13:23