Skip to content

Commit f0f3f69

Browse files
committed
Reduce memory use for Python solver-io
1 parent 555295b commit f0f3f69

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

switch_model/solve.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import sys, os, shlex, re, inspect, textwrap, types, pickle, traceback, gc
1212
import warnings
1313

14+
from pyomo.solvers.plugins.solvers.direct_or_persistent_solver import DirectOrPersistentSolver
15+
1416
import switch_model
1517
from switch_model.utilities import (
1618
create_model,
@@ -217,6 +219,7 @@ def debug(type, value, tb):
217219
# (repeated if model is reloaded, to automatically run any new export code)
218220
if not instance.options.no_post_solve:
219221
if instance.options.verbose:
222+
timer.step_time()
220223
print("Executing post solve functions...")
221224
instance.post_solve()
222225
if instance.options.verbose:
@@ -921,6 +924,7 @@ def solve(model):
921924
keepfiles=model.options.keepfiles,
922925
tee=model.options.tee,
923926
symbolic_solver_labels=model.options.symbolic_solver_labels,
927+
save_results=model.options.save_solution if isinstance(solver, DirectOrPersistentSolver) else None,
924928
)
925929

926930
if model.options.warm_start is not None:

0 commit comments

Comments
 (0)