Recursion error generating standard_repn on large linear expressions
The following code generates a large, imbalanced expression tree in Pyomo:
def o_rule(model):
e = 0
for i in range(N):
e = model.v[i]*model.x[i] - e
return e
model.o = Objective(rule=o_rule)
When Pyomo tries to generate the canonical representation of this model, Python throws a recursion error.
How large does N need to be?
I had problems with N=50000
BWOM: We looked at this issue during the dev call on 2/25/2025 and we should be able to resolve this by replacing standard_repn with the new quadratic_repn. Still need to double check if parameterized_quadratic_repn fully supports the "compute_value" functionality in standard_repn. (See: https://github.com/Pyomo/pyomo/blob/main/pyomo/repn/parameterized_quadratic.py)