Constraint: Sum of all variables to be equal to a given value
AnsweredHello everybody,
I wonder if someone can give me an intuiton on how to define in R the constraint that sets:
sum(all variables x_i) = B
Where B is a know numeric value and the model's only variables are x_i for i=1...N
Thank you!
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 why not try our AI Gurobot?. -
Hi Roger,
You can check this R example for three different ways of adding such a constraint:
You need to define the matrix coefficients - in this case just a row of ones - to model the sum.
Cheers,
Matthias0
Post is closed for comments.
Comments
2 comments