Skip to content

Commit 5ede07b

Browse files
committed
store cgraph density and build time
1 parent 952bd55 commit 5ede07b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/Osi/OsiSolverInterface.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,8 @@ OsiSolverInterface::OsiSolverInterface()
980980
, appDataEtc_(NULL)
981981
, ws_(NULL)
982982
, cgraph_(NULL)
983+
, cgraphBuildTime_(0.0)
984+
, cgraphDensity_(0.0)
983985
{
984986
setInitialData();
985987
}
@@ -1036,6 +1038,8 @@ void OsiSolverInterface::setInitialData()
10361038
delete cgraph_;
10371039
cgraph_ = NULL;
10381040
}
1041+
cgraphBuildTime_ = 0.0;
1042+
cgraphDensity_ = 0.0;
10391043
}
10401044

10411045
//-------------------------------------------------------------------
@@ -1082,6 +1086,8 @@ OsiSolverInterface::OsiSolverInterface(const OsiSolverInterface &rhs)
10821086
} else {
10831087
cgraph_ = NULL;
10841088
}
1089+
cgraphBuildTime_ = rhs.cgraphBuildTime_;
1090+
cgraphDensity_ = rhs.cgraphDensity_;
10851091
}
10861092

10871093
//-------------------------------------------------------------------
@@ -1173,6 +1179,8 @@ OsiSolverInterface::operator=(const OsiSolverInterface &rhs)
11731179
} else {
11741180
cgraph_ = NULL;
11751181
}
1182+
cgraphBuildTime_ = rhs.cgraphBuildTime_;
1183+
cgraphDensity_ = rhs.cgraphDensity_;
11761184
}
11771185
return *this;
11781186
}
@@ -3520,9 +3528,11 @@ void OsiSolverInterface::checkCGraph(CoinMessageHandler *msgh)
35203528
primalTolerance, infinity, getColNames(),
35213529
getRowNames());
35223530
timeCG = CoinCpuTime()-timeCG;
3531+
cgraphBuildTime_ = timeCG;
3532+
cgraphDensity_ = cgraph_->density();
35233533

35243534
if (msgh && msgh->logLevel())
3525-
msgh->message(COIN_CGRAPH_INFO, messages()) << timeCG << cgraph_->density()*100.0 << ((timeCG>1.0) ? "!!" : "") << CoinMessageEol;
3535+
msgh->message(COIN_CGRAPH_INFO, messages()) << timeCG << cgraphDensity_*100.0 << ((timeCG>1.0) ? "!!" : "") << CoinMessageEol;
35263536
}
35273537
/* Modify model to deal with indicators.
35283538
startBigM are values in input.

src/Osi/OsiSolverInterface.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,11 @@ class OSILIB_EXPORT OsiSolverInterface {
19091909
*/
19101910
void checkCGraph(CoinMessageHandler *msgh = NULL);
19111911

1912+
/*! \brief Returns the time (in CPU seconds) spent building the conflict graph */
1913+
inline double getCGraphBuildTime() const { return cgraphBuildTime_; }
1914+
1915+
/*! \brief Returns the density of the conflict graph (0..1) */
1916+
inline double getCGraphDensity() const { return cgraphDensity_; }
19121917

19131918
//@}
19141919

@@ -2306,6 +2311,12 @@ class OSILIB_EXPORT OsiSolverInterface {
23062311
//@}
23072312

23082313
CoinStaticConflictGraph *cgraph_;
2314+
2315+
/// Time (CPU seconds) spent building the conflict graph
2316+
double cgraphBuildTime_;
2317+
2318+
/// Density of the conflict graph
2319+
double cgraphDensity_;
23092320
};
23102321

23112322
//#############################################################################

0 commit comments

Comments
 (0)