Description
Versions: Pyomo: 5.7.3 Python: 3.7.8
This is only relevant for some specific users. One of the main advantages of CPLEXDirect is to avoid temporary files to interact with CPLEX. However, I'm doing some tests and I'm not able to get rid of the temporary creation of a .log file. My work involves solving several series of thousands of small optimization problems in parallel in a computation cluster and the creation of temporary files led to several important failures in the cluster and down times. I suggest that the default behavior avoids the temporary .log creation or at least provide a way to deactivate it.
import pyomo.environ as pe
os.environ['Temp'] = os.getcwd()
model = create_model()
opt = pe.SolverFactory('cplex_direct')
results = opt.solve(model, keepfiles=True)
Tried: logfile='*', logfile=False, logfile=''
I managed to solve the issue overriding the method CPLEXDirect._apply_solver located in cplex_direct.py to avoid the .log related code and adding results = opt.solve(model, logfile=False)
as a workaround to deal with lines 161 and 162 in direct_or_persistent_solver.py
if self._log_file is None:
self._log_file = TempfileManager.create_tempfile(suffix='.log')