Thank you so much for the example. I guess I understand the path of "execfile" should be defined. But I don't know how and where should I define it... sorry for this stupid question. My system is MacOS Big Sur, CPLEX 20 installed successfully, the command for API with Python also works well in Terminal,...docplex is installed. When runing an example in Python, such a mistake happens:
Should I make some changes in "solver_local.py"?
Thank you so much.
------------------------------
Linli Jia
------------------------------
Original Message:
Sent: Mon September 20, 2021 09:29 AM
From: ALEX FLEISCHER
Subject: CpoException: Executable file should be given in 'execfile' context attribute.
Hi,
let me share the bus example with this :
from docplex.cp.model import CpoModelmdl = 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)#call CPLEX 20.1msol=mdl.solve(execfile='C:\\ILOG\\CPLEX_Studio201\\cpoptimizer\\bin\\x64_win64\\cpoptimizer.exe')#call CPLEX 12.10msol=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]
[EMEA CPLEX Optimization Technical Sales]
[IBM]
Original Message:
Sent: Sat September 18, 2021 06:08 PM
From: Linli Jia
Subject: CpoException: Executable file should be given in 'execfile' context attribute.
Hi, Could you please provide more detailed steps for solving this problem? I met the same question, but I'm not sure how to implement the suggestions given above.
------------------------------
Linli Jia
Original Message:
Sent: Thu April 01, 2021 04:38 AM
From: Fabio Vitor
Subject: CpoException: Executable file should be given in 'execfile' context attribute.
Thank you Olivier. This worked.
Best regards.
------------------------------
Fabio Vitor
Original Message:
Sent: Tue March 30, 2021 04:14 AM
From: Olivier Oudot
Subject: CpoException: Executable file should be given in 'execfile' context attribute.
Hello Fabio,
The solve of your model is delegated to a subprocess "cpoptimizer(.exe)" that is created when solve() is called. The name of this process is stored in the configuration attribute 'context.solver.local.execfile' and is searched by default in the system path.
I recommend that you:
- Check that a cpoptimizer executable is actually present on your disk inside the COS installation directory
- Ensure this file is actually visible in your system path
If this does not work, you can try to specify the full path of the executable dynamically inside the solve request, like:
msol = mdl.solve(execfile='<full path of the cpoptimizer executable>')
------------------------------
Olivier Oudot
Original Message:
Sent: Tue March 30, 2021 01:19 AM
From: Fabio Vitor
Subject: CpoException: Executable file should be given in 'execfile' context attribute.
Hello All,
When trying to solve this example on a MacOS Big Sur, I get the following error: CpoException: Executable file should be given in 'execfile' context attribute. More specifically, the error is pointed out to msol = mdl.solve(). When I run the same problem on Windows, everything works just fine. Does anyone have any suggestion to fix this problem? Any help is appreciated. Thank you!
------------------------------
Fabio Vitor
------------------------------
#DecisionOptimization