Skip to main content

Network Time Out When Writing Result - Compute Server

Comments

3 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff 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 why not try our AI Gurobot?.
  • Eli Towle
    Gurobi Staff Gurobi Staff

    Hi Sneha,

    How big is your model? Also, do you know exactly where in the code the network connection error appears?

    Individually querying string-valued attributes like VarName can be very inefficient (see here). Could you try retrieving the variable names and values in bulk using Model.getAttr()?

    vars = m.getVars()
    var_names = m.getAttr('VarName', vars)
    var_values = m.getAttr('X', vars)

    You can filter out the zero-valued variables afterwards if you want. Also, note that you can use Model.write() to write out a .sol solution file in a very similar style:

    m.write('/gurobi_shared/gurobi_output/result.sol')

    Thanks,

    Eli

    0
  • Sneha Bishnoi
    Gurobi-versary
    First Comment
    First Question

    Hi Eli,

     

    Thank you for response. Model is quite big ~45M binary variable and 19K continuous variables. As far as I can tell from logs, the network connection appears right after it defines the var_names and var_Values but maybe somewhere around for (because it does print the python code "Retrieving variables" that sits between the two.

    Will add the .sol as backup to get a result after the 3 hrs run. And follow your suggestion for extracting variables all together instead of for.

    Thank you! 

    0

Post is closed for comments.