How to get rid of the error: "MethodError: no method matching optimize!(::AffExpr)"

Hello everyone!
I urgently need some help with this code. I am getting the error “MethodError: no method matching optimize!(::AffExpr)”, and I can’t understand why it appears. I am not proficient with programming and need to write this code for my university project. Please help me.

“the code was deleted for copyright reasons”

maybe add return model at the end of your function


Oh my God, it seems that it works.
Thank you! I didn’t even think in this direction.

1 Like