Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

component_data_objects returns the values of immutable Params #3045

Open
emma58 opened this issue Nov 21, 2023 · 0 comments
Open

component_data_objects returns the values of immutable Params #3045

emma58 opened this issue Nov 21, 2023 · 0 comments
Labels

Comments

@emma58
Copy link
Contributor

emma58 commented Nov 21, 2023

Summary

Calling component_data_objects returns the values of immutable Params. This is scary since that means that it can return things that don't have a ctype. I think it should only return the ParamDatas for mutable Params.

Steps to reproduce the issue

from pyomo.environ import *

m = ConcreteModel()

m.p = Param([1, 2, 3, 4], initialize={1: 1, 2: 1}, mutable=False, default=0)

for thing in m.component_data_objects(active=True, descend_into=True):
    print(thing)

outputs:

p_index
1
1
0
0

Information on your system

Pyomo version: main branch
Python version:
Operating system:
How Pyomo was installed (PyPI, conda, source):
Solver (if applicable):

@emma58 emma58 added the bug label Nov 21, 2023
emma58 added a commit to emma58/pyomo that referenced this issue Dec 11, 2023
…e when I collect components in the docplex writer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant