Skip to content

Commit f3ec957

Browse files
committed
Cgraph: add maxCliques parameter to cap stored cliques (default 1200)
New static parameter CoinConflictGraph::maxCliques_ (default 1200) limits the number of large cliques stored explicitly during conflict graph construction. Once the cap is reached, further large cliques (>= minClqRow) are skipped. Small cliques are still expanded into pairwise edges, and fixing detection runs on all rows regardless. Benchmarked on MIPLIB 2017+spp (358 instances): - Only 8 instances affected (those with >1200 cliques) - Zero fixings lost (371,064 identical) - Zero change in clique strengthening results (402,754 extended, 4,403,991 dominated — identical) - Cgraph build: s100 6.5s→2.6s, square47 18s→10.7s - Combined cgraph+clqstr: 408s→399s total
1 parent a32b5a6 commit f3ec957

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

src/CoinConflictGraph.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
// Minimum row length required for the row to be stored as an explicit clique instead of
3434
// being expanded into pairwise conflicts (tunable via setMinCliqueRow).
3535
size_t CoinConflictGraph::minClqRow_ = 256;
36+
size_t CoinConflictGraph::maxCliques_ = 1200;
3637

3738
CoinConflictGraph::CoinConflictGraph(size_t _size) {
3839
iniCoinConflictGraph(_size);
@@ -273,6 +274,14 @@ size_t CoinConflictGraph::getMinCliqueRow() {
273274
return CoinConflictGraph::minClqRow_;
274275
}
275276

277+
void CoinConflictGraph::setMaxCliques(size_t maxClq) {
278+
CoinConflictGraph::maxCliques_ = maxClq;
279+
}
280+
281+
size_t CoinConflictGraph::getMaxCliques() {
282+
return CoinConflictGraph::maxCliques_;
283+
}
284+
276285
void CoinConflictGraph::printSummary() const {
277286
size_t numVertices = 0;
278287
size_t numEdges = 0;

src/CoinConflictGraph.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ class COINUTILSLIB_EXPORT CoinConflictGraph {
241241
**/
242242
static size_t getMinCliqueRow();
243243

244+
/** Set the maximum number of cliques to store during construction.
245+
* Once reached, further large cliques are skipped (small cliques
246+
* are still expanded into pairwise edges). Default: 1200. */
247+
static void setMaxCliques(size_t maxClq);
248+
249+
/** Return the maximum cliques limit. */
250+
static size_t getMaxCliques();
251+
244252
protected:
245253
/**
246254
* Parameter that controls the minimum size of
@@ -249,6 +257,9 @@ class COINUTILSLIB_EXPORT CoinConflictGraph {
249257
**/
250258
static size_t minClqRow_;
251259

260+
/** Maximum number of cliques to store. */
261+
static size_t maxCliques_;
262+
252263
void registerBoundImplicationInfeasibility(const BinaryBoundInfeasibility &info);
253264

254265
/**

src/CoinDynamicConflictGraph.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ CoinDynamicConflictGraph::CoinDynamicConflictGraph(
272272
knapsackRow.copyColumnIndices(tmpClq);
273273

274274
if (nz >= CoinConflictGraph::minClqRow_) {
275-
processClique(tmpClq, nz);
275+
if (largeClqs->nCliques() < CoinConflictGraph::maxCliques_)
276+
processClique(tmpClq, nz);
276277
} else {
277278
smallCliques->addClique(nz, tmpClq);
278279
}
@@ -391,7 +392,8 @@ void CoinDynamicConflictGraph::addCliqueAsNormalConflicts(const size_t idxs[], c
391392
void CoinDynamicConflictGraph::processClique(const size_t idxs[], const size_t size)
392393
{
393394
if (size >= CoinConflictGraph::minClqRow_) {
394-
addClique(size, idxs);
395+
if (largeClqs->nCliques() < CoinConflictGraph::maxCliques_)
396+
addClique(size, idxs);
395397
} else {
396398
addCliqueAsNormalConflicts(idxs, size);
397399
}

0 commit comments

Comments
 (0)