Description
As operating on blocks where the variables used in the block are defined elsewhere becomes normal, I think the semantics of many operations becomes ambiguous. Should the function operate only on variables found within the tree defined by the block, or should the function operate on all variables used in active components on the block? For some functions/operations, only one will make sense. However, there will be many cases where the desired behavior is ambiguous. I think we should start encouraging users and developers to think about this distinction. To make this distinction clear, I propose we deprecate the use of component_data_objects
and define separate API for these two cases. I propose blocks have a method called children_component_data
which only returns objects found somewhere in the current tree. I propose blocks have a separate method for collecting non-active components used in active components. I'm not sure what the name should be. Maybe we could just start with identify_variables
, identify_mutable_params
, and identify_named_expressions
.
My primary concern is that people write models and then expect to operate on sub-blocks. When a user hands a sub-block to a function, that function may not behave correctly because it assumes all variables are defined on the block and can be accessed through component_data_objects
. My hope is that deprecating component_data_objects
will force Pyomo-based functions to start accounting for this.