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.
void printObjHistoryBound(std::ostream *os=&std::cout) const
double getLastBoundThis()
void resetPriceRound()
int priceCallsTotal
Number of price calls in this node in total.
int cutsThisRound
Number of cuts generated in this round of cut calls.
int cutCallsTotal
Number of cut calls in this node in total.
int cutsThisCall
Number of cuts generated in this particular cut call.
int priceCallsRound
Number of price calls in this round.
int cutCallsRound
Number of cut calls in this round.
int varsThisRound
Number of vars generated in this round of pricing calls.
DecompObjBound * getLastBound()
std::pair< double, double > objBest
The global lower (.first) and upper (.second) bound.
int nodeIndex
The node index (in the branch-and-bound tree).
int varsThisCall
Number of vars generated in this particular price call.
std::vector< DecompObjBound > objHistoryBound
Storage of the bounds.
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
void printDetailedStats(std::ostream *os=&std::cout)
double totalDecomp
double maxGenVars
double totalSolUpdate
double totalGenCutsApp
void printOverallStats(std::ostream *os=&std::cout)
UtilTimer timerOther2
std::vector< double > thisDecomp
UtilTimer timerDecomp
double maxGenCuts
std::vector< double > thisGenCutsApp
UtilTimer timerOverall
double totalGenCuts
std::vector< double > thisGenVars
double maxSolveRelaxApp
double maxSolUpdate
double totalCompressCols
double maxSolveRelax
double maxDecomp
double totalSolveRelaxApp
std::vector< double > thisSolUpdate
void calculateStats()
double totalOverall
std::vector< double > thisCompressCols
double totalSolveRelax
std::vector< double > thisSolveRelax
double maxCompressCols
double totalGenVars
UtilTimer timerOther1
std::vector< double > thisGenCuts