メインコンテンツへスキップ

Fixed model when running in batch mode on the compute server

回答済み

コメント

4件のコメント

  • Michel Soares
    Gurobi-versary
    Thought Leader

    Hi,

    You can fix the values of all integer variables by iterating through the result and adding constraints to these variables. Example: variable X takes value 0, therefore you add a constraint that X = 0. If you optimize the model after adding these constraints, you should have your result.

    Another way to do this, is to manually iterate through all the constraints and objective function and replace the variables for the fixed value. This should take longer for you to do, and this is what Gurobi will do in the pre-solve of the fixed model I described above.

    Nonetheless, I wonder what is the objective of running this fixed MIP model. It is very likely that you will get the same solution, or at least one equivalent in objective function. I might have missed your point here.

    0
  • Kjartan Halvorsen
    First Comment
    First Question

    Thanks a lot for your comment, Michel Soares

    The purpose of running the fixed model is to obtain shadow prices for the binding constraints. The json returned from solving the MIP model in batch mode does not contain information on the constraints. I am fairly new to gurobi, and it could be that I am missing to set some parameter when sending the batch job.

     

    0
  • Ronald van der Velden
    Gurobi Staff Gurobi Staff

    Unfortunately there is no functionality for turning the JSON output into a fixed model as you described. The approach by Michel is the way to go. As a slight variation, you might consider setting the LB and UB of each integer variable to its solution value to avoid adding new constraints to your model.

    0
  • Kjartan Halvorsen
    First Comment
    First Question

    Thanks, Ronald van der Velden! I will proceed as suggested. 

    0

サインインしてコメントを残してください。