-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
see review and history in #723 --------- Co-authored-by: Thomas Bittar <[email protected]>
- Loading branch information
Showing
42 changed files
with
1,012 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "BendersMathLogger.h" | ||
|
||
#include "LogUtils.h" | ||
#include "LoggerUtils.h" | ||
|
||
HeadersManager::HeadersManager(HEADERSTYPE type, const BENDERSMETHOD& method) { | ||
headers_list.push_back("Ite"); | ||
headers_list.push_back("Lb"); | ||
if (method == BENDERSMETHOD::BENDERS) { | ||
headers_list.push_back("Ub"); | ||
headers_list.push_back("BestUb"); | ||
headers_list.push_back("AbsGap"); | ||
headers_list.push_back("RelGap"); | ||
} | ||
headers_list.push_back("MinSpx"); | ||
headers_list.push_back("MaxSpx"); | ||
|
||
if (type == HEADERSTYPE::LONG || method == BENDERSMETHOD::BENDERSBYBATCH) { | ||
headers_list.push_back("NbSubPbSolv"); | ||
} | ||
|
||
if (type == HEADERSTYPE::LONG) { | ||
headers_list.push_back("CumulNbSubPbSolv"); | ||
} | ||
headers_list.push_back("IteTime (s)"); | ||
headers_list.push_back("MasterTime (s)"); | ||
headers_list.push_back("SPWallTime (s)"); | ||
if (type == HEADERSTYPE::LONG) { | ||
headers_list.push_back("SPCpuTime (s)"); | ||
headers_list.push_back("NotSolvingWallTime (s)"); | ||
} | ||
} | ||
|
||
LogDestination::LogDestination(std::streamsize width) | ||
: stream_(&std::cout), width_(width) { | ||
(*stream_) << std::unitbuf; | ||
} | ||
|
||
LogDestination::LogDestination(const std::filesystem::path& file_path, | ||
std::streamsize width) | ||
: width_(width) { | ||
file_stream_.open(file_path, std::ofstream::out | std::ofstream::trunc); | ||
if (file_stream_.is_open()) { | ||
stream_ = &file_stream_; | ||
(*stream_) << std::unitbuf; | ||
} else { | ||
std::ostringstream err_msg; | ||
err_msg << PrefixMessage(LogUtils::LOGLEVEL::WARNING, MATHLOGGERCONTEXT) | ||
<< "Could not open the file: " | ||
<< std::quoted(file_path.string().c_str()) << "\n"; | ||
std::cerr << err_msg.str(); | ||
} | ||
} | ||
void MathLoggerDriver::add_logger( | ||
std::shared_ptr<MathLoggerImplementation> logger) { | ||
if (logger) { | ||
math_loggers_.push_back(logger); | ||
} | ||
} | ||
|
||
void MathLoggerDriver::Print(const CurrentIterationData& data) { | ||
for (auto logger : math_loggers_) { | ||
logger->Print(data); | ||
} | ||
} | ||
|
||
void MathLoggerDriver::write_header() { | ||
for (auto logger : math_loggers_) { | ||
logger->write_header(); | ||
} | ||
} | ||
|
||
void MathLoggerDriver::display_message(const std::string& str) { | ||
for (auto logger : math_loggers_) { | ||
logger->display_message(str); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.