Get coefficients of a polynomial pyomo constraint

Refresh

6 days ago

Views

6 time

1

In addition to the question here I would like to know how to obtain the coefficients of an arbitrary polynomial constraint of a pyomo model. So, for

m= ConcreteModel()
m.x_1 = Var()
m.x_2 = Var()
m.x_3 = Var(within = Integers)
m.x_4 = Var(within = Integers)
m.c= Constraint(expr=2*m.x_1**2 + 5*m.x_1*m.x_2 + m.x_4 <= 2)

I would like to have

coeff[c] = [2, 5, 1].

0 answers