Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
init.cc
Go to the documentation of this file.
1// Copyright 2010-2025 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#include "ortools/init/init.h"
15
16#include "absl/flags/flag.h"
17#include "absl/flags/usage.h"
18#include "absl/log/globals.h"
19#include "absl/log/initialize.h"
23
24namespace operations_research {
25void CppBridge::InitLogging(const std::string& usage) {
26 absl::SetProgramUsageMessage(usage);
27 absl::InitializeLog();
28}
29
30void CppBridge::SetFlags(const CppFlags& flags) {
31 absl::SetFlag(&FLAGS_stderrthreshold, flags.stderrthreshold);
32 absl::EnableLogPrefix(flags.log_prefix);
33 if (!flags.cp_model_dump_prefix.empty()) {
34 absl::SetFlag(&FLAGS_cp_model_dump_prefix, flags.cp_model_dump_prefix);
35 }
36 absl::SetFlag(&FLAGS_cp_model_dump_models, flags.cp_model_dump_models);
37 absl::SetFlag(&FLAGS_cp_model_dump_submodels, flags.cp_model_dump_submodels);
38 absl::SetFlag(&FLAGS_cp_model_dump_response, flags.cp_model_dump_response);
39}
40
41bool CppBridge::LoadGurobiSharedLibrary(const std::string& full_library_path) {
42 return LoadGurobiDynamicLibrary({full_library_path}).ok();
43}
44
45} // namespace operations_research
static bool LoadGurobiSharedLibrary(const std::string &full_library_path)
Definition init.cc:41
static void SetFlags(const CppFlags &flags)
Definition init.cc:30
static void InitLogging(const std::string &usage)
Definition init.cc:25
In SWIG mode, we don't want anything besides these top-level includes.
absl::Status LoadGurobiDynamicLibrary(std::vector< std::string > potential_paths)
bool log_prefix
Controls if time and source code info are used to prefix logging messages.
Definition init.h:45
int stderrthreshold
Controls the logging level shown on stderr.
Definition init.h:39
std::string cp_model_dump_prefix
Definition init.h:50