Skip to main content

How can I make a prod of variable in a constrain?

Answered

Comments

5 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    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.
  • chenyang zhao
    • Gurobi-versary
    • First Question
    • First Comment

    x is a continuous variable from 0 to 1
    c is a literal value

    0
  • Mario Ruthmair
    • Gurobi Staff

    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,
    Mario

    0
  • chenyang zhao
    • Gurobi-versary
    • First Question
    • First Comment

    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
  • Mario Ruthmair
    • Gurobi Staff

    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 = c

    Best regards,
    Mario

    0

Post is closed for comments.