Skip to content

Commit 75b7e7b

Browse files
committed
Increase numlps when copying an LP
1 parent b1f1acc commit 75b7e7b

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

highs/mip/HighsCutPool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ HighsInt HighsCutPool::addCut(const HighsMipSolver& mipsolver, HighsInt* Rindex,
578578
rhs_.resize(rowindex + 1);
579579
ages_.resize(rowindex + 1);
580580
numLps_.resize(rowindex + 1);
581-
numLps_[rowindex] = -1;
582581
rownormalization_.resize(rowindex + 1);
583582
maxabscoef_.resize(rowindex + 1);
584583
rowintegral.resize(rowindex + 1);
@@ -589,6 +588,7 @@ HighsInt HighsCutPool::addCut(const HighsMipSolver& mipsolver, HighsInt* Rindex,
589588
ages_[rowindex] = std::max(HighsInt{0}, agelim_ - 5);
590589
++ageDistribution[ages_[rowindex]];
591590
rowintegral[rowindex] = integral;
591+
numLps_[rowindex] = -1;
592592
if (propagate) propRows.emplace(ages_[rowindex], rowindex);
593593
assert((HighsInt)propRows.size() == numPropRows);
594594

highs/mip/HighsCutPool.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ class HighsCutPool {
146146
ageDistribution.resize(agelim_ + 1);
147147
}
148148

149+
void increaseNumLps(HighsInt cut, HighsInt n) {
150+
assert(numLps_[cut] >= 1);
151+
numLps_[cut].fetch_add(n, std::memory_order_relaxed);
152+
};
153+
149154
void separate(const std::vector<double>& sol, HighsDomain& domprop,
150155
HighsCutSet& cutset, double feastol,
151156
const std::deque<HighsCutPool>& cutpools,

highs/mip/HighsLpRelaxation.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,18 @@ void HighsLpRelaxation::resetAges() {
659659
}
660660
}
661661

662+
void HighsLpRelaxation::notifyCutPoolsLpCopied(HighsInt n) {
663+
HighsInt nlprows = numRows();
664+
HighsInt modelrows = mipsolver.numRow();
665+
for (HighsInt i = modelrows; i != nlprows; ++i) {
666+
if (lprows[i].origin == LpRow::Origin::kCutPool) {
667+
assert(lprows[i].cutpool <= mipsolver.mipdata_->cutpools.size());
668+
mipsolver.mipdata_->cutpools[lprows[i].cutpool].increaseNumLps(
669+
lprows[i].index, n);
670+
}
671+
}
672+
}
673+
662674
void HighsLpRelaxation::flushDomain(HighsDomain& domain, bool continuous) {
663675
if (!domain.getChangedCols().empty()) {
664676
if (&domain == &mipsolver.mipdata_->domain) continuous = true;

highs/mip/HighsLpRelaxation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ class HighsLpRelaxation {
311311

312312
void resetAges();
313313

314+
void notifyCutPoolsLpCopied(HighsInt n);
315+
314316
void removeObsoleteRows(bool notifyPool = true);
315317

316318
void removeCuts(HighsInt ndelcuts, std::vector<HighsInt>& deletemask);

highs/mip/HighsMipSolver.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ void HighsMipSolver::run() {
377377
}
378378
mipdata_->workers[i].upper_bound = mipdata_->upper_bound;
379379
}
380+
if (mip_search_concurrency > 1) {
381+
mipdata_->lp.notifyCutPoolsLpCopied(mip_search_concurrency - 1);
382+
}
380383

381384
// Lambda for combining limit_reached across searches
382385
auto limitReached = [&]() -> bool {
@@ -448,8 +451,13 @@ void HighsMipSolver::run() {
448451
for (HighsMipWorker& worker : mipdata_->workers) {
449452
const auto& domchgstack = worker.globaldom_.getDomainChangeStack();
450453
for (const HighsDomainChange& domchg : domchgstack) {
451-
mipdata_->domain.changeBound(domchg,
452-
HighsDomain::Reason::unspecified());
454+
if ((domchg.boundtype == HighsBoundType::kLower &&
455+
domchg.boundval > mipdata_->domain.col_lower_[domchg.column]) ||
456+
(domchg.boundtype == HighsBoundType::kUpper &&
457+
domchg.boundval < mipdata_->domain.col_upper_[domchg.column])) {
458+
mipdata_->domain.changeBound(domchg,
459+
HighsDomain::Reason::unspecified());
460+
}
453461
}
454462
}
455463
};

0 commit comments

Comments
 (0)