Skip to content

Commit

Permalink
trying to fix bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
bknueven committed Sep 28, 2023
1 parent deb66a6 commit 4bf7df5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/uc/uc_ef.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

""" UC """
solver_name = sys.argv[1]
scen_count = 3
scen_count = 50
scenario_names = [f"Scenario{i+1}" for i in range(scen_count)]
scenario_creator_kwargs = {"path": f"{scen_count}scenarios_r1/"}
options = {"solver": solver_name}
Expand Down
7 changes: 5 additions & 2 deletions mpisppy/spbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,22 @@ def _verify_nonants(self):
local_nonant_char_array = {}
for k,s in self.local_scenarios.items():
nlens = s._mpisppy_data.nlens
name_offset = 0
if self.bundling:
name_offset = len(s.name)+1
for node in s._mpisppy_node_list:
ndn = node.name
if ndn not in local_nonant_char_array:
local_nonant_char_array[ndn] = {}
for i, var in enumerate(node.nonant_vardata_list):
if i in local_nonant_char_array[ndn]:
if var.name != local_nonant_char_array[ndn][i]:
if var.name[name_offset:] != local_nonant_char_array[ndn][i]:
raise RuntimeError(f"[rank {self.global_rank}] Tree node {ndn} has different non-anticipative "
f"variables in position {i}, scenario {s} has name "
f"{var.name}, some other scenario has name "
f"{local_nonant_char_array[ndn][i]}")
else:
local_nonant_char_array[ndn][i] = var.name
local_nonant_char_array[ndn][i] = var.name[name_offset:]

for ndn, var_names in local_nonant_char_array.items():
a = array.array("u")
Expand Down

0 comments on commit 4bf7df5

Please sign in to comment.