# invalid expression to quad expr multiplication

I am trying to optimize a model, but it always result with an error of "invalid expression to quad expr multiplication", mentioning this line of code:

obj2= obj2 + (1 - z[k-1,i,c]) * z[k,i,c] * ((e[k,i] - Edod) / Ebat) + z[k-1,i,c] * (1 - z[k,i,c]) * ((Emax - e[k,i]) / Ebat)

I know that I cannot multiply 3 variables in Gurobi! But what to do in this case?

By the way, I tried to break the equation into multiple equations with 2 variables in each one of them, but the problem still available!

Any solution?

Please sign in to leave a comment.

## Comments

1 comment