Before I use Glpk to solve the abstract model but since Glpk might be slower than Cplex I turn to Cplex. But After I installed the Cplex and used it as a solver, I found that the Cplex can't open the logfile Pyomo create:
CPLEX> CPLEX Error 1422: Could not open file 'C:\Users\???\AppData\Local\Temp\tmp6u0194_4.cplex.log' for writing.
Could not open logfile -- please try another name.
Name of new logfile ('*' to close present file): Logfile 'read' open.
CPLEX> No problem exists.
CPLEX> No problem exists.
CPLEX> No problem exists.
CPLEX> Complete!
The above is what I got from tee=true
The Path contains Chinese letter so I'm not sure if it matters. If so, can I change the default path of the logfile Pyomo create?
Thanks,
Xuan
The issue here is that Pyomo is writing the *.lp
CPLEX input file in a location with non-alphanumeric characters in the path name. The CPLEX invocation fails because of the path name, producing the reported error messages.
To correct the issue, a different temporary directory must be set. One way to do so is to do the following before the SolverFactory('cplex').solve(model)
call:
import pyutilib.services
pyutilib.services.TempfileManager.tempdir = 'C:\user_writable_path'
This is similar to the issue addressed in https://github.com/Pyomo/pyomo/pull/485.