Skip to main content

Problem on Optimized Parameters are 0

Answered

Comments

5 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Annie,

    Posting screenshots of your code makes it very hard to provide help because one cannot copy and paste your code. If you would like to share big chunks of code, it is best to upload the files somewhere. Note that uploading files in the Community Forum is not possible but we discuss an alternative in Posting to the Community Forum.

    Do you have a feasible solution at hand, i.e., a solution that you know has to be feasible for your model and does not set all variable to \(0\)? If yes, then you should try fixing the variable bounds to the respective value which you think should provide a feasible solution. If the model then gets infeasible, you can try to find out what is going wrong as discussed in the Knowledge Base article How do I determine why my model is infeasible?

    Best regards, 
    Jaromił

    0
  • Annie Shi
    First Comment
    First Question

    Hello Jaromil,

    Thank you for the reply. Here is the Google Drive link to the Colab that contains the code.https://drive.google.com/file/d/1GDLDQaZp8cBuI-HH7XFEHggX8DUWqnS1/view?usp=sharing 

    I have tried your suggestion to set some parameters at the value of the true parameters since I have simulated the data myself. 

    I noticed that for alpha and deltas, and if I set them at the true parameter values, the rest of the optimized parameters are at 0, (except C and T2). And when I set eigen_cc to be at the true parameter values, the model becomes infeasible and unbounded. I tried to set the objective to be 0 to see if it becomes infeasible. And here is the output I got from the infeasibility test:

    ›\ Model _copy
    \ LP format - for model browsing. Use MPS format to capture full model detail.
    Minimize
     
    Subject To
     U_c_M1_4: - alpha + 2.113659049444557 eigen_cc + U_c = 0
    Bounds
     -infinity <= alpha <= 1
     eigen_cc >= 0.5359145040785996
    End

    And the result is saying the constraint in the first loop is causing the problem, and I have highlighted that line of code that's causing the problem.

    So I think maybe the way I code up the loops are not correct, and that's why this is causing the problem.

    Thank you so much for your help and I really appreciate it!

    Best regards,

    Annie

     

     

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Annie,

    From the IIS you posted, you can see what is causing the infeasibility.

    Variable \(U_c\) is \(\geq 0\) and \(2.113 \cdot eigen_{cc} \geq 1.132740541274324 \). So in order to make the model feasible \(\alpha\) would have to take the value at least \(\alpha \geq 1.132740541274324\) or \(U_c\) should be allowed to attain negative values. Does this help?

    Best regards, 
    Jaromił

    0
  • Annie Shi
    First Comment
    First Question

    Hello Jaromil,

    Thanks for the reply. That makes sense. And I just want to double-check with you that my code does reflect my mathematical equations since I'm adding many constraints, such as U_c in order to use the exp and log operations, and the loops for s and i.

    Thank you so much!

    Best regards,

    Annie

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Annie,

    And I just want to double-check with you that my code does reflect my mathematical equations since I'm adding many constraints, such as U_c in order to use the exp and log operations, and the loops for s and i.

    One good way to check whether your model looks as expected is to use the write method to write a human-readable LP file.

    model.write("myModel.lp")

    This will generate a file named \(\texttt{myModel.lp}\) which you can analyze in any standard text editor. To make the analysis easier, you should provide a unique name for every variable and constraint in your model. It also makes sense to make the model smaller for this analysis.

    One thing that looks suspicious is that the \(U_c\) variable is forced to be \(\geq 0\) (Note that Gurobi's default value for lower bound of variables is \(0\)). This limits the term \(\exp(U_c\) to be always \(\geq 1\). I don't know anything about your application so this might just be correct but it's definitely worth a look.

    Best regards, 
    Jaromił

    0

Please sign in to leave a comment.