Skip to main content

The solution returned by GUROBI is not optimal

Answered

Comments

2 comments

  • Eli Towle
    Gurobi Staff 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
    Conversationalist
    Curious

    Thank you so much. That fixes the problem!

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

    0

Please sign in to leave a comment.