# Interpreting presolve output

**URL:** <https://discuss.ampl.com/t/interpreting-presolve-output/2215>\
**Category:** New to AMPL\
**Tags:** displays-results\
**Created:** [January 11, 2026, 5:27am UTC](https://discuss.ampl.com/t/interpreting-presolve-output/2215 "2026-01-11T05:27:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_nr](https://avatars.discourse-cdn.com/v4/letter/_/9de0a6/32.png) [@\_nr](https://discuss.ampl.com/u/_nr)\
**Post date:** [January 11, 2026, 5:27am UTC](https://discuss.ampl.com/t/interpreting-presolve-output/2215/1 "2026-01-11T05:27:17Z")

</div>

How should I interpret the output of show\_stats with respect to the original model (the one prior to the presolve step)? I’m trying to understand the meaning behind the number of eliminated variables and constraints reported through presolve and substitution. An example output is shown below.

If I want to compute the total number of variables prior to presolve being called, I believe I can display `_ncons` and `_nvars`. I figured it would also be possible to arrive at the same number by adding the information in show\_stats. For example, `_ncons = eliminated presolve constraints + adjusted model constraints`. This wasn’t correct, but after adding the number of variables that substitution eliminated I was able to get the original number of constraints. However, I noticed I need to add the eliminated substitution variables to the constraints and variables to get to their original model numbers. Is this correct? Why are the substituted variables being double counted? Are defined variables generated twice, once as a constraint and the other as a variable?

Below is a sample session that shows the output of show\_stats and my calculations of `_ncons` and `_nvars` from the show\_stats data.

* * *

```auto
Presolve eliminates 5269 constraints and 5226 variables.
Substitution eliminates 3421 variables.
“option presolve 10;” used, but “option presolve 11;” might work better.
Adjusted problem:
132 variables:
128 nonlinear variables
4 linear variables
134 constraints; 572 nonzeros
36 nonlinear constraints
98 linear constraints
116 equality constraints
18 range constraints
1 nonlinear objective; 20 nonzeros.

ampl: display _ncons, 5269+134+3421, _nvars, 5226+132+3421;
_ncons = 8824
5269 + 134 + 3421 = 8824
_nvars = 8779
5226 + 132 + 3421 = 8779

```

---

<div class="post-metadata">

**Author:** ![marcos](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/marcos/32/154_2.png) [@marcos](https://discuss.ampl.com/u/marcos)\
**Post date:** [January 12, 2026, 4:53pm UTC](https://discuss.ampl.com/t/interpreting-presolve-output/2215/2 "2026-01-12T16:53:50Z")

</div>

Hi @_nr ,

While `_nvars`, `_ncons` are the number of variables/constraints before presolve, you can also get the “after presolve” (so the variables that actually go to the **solver** interface) with `_snvars` and `_sncons`.

There are similar sets you can display:

```auto
ampl.display("_var, _varname") # variables before presolve
ampl.display("_con, _conname") # constraints before presolve
ampl.display("_svar, _svarname") # variables after presolve
ampl.display("_scon, _sconname") # constraints after presolve

```

---

<div class="post-metadata">

**Author:** ![\_nr](https://avatars.discourse-cdn.com/v4/letter/_/9de0a6/32.png) [@\_nr](https://discuss.ampl.com/u/_nr)\
**Post date:** [January 12, 2026, 5:54pm UTC](https://discuss.ampl.com/t/interpreting-presolve-output/2215/3 "2026-01-12T17:54:10Z")

</div>

Yes, thank you for taking the time to respond! I am aware of `_sncons` and `_snvars`. These parameters equal the number of variables and constraints reported in the adjusted problem summary. I was just curious about the relationship between the numbers in the show\_stats report. If my math is right, are substituted variables being double counted in the report?

---

<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 19, 2026, 12:16am UTC](https://discuss.ampl.com/t/interpreting-presolve-output/2215/4 "2026-01-19T00:16:55Z")

</div>

Are you creating “defined variables” by using an = operator in a var statement? AMPL counts each defined variable as also defining a constraint, thus adding 1 to both \_nvars and \_ncons. Then when AMPL’s presolve eliminates defined variables, both those variables and the associated constraints are removed, reducing \_nvars and \_ncons equally.

---

<div class="post-metadata">

**Author:** ![\_nr](https://avatars.discourse-cdn.com/v4/letter/_/9de0a6/32.png) [@\_nr](https://discuss.ampl.com/u/_nr)\
**Post date:** [January 19, 2026, 2:16am UTC](https://discuss.ampl.com/t/interpreting-presolve-output/2215/5 "2026-01-19T02:16:57Z")

</div>

That makes sense. Yes, I use defined variables in my model for a variety of reasons from keeping my `subject to` statements short to keeping track of intermediate values.

Thank you for the response.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/ampl/original/1X/fe81b84535503f21fc46872e013cff3b184f9119.png) [@system](https://discuss.ampl.com/u/system)\
**Post date:** [April 19, 2026, 2:17am UTC](https://discuss.ampl.com/t/interpreting-presolve-output/2215/6 "2026-04-19T02:17:28Z")

</div>

Closed on April 19, 2026, 2:17am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
