From bc334eb62ff2b37e7182903ef692b229fd24e3f6 Mon Sep 17 00:00:00 2001 From: David L Woodruff Date: Sun, 29 Dec 2024 10:05:52 -0800 Subject: [PATCH] Repair stoch distr (#475) * the json file name is now on the command line * get the json data file location from the command line --- examples/stoch_distr/stoch_distr_admm_cylinders.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/stoch_distr/stoch_distr_admm_cylinders.py b/examples/stoch_distr/stoch_distr_admm_cylinders.py index 507ecddb..781e734c 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() @@ -40,6 +41,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 +168,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 +211,4 @@ def main(cfg): if __name__ == "__main__": cfg = _parse_args() - main(cfg) \ No newline at end of file + main(cfg)