Summation if binary variables are set
AnsweredI have an array of binary decision variables and I want to multiply the index of the binary variables that are set to 1 with a constant and sum the multiplication and use that sum as a constraint. Is it possible to do it in Gurobi? Thanks
0
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
I am not sure I understand what you want. Do you mean something like:
Given binary variables \(b_1,\dots,b_n\)
\[\begin{align*}
\sum_{i=1}^n b_i \cdot i \cdot c_i \leq d
\end{align*}\]where \(c_i,d\) are some constants.
0 -
Thanks for replying. Yes, something similar to what you said and I am trying this with the GRBLinExpr. I hope it will work. Thanks0
Post is closed for comments.
Comments
3 comments