Skip to main content

Bitwise operator Python vs Julia

Answered

Comments

4 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.
  • Jaromił Najman
    • 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

    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

Post is closed for comments.