Google OR-Tools
v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
solver_interface_testing.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/math_opt/core/solver_interface_testing.h
"
15
16
#include <utility>
17
18
#include "
ortools/math_opt/core/solver_interface.h
"
19
20
namespace
operations_research::math_opt
{
21
22
WithAlternateAllSolversRegistry::WithAlternateAllSolversRegistry
(
23
WithAlternateAllSolversRegistryConfiguration
configuration)
24
: temporary_registry_(*
AllSolversRegistry
::Instance(), configuration.kept) {
25
for
(
auto
& [solver_type, factory] : configuration.
overridden
) {
26
// LOG(FATAL) if a solver_type is already registered.
27
temporary_registry_.Register(solver_type, std::move(factory));
28
}
29
AllSolversRegistry::SetTemporaryTestInstance(&temporary_registry_);
30
}
31
32
WithAlternateAllSolversRegistry::~WithAlternateAllSolversRegistry
() {
33
AllSolversRegistry::SetTemporaryTestInstance(
nullptr
);
34
}
35
36
}
// namespace operations_research::math_opt
operations_research::math_opt::AllSolversRegistry
Definition
solver_interface.h:181
operations_research::math_opt::WithAlternateAllSolversRegistry::~WithAlternateAllSolversRegistry
~WithAlternateAllSolversRegistry()
Definition
solver_interface_testing.cc:32
operations_research::math_opt::WithAlternateAllSolversRegistry::WithAlternateAllSolversRegistry
WithAlternateAllSolversRegistry(WithAlternateAllSolversRegistryConfiguration configuration)
Definition
solver_interface_testing.cc:22
operations_research::math_opt
Definition
gurobi_isv.cc:28
solver_interface.h
solver_interface_testing.h
operations_research::math_opt::WithAlternateAllSolversRegistryConfiguration
Definition
solver_interface_testing.h:25
operations_research::math_opt::WithAlternateAllSolversRegistryConfiguration::overridden
absl::flat_hash_map< SolverTypeProto, absl_nonnull SolverInterface::Factory > overridden
Definition
solver_interface_testing.h:37
ortools
math_opt
core
solver_interface_testing.cc
Generated by
1.15.0