Pyomo / pyomo

An object-oriented algebraic modeling language in Python for structured optimization problems.
https://www.pyomo.org
Other
1.98k stars 509 forks source link

Review logic/expectations for management of named expressions #416

Closed whart222 closed 8 months ago

whart222 commented 6 years ago

Using Pyomo5 expressions, the named expression objects are the only sub-expressions that are mutable. This form of mutability explicitly represents user expectations that these sub-expressions can change after being used to form an expression tree.

There are two contexts where the implication of this mutability are not clear:

  1. Replacing a terms in an expression with a walker: If we descend into a named expression and replace terms there, then is that named expression replaced in the original expression or preserved?

  2. Cloning an expression: When cloning an expression, when we clone a sub-expression that is a named expression, do we create separate clones for that expression object, or replace the named expression itself? If the latter, then how do we manage those cloned named expressions in the model?

mrmundt commented 8 months ago

In an effort to clean up old issues, we are moving some design discussions to our Archived Design Discussions wiki.