Google OR-Tools
v9.15
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 <string>
17
18
#include "absl/base/log_severity.h"
19
#include "absl/flags/flag.h"
20
#include "absl/log/globals.h"
21
#include "absl/strings/string_view.h"
22
#include "
ortools/base/init_google.h
"
23
#include "
ortools/sat/cp_model_solver.h
"
24
#include "
ortools/sat/cp_model_utils.h
"
25
#include "
ortools/third_party_solvers/gurobi_environment.h
"
26
27
namespace
operations_research
{
28
void
CppBridge::InitLogging
(absl::string_view usage) {
29
google::InitGoogleLogging
(usage);
30
}
31
32
void
CppBridge::SetFlags
(
const
CppFlags
& flags) {
33
absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo);
34
absl::EnableLogPrefix(flags.
log_prefix
);
35
if
(!flags.
cp_model_dump_prefix
.empty()) {
36
absl::SetFlag(&FLAGS_cp_model_dump_prefix, flags.
cp_model_dump_prefix
);
37
}
38
absl::SetFlag(&FLAGS_cp_model_dump_models, flags.
cp_model_dump_models
);
39
absl::SetFlag(&FLAGS_cp_model_dump_submodels, flags.
cp_model_dump_submodels
);
40
absl::SetFlag(&FLAGS_cp_model_dump_response, flags.
cp_model_dump_response
);
41
}
42
43
bool
CppBridge::LoadGurobiSharedLibrary
(absl::string_view full_library_path) {
44
return
LoadGurobiDynamicLibrary
({full_library_path}).ok();
45
}
46
47
}
// namespace operations_research
operations_research::CppBridge::InitLogging
static void InitLogging(absl::string_view usage)
Definition
init.cc:28
operations_research::CppBridge::SetFlags
static void SetFlags(const CppFlags &flags)
Definition
init.cc:32
operations_research::CppBridge::LoadGurobiSharedLibrary
static bool LoadGurobiSharedLibrary(absl::string_view full_library_path)
Definition
init.cc:43
cp_model_solver.h
cp_model_utils.h
gurobi_environment.h
init.h
init_google.h
google::InitGoogleLogging
void InitGoogleLogging(absl::string_view usage)
Definition
init_google.h:26
operations_research
OR-Tools root namespace.
Definition
binary_indexed_tree.h:21
operations_research::LoadGurobiDynamicLibrary
absl::Status LoadGurobiDynamicLibrary(std::vector< absl::string_view > potential_paths)
Definition
gurobi_environment.cc:416
operations_research::CppFlags
Definition
init.h:30
operations_research::CppFlags::cp_model_dump_models
bool cp_model_dump_models
Definition
init.h:58
operations_research::CppFlags::log_prefix
bool log_prefix
Controls if time and source code info are used to prefix logging messages.
Definition
init.h:45
operations_research::CppFlags::cp_model_dump_prefix
std::string cp_model_dump_prefix
Definition
init.h:50
operations_research::CppFlags::cp_model_dump_response
bool cp_model_dump_response
Definition
init.h:74
operations_research::CppFlags::cp_model_dump_submodels
bool cp_model_dump_submodels
Definition
init.h:66
ortools
init
init.cc
Generated by
1.15.0