Dip 0.95.0
Loading...
Searching...
No Matches
DecompStats.h
Go to the documentation of this file.
1//===========================================================================//
2// This file is part of the DIP Solver Framework. //
3// //
4// DIP is distributed under the Eclipse Public License as part of the //
5// COIN-OR repository (http://www.coin-or.org). //
6// //
7// Authors: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8// Ted Ralphs, Lehigh University (ted@lehigh.edu) //
9// Jiadong Wang, Lehigh University (jiw408@lehigh.edu) //
10// //
11// Copyright (C) 2002-2019, Lehigh University, Matthew Galati, Ted Ralphs //
12// All Rights Reserved. //
13//===========================================================================//
14
15//===========================================================================//
16#ifndef DecompStats_h_
17#define DecompStats_h_
18
19//===========================================================================//
20#include "Decomp.h"
21#include "UtilTimer.h"
22//===========================================================================//
23
24//===========================================================================//
26public:
30 int phase;
42 double timeStamp;
46 double thisBound;
55 double bestBound;
65
69 bool operator<(const DecompObjBound& objBound) const {
70 if (timeStamp < objBound.timeStamp) {
71 return true;
72 } else {
73 return false;
74 }
75 }
76
77public:
78 DecompObjBound(double infinity) :
79 phase (0),
80 cutPass (0),
81 pricePass (0),
82 timeStamp (0.0),
83 thisBound (-infinity),
84 thisBoundUB( infinity),
85 bestBound (-infinity),
86 thisBoundIP( infinity),
87 bestBoundIP( infinity) {
88 }
89
90};
91
92//===========================================================================//
94public:
95
96 //---
97 //--- Storage for the bound history for a node.
98 //--- NOTE: we always assume a minimization problem
99 //---
100
114 std::vector< DecompObjBound > objHistoryBound;
115
119 std::pair<double, double> objBest;
120
125
130
135
140
145
150
155
160
165
170
171public:
172 void init() {
173 objHistoryBound.clear();
174 objBest.first = -m_infinity;
175 objBest.second = m_infinity;
176 nodeIndex = 0;
177 cutsThisRound = 0;
178 varsThisRound = 0;
179 cutsThisCall = 0;
180 varsThisCall = 0;
181 cutCallsTotal = 0;
182 priceCallsTotal = 0;
183 cutCallsRound = 0;
184 priceCallsRound = 0;
185 }
186
187public:
188 void printObjHistoryBound (std::ostream* os = &std::cout) const;
189 inline void resetCutRound() {
190 cutCallsRound = 0;
191 cutsThisRound = 0;
192 }
193 inline void resetPriceRound() {
194 priceCallsRound = 0;
195 varsThisRound = 0;
196 }
197 inline void resetBestLB() {
198 objBest.first = -m_infinity;
199 }
201 int nHistorySize = static_cast<int>(objHistoryBound.size());
202
203 if (nHistorySize > 0) {
204 return &(objHistoryBound[nHistorySize - 1]);
205 } else {
206 return 0;
207 }
208 }
209 inline double getLastBoundThis() {
210 double thisBound = -m_infinity;
211 DecompObjBound* lastBound = getLastBound();
212
213 if (lastBound) {
214 thisBound = lastBound->thisBound;
215 }
216
217 return thisBound;
218 }
219
220public:
223 objBest (),
225 init();
226 }
227};
228
229
230//===========================================================================//
232
233public:
238
239public:
241
250
251 double maxDecomp;
258
259public:
260 std::vector<double> thisDecomp;
261 std::vector<double> thisSolveRelax;
262 std::vector<double> thisSolveRelaxApp;
263 std::vector<double> thisSolUpdate;
264 std::vector<double> thisGenCuts;
265 std::vector<double> thisGenCutsApp;
266 std::vector<double> thisGenVars;
267 std::vector<double> thisCompressCols;
268
269public:
271 void printOverallStats (std::ostream* os = &std::cout); //ostream?
272 void printDetailedStats(std::ostream* os = &std::cout); //ostream?
273
274public:
276
277 totalOverall (0.0),
278
279 totalDecomp (0.0),
280 totalSolveRelax (0.0),
282 totalSolUpdate (0.0),
283 totalGenCuts (0.0),
284 totalGenCutsApp (0.0),
285 totalGenVars (0.0),
286 totalCompressCols (0.0),
287
288 maxDecomp (0.0),
289 maxSolveRelax (0.0),
290 maxSolveRelaxApp (0.0),
291 maxSolUpdate (0.0),
292 maxGenCuts (0.0),
293 maxGenVars (0.0),
294 maxCompressCols (0.0)
295
296 {
297 }
298
300
301};
302//===========================================================================//
303
304#endif
305
const double COIN_DBL_MAX
double m_infinity
Value of infinity.
Definition: DecompStats.h:169
void printObjHistoryBound(std::ostream *os=&std::cout) const
double getLastBoundThis()
Definition: DecompStats.h:209
void resetPriceRound()
Definition: DecompStats.h:193
int priceCallsTotal
Number of price calls in this node in total.
Definition: DecompStats.h:154
void resetCutRound()
Definition: DecompStats.h:189
int cutsThisRound
Number of cuts generated in this round of cut calls.
Definition: DecompStats.h:129
int cutCallsTotal
Number of cut calls in this node in total.
Definition: DecompStats.h:149
int cutsThisCall
Number of cuts generated in this particular cut call.
Definition: DecompStats.h:139
int priceCallsRound
Number of price calls in this round.
Definition: DecompStats.h:164
int cutCallsRound
Number of cut calls in this round.
Definition: DecompStats.h:159
int varsThisRound
Number of vars generated in this round of pricing calls.
Definition: DecompStats.h:134
DecompObjBound * getLastBound()
Definition: DecompStats.h:200
std::pair< double, double > objBest
The global lower (.first) and upper (.second) bound.
Definition: DecompStats.h:119
void resetBestLB()
Definition: DecompStats.h:197
int nodeIndex
The node index (in the branch-and-bound tree).
Definition: DecompStats.h:124
int varsThisCall
Number of vars generated in this particular price call.
Definition: DecompStats.h:144
std::vector< DecompObjBound > objHistoryBound
Storage of the bounds.
Definition: DecompStats.h:114
double thisBoundIP
The recorded integer upper bound.
Definition: DecompStats.h:59
int pricePass
The price pass when bound was recorded.
Definition: DecompStats.h:38
int phase
The phase when bound was recorded.
Definition: DecompStats.h:30
bool operator<(const DecompObjBound &objBound) const
Comparison operator for sorting on time.
Definition: DecompStats.h:69
double bestBoundIP
The best recorded integer upper bound.
Definition: DecompStats.h:64
double thisBound
The recorded continuous lower bound.
Definition: DecompStats.h:46
DecompObjBound(double infinity)
Definition: DecompStats.h:78
double thisBoundUB
The recorded continuous upper bound.
Definition: DecompStats.h:50
double bestBound
The best recorded continuous lower bound.
Definition: DecompStats.h:55
int cutPass
The cut pass when bound was recorded.
Definition: DecompStats.h:34
double timeStamp
The time stamp (from start) when bound was recorded.
Definition: DecompStats.h:42
std::vector< double > thisSolveRelaxApp
Definition: DecompStats.h:262
void printDetailedStats(std::ostream *os=&std::cout)
double totalDecomp
Definition: DecompStats.h:242
double maxGenVars
Definition: DecompStats.h:256
double totalSolUpdate
Definition: DecompStats.h:245
double totalGenCutsApp
Definition: DecompStats.h:247
void printOverallStats(std::ostream *os=&std::cout)
UtilTimer timerOther2
Definition: DecompStats.h:237
std::vector< double > thisDecomp
Definition: DecompStats.h:260
UtilTimer timerDecomp
Definition: DecompStats.h:235
double maxGenCuts
Definition: DecompStats.h:255
std::vector< double > thisGenCutsApp
Definition: DecompStats.h:265
UtilTimer timerOverall
Definition: DecompStats.h:234
double totalGenCuts
Definition: DecompStats.h:246
std::vector< double > thisGenVars
Definition: DecompStats.h:266
double maxSolveRelaxApp
Definition: DecompStats.h:253
double maxSolUpdate
Definition: DecompStats.h:254
double totalCompressCols
Definition: DecompStats.h:249
double maxSolveRelax
Definition: DecompStats.h:252
double maxDecomp
Definition: DecompStats.h:251
double totalSolveRelaxApp
Definition: DecompStats.h:244
std::vector< double > thisSolUpdate
Definition: DecompStats.h:263
void calculateStats()
double totalOverall
Definition: DecompStats.h:240
std::vector< double > thisCompressCols
Definition: DecompStats.h:267
double totalSolveRelax
Definition: DecompStats.h:243
std::vector< double > thisSolveRelax
Definition: DecompStats.h:261
double maxCompressCols
Definition: DecompStats.h:257
double totalGenVars
Definition: DecompStats.h:248
UtilTimer timerOther1
Definition: DecompStats.h:236
std::vector< double > thisGenCuts
Definition: DecompStats.h:264