Skip to content

Commit

Permalink
TMP: better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrockm committed Oct 10, 2023
1 parent db71451 commit d17606d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 3 additions & 4 deletions tsplp/src/BranchAndCutQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void tsplp::BranchAndCutQueue::Print() const
std::cout << std::endl;
}

std::cout << "worked on LBs: ";
std::cout << "\nworked on LBs: ";
for (size_t i = 0; i < m_workedOnLowerBounds.size(); ++i)
{
if (m_workedOnLowerBounds[i])
Expand All @@ -195,9 +195,8 @@ void tsplp::BranchAndCutQueue::Print() const
{
std::cout << i << ":<>";
}

std::cout << std::endl;
std::cout << " ";
}

std::cout << "is cleared: " << m_isCleared << std::endl << std::endl;
std::cout << "\nis cleared: " << m_isCleared << std::endl << std::endl;
}
13 changes: 11 additions & 2 deletions tsplp/src/MtspModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,17 @@ void tsplp::MtspModel::BranchAndCutSolve(
{
const auto initialBounds = m_bestResult.UpdateLowerBound(queue.GetLowerBound());

if (std::chrono::steady_clock::now() >= m_endTime
|| initialBounds.Lower >= initialBounds.Upper)
if (initialBounds.Lower >= initialBounds.Upper)
{
queue.ClearAll();
std::cout << "thread " << threadId << " exited because bounds crossed" << std::endl;
break;
}

if (std::chrono::steady_clock::now() >= m_endTime)
{
queue.ClearAll();
std::cout << "thread " << threadId << " exited because timeout" << std::endl;
break;
}

Expand All @@ -330,6 +337,8 @@ void tsplp::MtspModel::BranchAndCutSolve(
auto top = queue.Pop(threadId);
if (!top.has_value())
{
std::cout << "thread " << threadId << " exited because Pop returned nothing"
<< std::endl;
break;
}

Expand Down

0 comments on commit d17606d

Please sign in to comment.