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.
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