Skip to content

Commit

Permalink
Merge pull request #3347 from jsiirola/remove-block-suppress-ctypes
Browse files Browse the repository at this point in the history
Remove the `_suppress_ctypes` attribute from Block
  • Loading branch information
mrmundt authored Aug 14, 2024
2 parents 115b60d + eb6b898 commit b5825e9
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 22 deletions.
2 changes: 0 additions & 2 deletions pyomo/contrib/cp/interval_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ def _getitem_when_not_present(self, index):

class ScalarIntervalVar(IntervalVarData, IntervalVar):
def __init__(self, *args, **kwds):
self._suppress_ctypes = set()

IntervalVarData.__init__(self, self)
IntervalVar.__init__(self, *args, **kwds)
self._data[None] = self
Expand Down
2 changes: 0 additions & 2 deletions pyomo/contrib/piecewise/piecewise_linear_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,6 @@ class ScalarPiecewiseLinearFunction(
PiecewiseLinearFunctionData, PiecewiseLinearFunction
):
def __init__(self, *args, **kwds):
self._suppress_ctypes = set()

PiecewiseLinearFunctionData.__init__(self, self)
PiecewiseLinearFunction.__init__(self, *args, **kwds)
self._data[None] = self
Expand Down
12 changes: 0 additions & 12 deletions pyomo/core/base/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,13 +960,8 @@ def add_component(self, name, val):
% (name, type(val), self.name, type(getattr(self, name)))
)
#
# Skip the add_component() logic if this is a
# component type that is suppressed.
#
_component = self.parent_component()
_type = val.ctype
if _type in _component._suppress_ctypes:
return
#
# Raise an exception if the component already has a parent.
#
Expand Down Expand Up @@ -1048,12 +1043,6 @@ def add_component(self, name, val):
else:
self._ctypes[_type] = [_new_idx, _new_idx, 1]
#
# Propagate properties to sub-blocks:
# suppressed ctypes
#
if _type is Block:
val._suppress_ctypes |= _component._suppress_ctypes
#
# Error, for disabled support implicit rule names
#
if '_rule' in val.__dict__ and val._rule is None:
Expand Down Expand Up @@ -2029,7 +2018,6 @@ def __init__(

def __init__(self, *args, **kwargs):
"""Constructor"""
self._suppress_ctypes = set()
_rule = kwargs.pop('rule', None)
_options = kwargs.pop('options', None)
# As concrete applies to the Block at declaration time, we will
Expand Down
6 changes: 0 additions & 6 deletions pyomo/gdp/disjunct.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,6 @@ def _activate_without_unfixing_indicator(self):

class ScalarDisjunct(DisjunctData, Disjunct):
def __init__(self, *args, **kwds):
## FIXME: This is a HACK to get around a chicken-and-egg issue
## where BlockData creates the indicator_var *before*
## Block.__init__ declares the _defer_construction flag.
self._defer_construction = True
self._suppress_ctypes = set()

DisjunctData.__init__(self, self)
Disjunct.__init__(self, *args, **kwds)
self._data[None] = self
Expand Down

0 comments on commit b5825e9

Please sign in to comment.