CBC and GLPK Timeout

80 views
Skip to first unread message

Tiberius Gracchus

unread,
Oct 21, 2022, 9:05:30 PM10/21/22
to pypsa
Hi all,
when im using the glpk or the cbc solver without pyomo, I think im getting a Timeout from the solver (with half of the snapshots it works without problems). Is it possible to set the maximum timeout for the solvers over pypsa?
Thank you!
Tiberius

Jonas Blomberg Ghini

unread,
Oct 27, 2022, 3:50:44 AM10/27/22
to pypsa
Hi,

I'm not from the PyPSA team, so take my advice with a grain of salt. 

I think I've seen something similar. FOr relatively large models (many components and/or long optimisation times), I also noticed that the optimisation never finishes, even though the CBC or GLPSOL process loads drop to zero in Task Manager (I'm working in Windows 10).

What I found is that in the function pypsa/linopt/run_and_read_glpk(), the line "result.wait()" just hangs, even after the corresponding subprocess appears to the done as its CPU load drops to zero in Task Manager. My second finding was that if I ran the same problem directly from command line, it worked fine. After this I saw that in the log file produced during the PyPSA call, the file simply stopped updating at some point during the run. It all comes back to stdout (which is set to subprocess.PIPE in the implementation) saturates during the wait. I can't quite remember how I fixed the issue, since I have since upgraded the pypsa package and started using the HiGHS solver, rather than GLPK, and I don't have the hang problem there. But it involves increasing the subprocess bufsize and/or reading the stdout stream to avoid it filling up.

All the best,
Jonas
Reply all
Reply to author
Forward
0 new messages