# Using information from the presolve phase to improve the model

**URL:** <https://discuss.ampl.com/t/using-information-from-the-presolve-phase-to-improve-the-model/2024>\
**Category:** Support\
**Tags:** modeling\
**Created:** [January 8, 2025, 9:35am UTC](https://discuss.ampl.com/t/using-information-from-the-presolve-phase-to-improve-the-model/2024 "2025-01-08T09:35:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa1](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/rafa1/32/868_2.png) [@Rafa1](https://discuss.ampl.com/u/Rafa1)\
**Post date:** [January 8, 2025, 9:35am UTC](https://discuss.ampl.com/t/using-information-from-the-presolve-phase-to-improve-the-model/2024/1 "2025-01-08T09:35:19Z")

</div>

Greetings everyone.  
Could someone direct me to some documentation where I can learn how to use information from the presolve phase (both from Cplex and Gurobi) to improve model execution?  
I am particularly interested in detecting and removing redundant constraints and, in general, increasing the efficiency of the solve phase.

---

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [January 12, 2025, 5:14pm UTC](https://discuss.ampl.com/t/using-information-from-the-presolve-phase-to-improve-the-model/2024/2 "2025-01-12T17:14:26Z")

</div>

To see Gurobi’s presolved problem in .lp file format, set the following options:

```auto
option solver gurobi;
option gurobi_options 'writepresolved=gurobipre.lp';
option gurobi_auxfiles rc;
solve;

```

The resulting file will show you all the constraints that were in the problem after presolving. This might be of use in studying some problems, especially if they are not too large or complicated. Gurobi won’t tell you what presolve steps it applied, however, so you’ll have to puzzle that out for yourself. You might want to also look at the problem before presolving, which you can get by specifying writemodel instead of writepresolved in gurobi\_options.

- If you are already specifying a gurobi\_options string, add writepresolved=gurobipre.lp to it. (All gurobi options need to be in the same gurobi\_options string.)
- You can specify any file instead of gurobipre.
- You can set `option presolve 0;` in AMPL to force all the presolving to be done in Gurobi.

CPLEX does not have an option like this.
