Skip to main content

How to add a binary variable without objective value using the Java API

Answered

Comments

2 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

    Hi Michael,

    You can set the obj argument value to 0. Then, the variable will not be added to the objective function. Note that 0 is the default value for the obj argument in the addVar Python method, that is why it is not necessary to explicitly set it.

    PPS: How do I format Math equations on this forum?

    This is explained in Posting to the Community Forum. You can either use \(\texttt{\\( \\)}\) or \(\texttt{\[ \]}\) to enclose math code.

    Best regards, 
    Jaromił

    0

Post is closed for comments.