OR-Tools  9.3
streamable_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// This headers defines C++ wrappers of solver specific initialization
15// parameters that can be streamed to be exchanged with another process.
16//
17// Parameters that can't be streamed (for example instances of C/C++ types that
18// only exist in the process memory) are dealt with implementations of
19// the NonStreamableSolverInitArguments.
20#ifndef OR_TOOLS_MATH_OPT_CPP_STREAMABLE_SOLVER_INIT_ARGUMENTS_H_
21#define OR_TOOLS_MATH_OPT_CPP_STREAMABLE_SOLVER_INIT_ARGUMENTS_H_
22
23#include <cstdint>
24#include <optional>
25#include <string>
26
27#include "absl/status/statusor.h"
28#include "ortools/math_opt/parameters.pb.h"
29#include "ortools/math_opt/solvers/gurobi.pb.h"
30
31namespace operations_research {
32namespace math_opt {
33
34// Streamable Pdlp specific parameters for solver instantiation.
36
37// Streamable CpSat specific parameters for solver instantiation.
39
40// Streamable GScip specific parameters for solver instantiation.
42
43// Streamable Glop specific parameters for solver instantiation.
45
46// Streamable Glpk specific parameters for solver instantiation.
48
49// An ISV key for the Gurobi solver.
50//
51// See http://www.gurobi.com/products/licensing-pricing/isv-program.
53 std::string name;
54 std::string application_name;
55 int32_t expiration = 0;
56 std::string key;
57
58 GurobiInitializerProto::ISVKey Proto() const;
60 const GurobiInitializerProto::ISVKey& key_proto);
61};
62
63// Streamable Gurobi specific parameters for solver instantiation.
65 // An optional ISV key to use to instantiate the solver. This is ignored if a
66 // `master_env` is provided in `NonStreamableGurobiInitArguments`.
67 std::optional<GurobiISVKey> isv_key;
68
69 // Returns the proto corresponding to these parameters.
70 GurobiInitializerProto Proto() const;
71
72 // Parses the proto corresponding to these parameters.
74 const GurobiInitializerProto& args_proto);
75};
76
77// Solver initialization parameters that can be streamed to be exchanged with
78// another process.
79//
80// Parameters that can't be streamed (for example instances of C/C++ types that
81// only exist in the process memory) are dealt with implementations of
82// the NonStreamableSolverInitArguments.
84 std::optional<StreamableCpSatInitArguments> cp_sat;
85 std::optional<StreamableGScipInitArguments> gscip;
86 std::optional<StreamableGlopInitArguments> glop;
87 std::optional<StreamableGlpkInitArguments> glpk;
88 std::optional<StreamableGurobiInitArguments> gurobi;
89
90 // Returns the proto corresponding to these parameters.
91 SolverInitializerProto Proto() const;
92
93 // Parses the proto corresponding to these parameters.
94 static absl::StatusOr<StreamableSolverInitArguments> FromProto(
95 const SolverInitializerProto& args_proto);
96};
97
98} // namespace math_opt
99} // namespace operations_research
100
101#endif // OR_TOOLS_MATH_OPT_CPP_STREAMABLE_SOLVER_INIT_ARGUMENTS_H_
Collection of objects used to extend the Constraint Solver library.
static GurobiISVKey FromProto(const GurobiInitializerProto::ISVKey &key_proto)
static StreamableGurobiInitArguments FromProto(const GurobiInitializerProto &args_proto)
static absl::StatusOr< StreamableSolverInitArguments > FromProto(const SolverInitializerProto &args_proto)