Skip to content

Commit

Permalink
Merge branch 'main' into rc_fixer_logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bknueven authored Nov 20, 2024
2 parents 228de08 + bebb973 commit 6c3b9fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mpisppy/cylinders/spoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import os
import math


from pyomo.environ import ComponentMap, Var
from mpisppy import MPI
from mpisppy.cylinders.spcommunicator import SPCommunicator, communicator_array
Expand Down Expand Up @@ -100,7 +99,8 @@ def spoke_from_hub(self, values):
window.Get((values, len(values), MPI.DOUBLE), 0)
window.Unlock(0)

new_id = int(values[-1])
# On rare occasions a NaN is seen...
new_id = int(values[-1]) if not math.isnan(values[-1]) else 0
local_val = np.array((new_id,-new_id), 'i')
max_min_ids = np.zeros(2, 'i')
self.cylinder_comm.Allreduce((local_val, MPI.INT),
Expand Down
4 changes: 4 additions & 0 deletions mpisppy/opt/presolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ def presolve(self):
print(
f"Tightening bounds on nonant {var.name} in scenario {k} from {var.bounds} to {(lb, ub)} based on global bound information."
)
if np.isnan(lb):
lb = None
if np.isnan(ub):
ub = None
var.bounds = (lb, ub)

# Now do FBBT
Expand Down
4 changes: 3 additions & 1 deletion mpisppy/spbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,9 @@ def report_var_values_at_rank0(self, header="", print_zero_prob_values=False, fi

if len(header) != 0:
print(header)

if len(var_values) == 0:
print("No variables to report (perhaps all are fixed?)")
return
scenario_names = sorted(set(x for (x,y) in var_values))
max_scenario_name_len = max(len(s) for s in scenario_names)
variable_names = sorted(set(y for (x,y) in var_values))
Expand Down

0 comments on commit 6c3b9fb

Please sign in to comment.