Skip to main content

Question about model.AddGenConstrIndicator()

Answered

Comments

4 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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.
  • Maliheh Aramon
    • Gurobi Staff

    What is debated is whether the value will be set based on the linear expression in the function argument.  

    I am not sure what you mean by the function argument.

    If I understand you correctly, your assessment is true. As you mentioned, the values of variables \(b\) enforce restrictions on the values of variables \(\mbox{gap}\). For example, it is still possible for the \(b\) variable  to be 1 and the \(\mbox{gap}\) variable to be 0 where \(\mbox{gap_value}\) equals \(\mbox{target1_value}\).

    Best regards, 

    Maliheh

    0
  • Dillon Flannery-Valadez
    • Gurobi-versary
    • First Question
    • First Comment

    Hi Maliheh, what I meant by function argument was the linear expression argument in AddGenConstrIndicator, whether the gap is positive or not. The debate was whether gap being positive enforced b == 1. But my view was the other way around, as I believe the documentation supports. b== 1 enforces the linear constraint. This also appears to be what you previous comment says as well. 

     

    The intended purpose of the constraints was to impose the constraint with a positive gap, and not impose them with a negative or 0 gap. But as  implemented I do not believe they are doing this. 

    0
  • Maliheh Aramon
    • Gurobi Staff

    What you have implemented is if \(b = 1\), then \(\mbox{gap} = \mbox{gap_value} - \mbox{target1_value}\).

    Given the lower bound of 0 for the variable \(\mbox{gap_value}\), the variable \(\mbox{gap}\) is enforced to be between \(-\mbox{target1_value}\) and \(\infty\). If the \(\mbox{target1_value}\) is a positive constant, it means that the \(\mbox{gap}\) variable is not forced to be strictly positive. You would need additional constraints to enforce if \(b = 1\), then \(\mbox{gap} \geq \epsilon\) with \(\epsilon\) being the smallest positive meaningful value for the \(\mbox{gap}\) variable.

    0

Post is closed for comments.