Skip to main content

GurobiError: Constant is Nan

Answered

Comments

5 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 José,

    are you accessing any data from some file? It is possible that the remote machine does not have access to the data and initializes all values with NaN.

    Could you please post a minimal working example showing the issue?

    Which Gurobi version are you using? Does the error occur during model building, during the optimization, or after the optimization has finished?

    Best regards, 
    Jaromił

    0
  • José Rodrigues
    • Gurobi-versary
    • Curious
    • Conversationalist

    Hi Jaromił,

    Yes, I am retrieving data from quite a few csv files, I have checked that the scripts that retrieve the data are working just fine, so that might not be the problem.

    The gurobi version is the most recent one, 9.5.1. The error occurs during model building.

    What do you mean by a minimal working example?

    Thank you, 

    José Rodrigues

     
    0
  • Jaromił Najman
    • Gurobi Staff

    The error occurs during model building.

    So it is very likely something with your constant values. You could try printing every constant value you have to check which one is the culprit and then find out why it attains a NaN value.

    What do you mean by a minimal working example?

    Minimal reproducible example

     

    0
  • José Rodrigues
    • Gurobi-versary
    • Curious
    • Conversationalist

    Okay, that helped, I don't know why but in the remote machine there were some excel cells being read as blanks and that made one of the costs be Nan. Thank you so much for your help!

     

    0

Post is closed for comments.