Skip to content

Commit efff3cf

Browse files
committed
Reduce memory use for Python solver-io
1 parent 1f54be2 commit efff3cf

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, _ArgumentParser, StepTimer, make_iterable, LogOutput, warn, query_yes_no, create_info_file,
@@ -186,6 +188,7 @@ def debug(type, value, tb):
186188
# (repeated if model is reloaded, to automatically run any new export code)
187189
if not instance.options.no_post_solve:
188190
if instance.options.verbose:
191+
timer.step_time()
189192
print("Executing post solve functions...")
190193
instance.post_solve()
191194
if instance.options.verbose:
@@ -749,6 +752,7 @@ def solve(model):
749752
keepfiles=model.options.keepfiles,
750753
tee=model.options.tee,
751754
symbolic_solver_labels=model.options.symbolic_solver_labels,
755+
save_results=model.options.save_solution if isinstance(solver, DirectOrPersistentSolver) else None,
752756
)
753757

754758
if model.options.warm_start is not None:

0 commit comments

Comments
 (0)