Skip to main content

Please correct my code




  • Hi Wichitsawat,

    It looks like there might be a couple of issues in your P-median model implementation.

    1. Model Optimization Call: You have correctly set up the model's objective and variables but have not called the model.optimize() function to start the optimization process. After setting your objective and before writing the model to a file, insert:


    2. OutputFlag Set to 0: You have set model.setParam('OutputFlag', 0) which disables Gurobi's logging output. This might be why you see no output even if the model runs. To see Gurobi logs in your console, you can set this parameter to 1.

    - Bot

  • Wow. It works.

    Thank you so much for your quick response.

    P.S. I am an old man who forgot simple rules to make Gurobi code run.


Please sign in to leave a comment.