expand init API
This commit is contained in:
@@ -100,6 +100,8 @@ public class CsIntegerProgramming
|
||||
|
||||
static void Main()
|
||||
{
|
||||
Google.OrTools.Init.Init.InitCppLogging("csintegerprogramming.cs", true, false);
|
||||
|
||||
Console.WriteLine("---- Integer programming example with GLPK ----");
|
||||
RunIntegerProgrammingExample("GLPK");
|
||||
Console.WriteLine("---- Linear programming example with CBC ----");
|
||||
|
||||
@@ -116,5 +116,7 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
init.Init.InitCppLogging('integer_programming.py', False)
|
||||
init.Init.InitCppLogging('integer_programming.py',
|
||||
/*logtostderr=*/True,
|
||||
/*log_prefix=*/False);
|
||||
main()
|
||||
|
||||
@@ -15,17 +15,20 @@ class Init {
|
||||
// Initialize the C++ logging layer.
|
||||
// If logtostderr is false, all C++ logging will be ignored.
|
||||
// If true, all logging will the displayed on stderr.
|
||||
static void InitCppLogging(const std::string& program_name, bool logtostderr) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, logtostderr);
|
||||
google::InitGoogleLogging(program_name.c_str());
|
||||
}
|
||||
static void InitCppLogging(const std::string& program_name, bool logtostderr,
|
||||
bool log_prefix) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, logtostderr);
|
||||
absl::SetFlag(&FLAGS_log_prefix, log_prefix);
|
||||
google::InitGoogleLogging(program_name.c_str());
|
||||
}
|
||||
|
||||
// Load the gurobi shared library.
|
||||
// This is necessary if the library is installed in a non canonical
|
||||
// directory, or if for any reason, it is not found.
|
||||
// You need to pass the full path, including the shared library file.
|
||||
static void LoadGurobiSharedLibrary(const std::string& full_library_path) {
|
||||
LoadGurobiDynamicLibrary({full_library_path});
|
||||
// It returns true if the library was found and correctly loaded.
|
||||
static bool LoadGurobiSharedLibrary(const std::string& full_library_path) {
|
||||
return LoadGurobiDynamicLibrary({full_library_path}).ok();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user