OR-Tools
9.3
solver_init_arguments.h
Go to the documentation of this file.
1
// Copyright 2010-2021 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
#ifndef OR_TOOLS_MATH_OPT_CPP_SOLVER_INIT_ARGUMENTS_H_
15
#define OR_TOOLS_MATH_OPT_CPP_SOLVER_INIT_ARGUMENTS_H_
16
17
#include <memory>
18
19
#include "
ortools/math_opt/core/non_streamable_solver_init_arguments.h
"
// IWYU pragma: export
20
#include "
ortools/math_opt/cpp/streamable_solver_init_arguments.h
"
// IWYU pragma: export
21
22
namespace
operations_research::math_opt
{
23
24
// Arguments passed to Solve() and IncrementalSolver::New() to control the
25
// instantiation of the solver.
26
//
27
// For convenience, constructors with streamable or/and non-streamable arguments
28
// are provided. The non-streamable arguments are cloned so any change made
29
// after passing them to this class are ignored.
30
//
31
// Usage with streamable arguments:
32
//
33
// Solve(model, SOLVER_TYPE_GUROBI, /*solver_args=*/{},
34
// SolverInitArguments({
35
// .gurobi = StreamableGurobiInitArguments{
36
// .isv_key = GurobiISVKey{
37
// .name = "some name",
38
// .application_name = "some app name",
39
// .expiration = -1,
40
// .key = "random",
41
// }
42
// }
43
// });
44
//
45
// Usage with non-streamable arguments:
46
//
47
// NonStreamableGurobiInitArguments gurobi_args;
48
// gurobi_args.master_env = master_env.get();
49
//
50
// Solve(model, SOLVER_TYPE_GUROBI, /*solver_args=*/{},
51
// SolverInitArguments(gurobi_args));
52
//
53
struct
SolverInitArguments
{
54
SolverInitArguments
() =
default
;
55
56
// Initializes this class with the provided streamable arguments.
57
explicit
SolverInitArguments
(
StreamableSolverInitArguments
streamable
);
58
59
// Initializes this class with a clone of the provided non-streamable
60
// arguments.
61
//
62
// Note that since this constructors calls Clone() to initialize the
63
// non_streamable_solver_init_arguments field, changes made after calling it
64
// to the input non_streamable are ignored.
65
explicit
SolverInitArguments
(
66
const
NonStreamableSolverInitArguments
&
non_streamable
);
67
68
// Initializes this class with both the provided streamable arguments and a
69
// clone of the non-streamable ones.
70
SolverInitArguments
(
StreamableSolverInitArguments
streamable
,
71
const
NonStreamableSolverInitArguments
&
non_streamable
);
72
73
// Initializes this class as a copy of the provided arguments. The
74
// non_streamable field is cloned if not nullptr.
75
SolverInitArguments
(
const
SolverInitArguments
& other);
76
77
// Sets this class as a copy of the provided arguments. The non_streamable
78
// field is cloned if not nullptr.
79
SolverInitArguments
&
operator=
(
const
SolverInitArguments
& other);
80
81
SolverInitArguments
(
SolverInitArguments
&&) =
default
;
82
SolverInitArguments
&
operator=
(
SolverInitArguments
&&) =
default
;
83
84
StreamableSolverInitArguments
streamable
;
85
86
// This should either be the solver specific class or nullptr.
87
//
88
// Solvers will fail (by returning an absl::Status) if called with arguments
89
// for another solver.
90
std::unique_ptr<const NonStreamableSolverInitArguments>
non_streamable
;
91
};
92
93
}
// namespace operations_research::math_opt
94
95
#endif
// OR_TOOLS_MATH_OPT_CPP_SOLVER_INIT_ARGUMENTS_H_
operations_research::math_opt
Definition:
arrow_operator_proxy.h:20
non_streamable_solver_init_arguments.h
streamable_solver_init_arguments.h
operations_research::math_opt::NonStreamableSolverInitArguments
Definition:
non_streamable_solver_init_arguments.h:48
operations_research::math_opt::SolverInitArguments
Definition:
solver_init_arguments.h:53
operations_research::math_opt::SolverInitArguments::SolverInitArguments
SolverInitArguments(SolverInitArguments &&)=default
operations_research::math_opt::SolverInitArguments::SolverInitArguments
SolverInitArguments()=default
operations_research::math_opt::SolverInitArguments::operator=
SolverInitArguments & operator=(const SolverInitArguments &other)
Definition:
solver_init_arguments.cc:41
operations_research::math_opt::SolverInitArguments::operator=
SolverInitArguments & operator=(SolverInitArguments &&)=default
operations_research::math_opt::SolverInitArguments::non_streamable
std::unique_ptr< const NonStreamableSolverInitArguments > non_streamable
Definition:
solver_init_arguments.h:90
operations_research::math_opt::SolverInitArguments::streamable
StreamableSolverInitArguments streamable
Definition:
solver_init_arguments.h:84
operations_research::math_opt::StreamableSolverInitArguments
Definition:
streamable_solver_init_arguments.h:83
ortools
math_opt
cpp
solver_init_arguments.h
Generated by
1.9.3