Open
Description
Summary
The generate_standard_repn function is identifying a nonlinear expr as a linear coefficient in the case that the expression has mutable Param objects initialized to 0 (and with compute_values=False).
If the Params are instead initialized to a non-zero value, then generate_standard_repn works as expected.
Here is an example to reproduce the behavior:
Steps to reproduce the issue
from pyomo.environ import *
from pyomo.repn.standard_repn import generate_standard_repn
m = ConcreteModel()
m.x_0 = Var(initialize=0)
m.p_0 = Param(initialize=0, mutable=True)
m.p_1 = Param(initialize=0, mutable=True)
m.con = Constraint(expr=m.x_0*((m.p_0 + m.x_0*m.p_1)**3) == 0)
val = generate_standard_repn(m.con.body, compute_values=False)
The output is:
val.linear_coefs[0] = (p_0 + p_1*x_0)**3
val.linear_vars[0] = x_0
Whereas I think this should still be considered a nonlinear_expr, even with the 0-value Param coefficients, since the mutable Param values are subject to change.
Information on your system
Pyomo version: 6.0.1
Python version: 3.8
Operating system: CentOS 7
How Pyomo was installed (PyPI, conda, source): source
Solver (if applicable):