How can I make a prod of variable in a constrain?
AnsweredI want to add a constrain like the following, is there any way to do this?
-
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. -
x is a continuous variable from 0 to 1
c is a literal value0 -
Hi,
Gurobi can only handle linear and quadratic constraints. There are ways to add more general constraints that are then reformulated (and potentially approximated).
You wrote that x is a continuous variable, so I do not really understand your notation. Usually, for a product you iterate over some index set. What exactly is the constraints you want to model?
Best regards,
Mario0 -
Hi, Mario
Very appreciate your reply, I konw that Gurobi can only handle linear and quadratic constraints.For my question, I wolud like to model such a constraint:
there are a set of variables {x1, ... , xn}, each is continuous variable from 0.0 to 1.0, but can't be zero
Suppose there is a value c = 0.5, and n = 2.
I want to set the constraint in the picture above. In this case(c = 0.2, n = 2), {x1 = 0.4, x2 = 0.5} would be a key to the question.
Best regards,
Mario
0 -
Hi,
Ok, I understand now. You might be able to handle your product also for $n>2$ by introducing additional variables in the following way:
x_1 * x_2 = y_2
y_2 * x_3 = y_3
...
y_{n-1} * x_n = cBest regards,
Mario0
Post is closed for comments.
Comments
5 comments