From 1401c09ffa6d1e6a4e778b47feb1d7b3b04a954d Mon Sep 17 00:00:00 2001 From: David L Woodruff Date: Tue, 13 Aug 2024 10:52:39 -0700 Subject: [PATCH] Update agnostic_cylinders.py add an option and better file names for write solution --- mpisppy/agnostic/agnostic_cylinders.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mpisppy/agnostic/agnostic_cylinders.py b/mpisppy/agnostic/agnostic_cylinders.py index 740d6caad..ca979d69f 100644 --- a/mpisppy/agnostic/agnostic_cylinders.py +++ b/mpisppy/agnostic/agnostic_cylinders.py @@ -41,6 +41,10 @@ def _parse_args(m): domain=str, default=None, argparse=True) + cfg.add_to_config(name="write_solution", + description="send write solution output to a csv, an npv file and a directory with names based on the module", + domain=bool, + default=False) cfg.popular_args() cfg.two_sided_args() cfg.ph_args() @@ -138,10 +142,10 @@ def _parse_args(m): wheel = WheelSpinner(hub_dict, list_of_spoke_dict) wheel.spin() - write_solution = False + write_solution = cfg.write_solution if write_solution: - wheel.write_first_stage_solution('farmer_plant.csv') - wheel.write_first_stage_solution('farmer_cyl_nonants.npy', + wheel.write_first_stage_solution(f'{module_fname}.csv') + wheel.write_first_stage_solution(f'{module_fname}.npy', first_stage_solution_writer=sputils.first_stage_nonant_npy_serializer) - wheel.write_tree_solution('farmer_full_solution') + wheel.write_tree_solution(f'{module_fname}_solution')