Skip to content

Commit bc334eb

Browse files
authored
Repair stoch distr (#475)
* the json file name is now on the command line * get the json data file location from the command line
1 parent b1e968c commit bc334eb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/stoch_distr/stoch_distr_admm_cylinders.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
write_solution = False
2525

26+
2627
def _parse_args():
2728
# create a config object and parse
2829
cfg = config.Config()
@@ -40,6 +41,10 @@ def _parse_args():
4041
description="Run with async projective hedging instead of progressive hedging",
4142
domain=bool,
4243
default=False)
44+
cfg.add_to_config("json_file_path",
45+
description="JSON file with the data paramaters (default ../distr/data_params.json)",
46+
domain=str,
47+
default="../distr/data_params.json")
4348

4449
cfg.parse_command_line("stoch_distr_admm_cylinders")
4550
return cfg
@@ -163,7 +168,7 @@ def main(cfg):
163168

164169
if cfg.scalable:
165170
import json
166-
json_file_path = "../distr/data_params.json"
171+
json_file_path = cfg.json_file_path
167172

168173
# Read the JSON file
169174
with open(json_file_path, 'r') as file:
@@ -206,4 +211,4 @@ def main(cfg):
206211

207212
if __name__ == "__main__":
208213
cfg = _parse_args()
209-
main(cfg)
214+
main(cfg)

0 commit comments

Comments
 (0)