From f9de2cb58eaa53eb638bae7a495df93ca3a44c13 Mon Sep 17 00:00:00 2001 From: "David L. Woodruff" Date: Sun, 29 Dec 2024 09:54:23 -0800 Subject: [PATCH 1/2] the json file name is now on the command line --- examples/stoch_distr/stoch_distr_admm_cylinders.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/stoch_distr/stoch_distr_admm_cylinders.py b/examples/stoch_distr/stoch_distr_admm_cylinders.py index 507ecddbb..490446faa 100644 --- a/examples/stoch_distr/stoch_distr_admm_cylinders.py +++ b/examples/stoch_distr/stoch_distr_admm_cylinders.py @@ -40,6 +40,10 @@ def _parse_args(): description="Run with async projective hedging instead of progressive hedging", domain=bool, default=False) + cfg.add_to_config("json_file_path", + description="JSON file with the data paramaters (default ../distr/data_params.json)", + domain=str, + default="../distr/data_params.json") cfg.parse_command_line("stoch_distr_admm_cylinders") return cfg @@ -163,7 +167,7 @@ def main(cfg): if cfg.scalable: import json - json_file_path = "../distr/data_params.json" + json_file_path = cfg.json_file_path # Read the JSON file with open(json_file_path, 'r') as file: @@ -206,4 +210,4 @@ def main(cfg): if __name__ == "__main__": cfg = _parse_args() - main(cfg) \ No newline at end of file + main(cfg) From e31b94a1b30d76ba0d6a7f1c485e730ba7d8ac96 Mon Sep 17 00:00:00 2001 From: "David L. Woodruff" Date: Sun, 29 Dec 2024 09:57:07 -0800 Subject: [PATCH 2/2] get the json data file location from the command line --- examples/stoch_distr/stoch_distr_admm_cylinders.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/stoch_distr/stoch_distr_admm_cylinders.py b/examples/stoch_distr/stoch_distr_admm_cylinders.py index 490446faa..781e734ce 100644 --- a/examples/stoch_distr/stoch_distr_admm_cylinders.py +++ b/examples/stoch_distr/stoch_distr_admm_cylinders.py @@ -23,6 +23,7 @@ write_solution = False + def _parse_args(): # create a config object and parse cfg = config.Config()