Skip to main content

The solution returned by GUROBI is not optimal

Answered

Comments

3 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.
  • Eli Towle
    • Gurobi Staff

    By default, variables added via Model.addVar() or Model.addVars() have a lower bound of \( 0 \). If the \( Z \) variables are free, you should define them as follows:

    Z = m.addVars(Ind, lb=-GRB.INFINITY, vtype='C', name='Z')

    With this change, the optimal value of \( x \) is around \( 60 \).

    The only other difference I see between the mathematical formulation and your code is that the formulation includes \( p_k \) in the objective function summations, where your code instead uses a single \( \texttt{pro} \) value. Of course, this isn't an issue if all of the \( p_k \) are equal to \( \texttt{pro} \).

    1
  • Hussein Sharadga
    • Gurobi-versary
    • Investigator
    • Conversationalist

    Thank you so much. That fixes the problem!

    Yes, pro is constant as they have a  similar probability.

    0

Post is closed for comments.