Skip to content

Commit

Permalink
ctrl-c not working when search restarted
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhforrest committed Feb 21, 2025
1 parent fee4149 commit b5a21d4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/CbcModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5515,6 +5515,19 @@ void CbcModel::branchAndBound(int doStatistics)
lastEvery1000 = numberNodes_ + 1000;
}
bool redoTree = nodeCompare_->every1000Nodes(this, numberNodes_);
// check for ctrl-c
if (parentModel_ && (specialOptions_&2048)==0) {
// in restarted search
CbcModel * model = parentModel_;
while (model) {
if (model->eventHappened()) {
sayEventHappened();
setProblemStatus(5);
break;
}
model = model->parentModel();
}
}
#ifdef CHECK_CUT_SIZE
verifyCutSize(tree_, *this);
#endif
Expand Down
5 changes: 5 additions & 0 deletions src/CbcModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2180,6 +2180,11 @@ class CBCLIB_EXPORT CbcModel {
{
eventHappened_ = true;
}
/// See if event happened
inline bool eventHappened()
{
return eventHappened_;
}
/// Says if normal solver i.e. has well defined CoinPackedMatrix
inline bool normalSolver() const
{
Expand Down

0 comments on commit b5a21d4

Please sign in to comment.