Scippy

SoPlex

Sequential object-oriented simPlex

statistics.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (c) 1996-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SoPlex; see the file LICENSE. If not email to soplex@zib.de. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file statistics.h
26  * @brief Class for collecting statistical information
27  */
28 #ifndef _STATISTICS_H_
29 #define _STATISTICS_H_
30 
31 #include <iostream>
32 
33 #include "soplex.h"
34 #include "soplex/timer.h"
35 
36 namespace soplex
37 {
38 /**@class Statistics
39  * @brief Class for collecting statistical information
40  * @ingroup Algo
41  */
42 template <class R>
44 {
45 
46 public:
47 
48 
49  ///@name Construction, resetting, printing
50  ///@{
51 
52  /// default constructor
54 
55  /// copy constructor
56  Statistics(const Statistics& base);
57 
58  /// assignment operator
59  Statistics& operator=(const Statistics& rhs);
60 
61  /// destructor
63  {
64  // we need to free all timers again (allocation happens in constructor)
65  readingTime->~Timer();
66  solvingTime->~Timer();
67  preprocessingTime->~Timer();
68  simplexTime->~Timer();
69  syncTime->~Timer();
70  transformTime->~Timer();
71  rationalTime->~Timer();
72  initialPrecisionTime->~Timer();
73  extendedPrecisionTime->~Timer();
74  reconstructionTime->~Timer();
75  boostingStepTime->~Timer();
76  spx_free(readingTime);
77  spx_free(solvingTime);
78  spx_free(preprocessingTime);
79  spx_free(simplexTime);
80  spx_free(syncTime);
81  spx_free(transformTime);
82  spx_free(rationalTime);
83  spx_free(initialPrecisionTime);
84  spx_free(extendedPrecisionTime);
85  spx_free(reconstructionTime);
86  spx_free(boostingStepTime);
87  }
88 
89  /// clears all statistics
90  void clearAllData();
91 
92  /// clears statistics on solving process
93  void clearSolvingData();
94 
95  /// prints statistics
96  void print(std::ostream& os);
97 
98 
99  ///@}
100 
101 
102  ///@name Data
103  ///@{
104 
105  Timer* readingTime; ///< reading time not included in solving time
106  Timer* solvingTime; ///< solving time
107  Timer* preprocessingTime; ///< preprocessing time
108  Timer* simplexTime; ///< simplex time
109  Timer* syncTime; ///< time for synchronization between real and rational LP (included in solving time)
110  Timer* transformTime; ///< time for transforming LPs (included in solving time)
111  Timer* rationalTime; ///< time for rational LP solving (included in solving time)
112  Timer* initialPrecisionTime; ///< solving time with initial precision (included in solving time)
113  Timer* extendedPrecisionTime; ///< solving time with extended precision (included in solving time)
114  Timer* reconstructionTime; ///< time for rational reconstructions
115  Timer* boostingStepTime; ///< time for the precision boosting step: boost, load LP, load basis, decrease tols (included in solving time)
116  Timer::TYPE timerType; ///< type of timer (user or wallclock)
117 
118  Real multTimeSparse; ///< time for computing A*x exploiting sparsity (setupPupdate(), PRICE step)
119  Real multTimeFull; ///< time for computing A*x ignoring sparsity (setupPupdate(), PRICE step)
120  Real multTimeColwise; ///< time for computing A*x columnwise (setupPupdate(), PRICE step)
121  Real multTimeUnsetup; ///< time for computing A*x w/o sparsity information (setupPupdate(), PRICE step)
122  int multSparseCalls; ///< number of products A*x exploiting sparsity (setupPupdate(), PRICE step)
123  int multFullCalls; ///< number of products A*x ignoring sparsity (setupPupdate(), PRICE step)
124  int multColwiseCalls; ///< number of products A*x columnwise (setupPupdate(), PRICE step)
125  int multUnsetupCalls; ///< number of products A*x w/o sparsity information (setupPupdate(), PRICE step)
126 
127  Real luFactorizationTimeReal; ///< time for factorizing bases matrices in real precision
128  Real luSolveTimeReal; ///< time for solving linear systems in real precision
129  Real luFactorizationTimeRational; ///< time for factorizing bases matrices in rational precision
130  Real luSolveTimeRational; ///< time for solving linear systems in rational precision
131  Real fpTime; ///< time for first floating-point LP solve
132  int iterations; ///< number of iterations/pivots
133  int iterationsPrimal; ///< number of iterations with Primal
134  int iterationsFromBasis; ///< number of iterations from Basis
135  int iterationsPolish; ///< number of iterations during solution polishing
136  int iterationsFP; ///< number of iterations/pivots in first floating-point solve
137  int boundflips; ///< number of dual bound flips
138  int boostedIterations; ///< number of iterations/pivots in extended precision
139  int boostedIterationsPrimal; ///< number of iterations with Primal
140  int boostedIterationsFromBasis; ///< number of iterations from Basis
141  int boostedIterationsPolish; ///< number of iterations during solution polishing
142  int boostedBoundflips; ///< number of dual bound flips
143  int luFactorizationsReal; ///< number of basis matrix factorizations in real precision
144  int luSolvesReal; ///< number of (forward and backward) solves with basis matrix in real precision
145  int luFactorizationsRational; ///< number of basis matrix factorizations in rational precision
146  int rationalReconstructions; ///< number of rational reconstructions performed
147  int refinements; ///< number of refinement steps
148  int stallRefinements; ///< number of refinement steps without pivots
149  int pivotRefinements; ///< number of refinement steps until final basis is reached
150  int feasRefinements; ///< number of refinement steps during infeasibility test
151  int unbdRefinements; ///< number of refinement steps during undboundedness test
152  int precBoosts; ///< number of precision boosts
153  int stallPrecBoosts; ///< number of precision boosts without pivots
154  int pivotPrecBoosts; ///< number of precision boosts until final basis is reached
155  int feasPrecBoosts; ///< number of precision boosts during infeasibility test
156  int unbdPrecBoosts; ///< number of precision boosts during undboundedness test
157 
158  // Improved dual simplex statistics
159  int callsReducedProb; ///< number of times the reduced problem is solved. This includes the initial solve.
160  int iterationsInit; ///< number of iterations in the initial LP
161  int iterationsRedProb; ///< number of iterations of the reduced problem
162  int iterationsCompProb; ///< number of iterations of the complementary problem
163  int numRedProbRows; ///< number of rows in the reduced problem
164  int numRedProbCols; ///< number of columns in the reduced problem
165  int degenPivotsPrimal; ///< number of primal degenerate pivots
166  int degenPivotsDual; ///< number of dual degenerate pivots
167  int degenPivotCandPrimal; ///< number of pivoting candidates that will produce a degenerate step in the primal
168  int degenPivotCandDual; ///< number of pivoting candidates that will produce a degenerate step in the dual
169  R sumDualDegen; ///< the sum of the rate of dual degeneracy at each iteration
170  R sumPrimalDegen; ///< the sum of the rate of primal degeneracy at each iteration
171  R totalBoundViol; ///< the sum of the bound violations in the original problem using the red prob sol
172  R totalRowViol; ///< the sum of the row violations in the original problem using the red prob sol
173  R maxBoundViol; ///< the max bound violation in the original problem using the red prob sol
174  R maxRowViol; ///< the max row violations in the original problem using the red prob sol
175  int redProbStatus; ///< status of the reduced problem
176  int compProbStatus; ///< status of the complementary problem
177  R finalCompObj; ///< the final objective function of the complementary problem
178 
179  // Numerics
180  R finalBasisCondition; ///< condition number estimate of the optimal basis matrix
181 
182  ///@}
183 
184 };
185 } // namespace soplex
186 
187 // For general templated files
188 #include "statistics.hpp"
189 
190 #endif // _STATISTICS_H_
R sumPrimalDegen
the sum of the rate of primal degeneracy at each iteration
Definition: statistics.h:170
int precBoosts
number of precision boosts
Definition: statistics.h:152
int stallRefinements
number of refinement steps without pivots
Definition: statistics.h:148
Real luFactorizationTimeReal
time for factorizing bases matrices in real precision
Definition: statistics.h:127
Real multTimeFull
time for computing A*x ignoring sparsity (setupPupdate(), PRICE step)
Definition: statistics.h:119
Timer * simplexTime
simplex time
Definition: statistics.h:108
R finalCompObj
the final objective function of the complementary problem
Definition: statistics.h:177
int iterationsFP
number of iterations/pivots in first floating-point solve
Definition: statistics.h:136
Real luFactorizationTimeRational
time for factorizing bases matrices in rational precision
Definition: statistics.h:129
int pivotRefinements
number of refinement steps until final basis is reached
Definition: statistics.h:149
int iterationsFromBasis
number of iterations from Basis
Definition: statistics.h:134
Timer * rationalTime
time for rational LP solving (included in solving time)
Definition: statistics.h:111
int callsReducedProb
number of times the reduced problem is solved. This includes the initial solve.
Definition: statistics.h:159
int boostedIterations
number of iterations/pivots in extended precision
Definition: statistics.h:138
R finalBasisCondition
condition number estimate of the optimal basis matrix
Definition: statistics.h:180
int unbdPrecBoosts
number of precision boosts during undboundedness test
Definition: statistics.h:156
SoPlexBase< R > & operator=(const SoPlexBase< R > &rhs)
assignment operator
int pivotPrecBoosts
number of precision boosts until final basis is reached
Definition: statistics.h:154
int numRedProbRows
number of rows in the reduced problem
Definition: statistics.h:163
Timer * initialPrecisionTime
solving time with initial precision (included in solving time)
Definition: statistics.h:112
int multColwiseCalls
number of products A*x columnwise (setupPupdate(), PRICE step)
Definition: statistics.h:124
int boostedIterationsFromBasis
number of iterations from Basis
Definition: statistics.h:140
R maxRowViol
the max row violations in the original problem using the red prob sol
Definition: statistics.h:174
int rationalReconstructions
number of rational reconstructions performed
Definition: statistics.h:146
int boostedIterationsPrimal
number of iterations with Primal
Definition: statistics.h:139
Timer * reconstructionTime
time for rational reconstructions
Definition: statistics.h:114
R totalBoundViol
the sum of the bound violations in the original problem using the red prob sol
Definition: statistics.h:171
Real multTimeColwise
time for computing A*x columnwise (setupPupdate(), PRICE step)
Definition: statistics.h:120
Timer * extendedPrecisionTime
solving time with extended precision (included in solving time)
Definition: statistics.h:113
Real luSolveTimeRational
time for solving linear systems in rational precision
Definition: statistics.h:130
double Real
Definition: spxdefines.h:269
int multSparseCalls
number of products A*x exploiting sparsity (setupPupdate(), PRICE step)
Definition: statistics.h:122
Timer * syncTime
time for synchronization between real and rational LP (included in solving time)
Definition: statistics.h:109
int iterationsCompProb
number of iterations of the complementary problem
Definition: statistics.h:162
int feasRefinements
number of refinement steps during infeasibility test
Definition: statistics.h:150
Real luSolveTimeReal
time for solving linear systems in real precision
Definition: statistics.h:128
Timer * readingTime
reading time not included in solving time
Definition: statistics.h:105
Real multTimeUnsetup
time for computing A*x w/o sparsity information (setupPupdate(), PRICE step)
Definition: statistics.h:121
int unbdRefinements
number of refinement steps during undboundedness test
Definition: statistics.h:151
R sumDualDegen
the sum of the rate of dual degeneracy at each iteration
Definition: statistics.h:169
int stallPrecBoosts
number of precision boosts without pivots
Definition: statistics.h:153
int iterationsPrimal
number of iterations with Primal
Definition: statistics.h:133
int refinements
number of refinement steps
Definition: statistics.h:147
Timer * boostingStepTime
time for the precision boosting step: boost, load LP, load basis, decrease tols (included in solving ...
Definition: statistics.h:115
R totalRowViol
the sum of the row violations in the original problem using the red prob sol
Definition: statistics.h:172
Timer::TYPE timerType
type of timer (user or wallclock)
Definition: statistics.h:116
int iterationsRedProb
number of iterations of the reduced problem
Definition: statistics.h:161
Preconfigured SoPlex LP solver.
R maxBoundViol
the max bound violation in the original problem using the red prob sol
Definition: statistics.h:173
int redProbStatus
status of the reduced problem
Definition: statistics.h:175
int luSolvesReal
number of (forward and backward) solves with basis matrix in real precision
Definition: statistics.h:144
Timer * solvingTime
solving time
Definition: statistics.h:106
Everything should be within this namespace.
Timer class.
TYPE
types of timers
Definition: timer.h:108
int multFullCalls
number of products A*x ignoring sparsity (setupPupdate(), PRICE step)
Definition: statistics.h:123
int multUnsetupCalls
number of products A*x w/o sparsity information (setupPupdate(), PRICE step)
Definition: statistics.h:125
Real multTimeSparse
time for computing A*x exploiting sparsity (setupPupdate(), PRICE step)
Definition: statistics.h:118
int boundflips
number of dual bound flips
Definition: statistics.h:137
int luFactorizationsReal
number of basis matrix factorizations in real precision
Definition: statistics.h:143
int compProbStatus
status of the complementary problem
Definition: statistics.h:176
int numRedProbCols
number of columns in the reduced problem
Definition: statistics.h:164
int iterationsInit
number of iterations in the initial LP
Definition: statistics.h:160
int degenPivotCandPrimal
number of pivoting candidates that will produce a degenerate step in the primal
Definition: statistics.h:167
Timer * transformTime
time for transforming LPs (included in solving time)
Definition: statistics.h:110
int boostedIterationsPolish
number of iterations during solution polishing
Definition: statistics.h:141
int feasPrecBoosts
number of precision boosts during infeasibility test
Definition: statistics.h:155
int iterationsPolish
number of iterations during solution polishing
Definition: statistics.h:135
void print(std::FILE *f, const text_style &ts, const S &format_str, const Args &... args)
Definition: color.h:519
int luFactorizationsRational
number of basis matrix factorizations in rational precision
Definition: statistics.h:145
int degenPivotsDual
number of dual degenerate pivots
Definition: statistics.h:166
Real fpTime
time for first floating-point LP solve
Definition: statistics.h:131
int degenPivotCandDual
number of pivoting candidates that will produce a degenerate step in the dual
Definition: statistics.h:168
Timer * preprocessingTime
preprocessing time
Definition: statistics.h:107
Wrapper for the system time query methods.
Definition: timer.h:85
int boostedBoundflips
number of dual bound flips
Definition: statistics.h:142
int iterations
number of iterations/pivots
Definition: statistics.h:132
void spx_free(T &p)
Release memory.
Definition: spxalloc.h:121
int degenPivotsPrimal
number of primal degenerate pivots
Definition: statistics.h:165