Pyomo / pyomo

An object-oriented algebraic modeling language in Python for structured optimization problems.
https://www.pyomo.org
Other
1.92k stars 494 forks source link

Allow tempdir as argument to SolverFactory.solve() #271

Closed milindsmart closed 3 years ago

milindsmart commented 6 years ago

I am using GLPK from Pyomo via Python scripting (not shell commandline). I am unable to choose temporary directory except via an obscure page with much hunting.

The relevant lines that set the temporary directory are below... no keywords are checked before choosing a random temp directory

https://github.com/Pyomo/pyomo/blob/2e7451bdb378af6f81ac5068282d63c0bb22dd3d/pyomo/solvers/plugins/solvers/GLPK.py#L176

I think it would be better if it just did the same thing as logfile : if None, then call upon TempfileManager

milindsmart commented 3 years ago

I was mistaken, this is consistent with all the other solvers. This was merely my unfamiliarity with the action-at-a-distance nature of pyutilib.services.TempfileManager. In fact the GAMS solver seems to work (https://github.com/Pyomo/pyomo/commit/5260843d27b5d84ee99e762dcb6fcb559369d81b#diff-57d29055661aa2c2bc984f259916798d17f015ba0a3930e69aa97c459b72f33f from https://github.com/Pyomo/pyomo/pull/164) in the manner I have suggested here, and it is confusing because the TempfileManager method isn't working. Karma I guess.

blnicho commented 3 years ago

@milindsmart can this be closed then or are you still suggesting changes in temp file management?

milindsmart commented 3 years ago

I will close this, I am planning to open a different but related issue for the GAMS solver.