Skip to main content

Bitwise operator Python vs Julia

Answered

Comments

3 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    This is more of a Julia Jump related question, so it might be better to ask in a Julia/JuMP forum.

    Nevertheless, you want to formulate constraints of the form "if \(x=1\) then \(u+q=w\)". I don't know whether JuMP supports indicator constraints but you can formulate an indicator constraint "by hand" as described in How do I model conditional statements in Gurobi? I assume that your \(x\) is binary, so you could formulate the conditional statement "if \(x \geq 0.5\) then \(u+q=w\)".

    Moreover, the thread Conditional constraint if else in JuMP might be helpful .

    Best regards, 
    Jaromił

    0
  • Wiktor Wisniewski
    Gurobi-versary
    First Comment
    First Question

    Jaromił Najman thank you for your answer, but ConditionalJump does not support newer version of JuMP, which I need. How exactly that code "by hand" would look like in this case?

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    How exactly that code "by hand" would look like in this case?

    The Knowledge Base article How do I model conditional statements in Gurobi? describes a formulation which you would have to implement in JuMP. In the formulation described in the article, if your \(x\) variable is binary, you can set \(y=0.5\) and set \(\epsilon=0\).

    0

Please sign in to leave a comment.