sol file from solver --- how to specify write location

1,311 views
Skip to first unread message

acastillo

unread,
Nov 10, 2014, 2:27:35 PM11/10/14
to pyomo...@googlegroups.com
Hi,

Against my better judgment I went ahead and updated my mac OS X to 10.9.5 and a lot of permissions and functionalities no longer worked after the update.

I've been able to fix most of the issues; however I noticed that the output files from the solver no longer writes to the temporary folder.

For example, typically when I run CPLEX with tee=True, I get the output to console and a message like:

CPLEX> Solution written to file '/var/folders/1d/qr0jd76n47nbpv5whr6tyy1c0000gn/T/tmpEXBEA9.cplex.sol'.

However when I look inside this folder, I can't find the 'tmpEXBEA9.cplex.sol' file. 

Alternatively, I've tried changing the permissions of the folder as well as changing the user that I'm calling python from. This did not work.


My question is: Is there any way to specify where the solver output files (i.e. *.sol, *.lp, *.log, etc.) are written to? -- Is this a pyomo specification or solver-dependent option?


Thanks, Anya



Watson, Jean-Paul

unread,
Nov 12, 2014, 10:33:26 PM11/12/14
to pyomo...@googlegroups.com
That was brave of you – I haven’t made the shift myself. But to answer your question…

Pyomo does still write the files to the location indicated. However, by default, it also cleans up after itself – the files are released once the solver plugin completes the solve. If you’d like to keep the solution files and stare at them, you can add (I think – going by memory) the option “keepFiles=True” to the solve() invocation. This just prevents them from being cleaned up. 

jpw

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gabriel Hackebeil

unread,
Nov 12, 2014, 10:41:21 PM11/12/14
to pyomo...@googlegroups.com
Minor correction, but I think it is actually “keepfiles” (lower case “f”).

Gabe

Bryan Arguello

unread,
Jun 26, 2017, 5:59:22 PM6/26/17
to Pyomo Forum
I am looking for the answer to this question, but I don't think it was completely answered here.

"keepfiles = True" tells pyomo not to delete the solver output files, but is there a way to tell Pyomo where to put them?

-Bryan

Watson, Jean-Paul

unread,
Jun 26, 2017, 6:04:36 PM6/26/17
to pyomo...@googlegroups.com
You can set the TMPDIR environment variable, which will at least let you control where the temporary files are written - but it doesn't give you control over the names of those files.

Jpw

Gabriel Hackebeil

unread,
Jun 26, 2017, 6:18:16 PM6/26/17
to Pyomo Forum
Also, you can control where the log file is written by passing “logfile=<name>” to the solve method (in which case you don’t need to set keepfiles=True for that file to not be deleted). It’s probably worth opening a ticket to extend this to work with the solution file.

Also, if you set keepfiles to True, you can find the name of the solution file on the ._soln_file attribute after the solve.

Gabe

Bryan Arguello

unread,
Jun 26, 2017, 6:47:06 PM6/26/17
to Pyomo Forum
Thanks JP and Gabe,

I can get by with the logfile attribute for now. I opened an issue to extend for .sol and .lp as well

-Bryan

Watson, Jean-Paul

unread,
Jun 26, 2017, 6:52:36 PM6/26/17
to pyomo...@googlegroups.com
Excellent suggestion.

Jpw

Sent from my iPad

Hussain Kharodawala

unread,
Dec 19, 2019, 12:23:42 PM12/19/19
to Pyomo Forum
._soln_file is an attribute of what object in pyomo?
 

Reply all
Reply to author
Forward
0 new messages