@@ -357,7 +357,7 @@ def _add_QP_column(self, model_name):
357357 new_var = qp .a .add ()
358358 coef_list = [1. ]
359359 constr_list = [qp .sum_one ]
360- target = mip .ref_vars if self .bundling else mip .nonant_vars
360+ target = mip .ref_vars if self .bundling else mip ._mpisppy_data . nonant_vars
361361 for (node , ix ) in qp .eqx .index_set ():
362362 coef_list .append (target [node , ix ].value )
363363 constr_list .append (qp .eqx [node , ix ])
@@ -376,7 +376,7 @@ def _add_QP_column(self, model_name):
376376 solver .remove_constraint (qp .sum_one )
377377 solver .add_constraint (qp .sum_one )
378378
379- target = mip .ref_vars if self .bundling else mip .nonant_vars
379+ target = mip .ref_vars if self .bundling else mip ._mpisppy_data . nonant_vars
380380 for (node , ix ) in qp .eqx .index_set ():
381381 lb , body , ub = qp .eqx [node , ix ].to_bounded_expression ()
382382 body += new_var * target [node , ix ].value
@@ -425,9 +425,9 @@ def _attach_MIP_QP_maps(self):
425425 mip = self .local_subproblems [name ]
426426 qp = self .local_QP_subproblems [name ]
427427
428- mip ._mpisppy_data .mip_to_qp = {id (mip .nonant_vars [key ]): qp .x [key ]
428+ mip ._mpisppy_data .mip_to_qp = {id (mip ._mpisppy_data . nonant_vars [key ]): qp .x [key ]
429429 for key in mip ._mpisppy_model .x_indices }
430- qp ._mpisppy_data .qp_to_mip = {id (qp .x [key ]): mip .nonant_vars [key ]
430+ qp ._mpisppy_data .qp_to_mip = {id (qp .x [key ]): mip ._mpisppy_data . nonant_vars [key ]
431431 for key in mip ._mpisppy_model .x_indices }
432432
433433 def _attach_MIP_vars (self ):
@@ -437,19 +437,19 @@ def _attach_MIP_vars(self):
437437 '''
438438 if (self .bundling ):
439439 for (bundle_name , EF ) in self .local_subproblems .items ():
440- EF .nonant_vars = dict ()
440+ EF ._mpisppy_data . nonant_vars = dict ()
441441 for scenario_name in EF .scen_list :
442442 mip = self .local_scenarios [scenario_name ]
443443 # Non-anticipative variables
444444 nonant_dict = {(scenario_name , ndn , ix ): nonant
445445 for (ndn ,ix ), nonant in mip ._mpisppy_data .nonant_indices .items ()}
446- EF .nonant_vars .update (nonant_dict )
446+ EF ._mpisppy_data . nonant_vars .update (nonant_dict )
447447 # Reference variables are already attached: EF.ref_vars
448448 # indexed by (node_name, index)
449449 self ._attach_nonant_objective (mip )
450450 else :
451451 for (name , mip ) in self .local_scenarios .items ():
452- mip .nonant_vars = mip ._mpisppy_data .nonant_indices
452+ mip ._mpisppy_data . nonant_vars = mip ._mpisppy_data .nonant_indices
453453 self ._attach_nonant_objective (mip )
454454
455455 def _compute_dual_bound (self ):
@@ -491,7 +491,7 @@ def _attach_nonant_objective(self, mip):
491491 repn = generate_standard_repn (obj .expr , compute_values = False , quadratic = False )
492492 if len (repn .nonlinear_vars ) > 0 :
493493 raise ValueError ("FWPH does not support models with nonlinear objective functions" )
494- nonant_var_ids = {id (v ) for v in mip .nonant_vars .values ()}
494+ nonant_var_ids = {id (v ) for v in mip ._mpisppy_data . nonant_vars .values ()}
495495 linear_coefs = []
496496 linear_vars = []
497497 for coef , var in zip (repn .linear_coefs , repn .linear_vars ):
@@ -602,7 +602,7 @@ def _initialize_QP_subproblems(self):
602602 for (name , model ) in self .local_subproblems .items ():
603603 if (self .bundling ):
604604 xr_indices = model .ref_vars .keys ()
605- nonant_indices = model .nonant_vars .keys ()
605+ nonant_indices = model ._mpisppy_data . nonant_vars .keys ()
606606 else :
607607 nonant_indices = model ._mpisppy_data .nonant_indices .keys ()
608608
@@ -637,7 +637,7 @@ def rc_rule(m):
637637 else :
638638 def x_rule (m , node_name , ix ):
639639 return - m .x [node_name , ix ] + m .a [1 ] * \
640- model .nonant_vars [node_name , ix ].value == 0
640+ model ._mpisppy_data . nonant_vars [node_name , ix ].value == 0
641641 def rc_rule (m ):
642642 return - m .recourse_cost + m .a [1 ] * mip_recourse_cost == 0
643643 QP .eqx = pyo .Constraint (nonant_indices , rule = x_rule )
@@ -665,7 +665,7 @@ def _initialize_QP_var_values(self):
665665 qp = self .local_QP_subproblems [name ]
666666
667667 for key in mip ._mpisppy_model .x_indices :
668- qp .x [key ]._value = mip .nonant_vars [key ].value
668+ qp .x [key ]._value = mip ._mpisppy_data . nonant_vars [key ].value
669669 qp .recourse_cost ._value = mip ._mpisppy_data .inner_bound - pyo .value (mip ._mpisppy_model .nonant_obj_part )
670670
671671 # Set the non-anticipative reference variables if we're bundling
@@ -675,11 +675,11 @@ def _initialize_QP_var_values(self):
675675 for (node_name , ix ) in naix :
676676 # Check that non-anticipativity is satisfied
677677 # within the bundle (for debugging)
678- vals = [mip .nonant_vars [scenario_name , node_name , ix ].value
678+ vals = [mip ._mpisppy_data . nonant_vars [scenario_name , node_name , ix ].value
679679 for scenario_name in mip .scen_list ]
680680 assert (max (vals ) - min (vals ) < 1e-7 )
681681 qp .xr [node_name , ix ].set_value (
682- mip .nonant_vars [arb_scenario , node_name , ix ].value )
682+ mip ._mpisppy_data . nonant_vars [arb_scenario , node_name , ix ].value )
683683
684684 def _generate_starting_point (self ):
685685 """ Called after iter 0 to satisfy the condition of equation (17)
@@ -969,7 +969,7 @@ def _swap_nonant_vars_back(self):
969969 # need to overwrite a few methods due to how fwph manages things
970970 def _can_update_best_bound (self ):
971971 for s in self .local_scenarios .values ():
972- for v in s .nonant_vars .values ():
972+ for v in s ._mpisppy_data . nonant_vars .values ():
973973 if v .fixed :
974974 if v not in self ._initial_fixed_varibles :
975975 return False
0 commit comments