Skip to main content

Start the solution from .sol file for LP.

Awaiting user input

Comments

5 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?.
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Sanjeev,

    Could you elaborate more on the issue you are experiencing?

    In your code snippet you solve the same model multiple times. This means that the second run optimization should directly start with the optimal solution from the first run. If this is what you are trying to achieve then your code seems correct. I guess that the scenario variable \(s\) plays some role which is not explained in your code snippet. Maybe Gurobi's Multi Scenario feature might be of interest to you.

    Best regards,
    Jaromił

    0
  • Sanjeev Bhurtyal
    Gurobi-versary
    First Comment
    First Question

    Thank you Jaromil for your comment. I am implementing Benders Decomposition algorithm. For each scenario, I change RHS of one of the scenario specific constraint. In an iteration, I solve the model for all scenario. I am trying to perform following process. 

    Iteration 1:

    Solve and get solution of model for scenario 1.

    Solve and get solution of model for scenario 2.

    Iteration 2:

    Start solving scenario 1 using solution of scenario 1 from Iteration 1

    Start solving scenario 2 using solution of scenario 2 from Iteration 1

    .

    .

    .

    Updated code snippet

    r=1

    for s in scenario:

        mdlSP.setAttr("RHS",constraint,newvalue[r,s])

         if sol_file_s exists:

                model.read("sol_file_s.sol")  #Reads scenario specific sol file

         model.update()

         model.optimize()

         model.write("sol_file_s.sol")

    r=r+1

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Sanjeev,

    The code seems to be correct. Could you explain what exactly takes so much longer in the second iteration? Could you post LOG snippets of the fast iteration 1 run and of the slow iteration 2 run? In between the iteration, did you change the RHS of exactly one constraint and performed no other modifications? 

    Best regards,
    Jaromił

    0
  • Sanjeev Bhurtyal
    Gurobi-versary
    First Comment
    First Question

    Hi Jaromil,

    There was a bug in the code. After I fixed it, the code runs fine now. 

    Thank you for your help.

    Sanjeev

    0

Post is closed for comments.