From 356efb1ffef0a6425c787a43a74f5416d3847613 Mon Sep 17 00:00:00 2001 From: David Anthoff Date: Wed, 27 Oct 2021 11:47:57 -0700 Subject: [PATCH] Improve memory efficiency --- src/mcs/montecarlo.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mcs/montecarlo.jl b/src/mcs/montecarlo.jl index 310fe6fc5..809df1a51 100644 --- a/src/mcs/montecarlo.jl +++ b/src/mcs/montecarlo.jl @@ -641,7 +641,10 @@ function Base.run(sim_def::SimulationDef{T}, post_trial_func(sim_inst, trialnum, ntimesteps, tup) end - _store_trial_results(sim_inst, trialnum, scen_name, results_output_dir, streams) + if results_in_memory || results_output_dir!==nothing + _store_trial_results(sim_inst, trialnum, scen_name, results_output_dir, streams) + end + _restore_sim_params!(sim_inst, original_values) counter += 1