Skip to main content

how to stay at the presolved state?

Answered

Comments

3 comments

  • Michel Soares
    Gurobi-versary
    Thought Leader

    Hi,

    You can get the presolved model this way:

    reduced_model = model.presolve()
    reduced_model.write("reduced_model.lp")

    You may be able to directly modify the reduced_model directly as you wish, I have never tried. If it does not work, you can always read back this LP file from the reduced model.

    0
  • liu heng
    Gurobi-versary
    Conversationalist
    Investigator

    Thank you Michel, but if call reduced_model=model.presolve(), the solution of 'reduced_model' cannot be mapped back to the solution of 'model'

    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Liu Heng,

    I can confirm it is not possible for users to map between the original model and presolved model.  The relationship between these models is not as simple and straightforward as users often expect.  You may notice that variables and constraints in the presolved model may have the same names as variables and constraints in the original model however it is not safe to assume these are the same variables and constraints.  Apologies that this is not the answer you were hoping for.

    - Riley

    0

Please sign in to leave a comment.