Skip to content

Commit b5825e9

Browse files
authored
Merge pull request #3347 from jsiirola/remove-block-suppress-ctypes
Remove the `_suppress_ctypes` attribute from Block
2 parents 115b60d + eb6b898 commit b5825e9

File tree

4 files changed

+0
-22
lines changed

4 files changed

+0
-22
lines changed

pyomo/contrib/cp/interval_var.py

-2
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ def _getitem_when_not_present(self, index):
206206

207207
class ScalarIntervalVar(IntervalVarData, IntervalVar):
208208
def __init__(self, *args, **kwds):
209-
self._suppress_ctypes = set()
210-
211209
IntervalVarData.__init__(self, self)
212210
IntervalVar.__init__(self, *args, **kwds)
213211
self._data[None] = self

pyomo/contrib/piecewise/piecewise_linear_function.py

-2
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,6 @@ class ScalarPiecewiseLinearFunction(
506506
PiecewiseLinearFunctionData, PiecewiseLinearFunction
507507
):
508508
def __init__(self, *args, **kwds):
509-
self._suppress_ctypes = set()
510-
511509
PiecewiseLinearFunctionData.__init__(self, self)
512510
PiecewiseLinearFunction.__init__(self, *args, **kwds)
513511
self._data[None] = self

pyomo/core/base/block.py

-12
Original file line numberDiff line numberDiff line change
@@ -960,13 +960,8 @@ def add_component(self, name, val):
960960
% (name, type(val), self.name, type(getattr(self, name)))
961961
)
962962
#
963-
# Skip the add_component() logic if this is a
964-
# component type that is suppressed.
965-
#
966963
_component = self.parent_component()
967964
_type = val.ctype
968-
if _type in _component._suppress_ctypes:
969-
return
970965
#
971966
# Raise an exception if the component already has a parent.
972967
#
@@ -1048,12 +1043,6 @@ def add_component(self, name, val):
10481043
else:
10491044
self._ctypes[_type] = [_new_idx, _new_idx, 1]
10501045
#
1051-
# Propagate properties to sub-blocks:
1052-
# suppressed ctypes
1053-
#
1054-
if _type is Block:
1055-
val._suppress_ctypes |= _component._suppress_ctypes
1056-
#
10571046
# Error, for disabled support implicit rule names
10581047
#
10591048
if '_rule' in val.__dict__ and val._rule is None:
@@ -2029,7 +2018,6 @@ def __init__(
20292018

20302019
def __init__(self, *args, **kwargs):
20312020
"""Constructor"""
2032-
self._suppress_ctypes = set()
20332021
_rule = kwargs.pop('rule', None)
20342022
_options = kwargs.pop('options', None)
20352023
# As concrete applies to the Block at declaration time, we will

pyomo/gdp/disjunct.py

-6
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,6 @@ def _activate_without_unfixing_indicator(self):
502502

503503
class ScalarDisjunct(DisjunctData, Disjunct):
504504
def __init__(self, *args, **kwds):
505-
## FIXME: This is a HACK to get around a chicken-and-egg issue
506-
## where BlockData creates the indicator_var *before*
507-
## Block.__init__ declares the _defer_construction flag.
508-
self._defer_construction = True
509-
self._suppress_ctypes = set()
510-
511505
DisjunctData.__init__(self, self)
512506
Disjunct.__init__(self, *args, **kwds)
513507
self._data[None] = self

0 commit comments

Comments
 (0)