how to stay at the presolved state?
AnsweredIn m.optimize(), a presolved model p is generated and solved, then the solution of p is automatically mapped back to m. Can I stay at the state where p is generated but not solved?
I want to try several modification on the presolved model p and solve p, however, if i use p=m.presolve() and p.optimize(), the solution cannot be mapped back. So I wonder if I can call m.optimize() and stay at the presolved state(to try several modifications), and then the solution can be automatically mapped back.
-
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 -
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 -
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.
Comments
3 comments