Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
streamable_solver_init_arguments.h
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// IWYU pragma: private, include "ortools/math_opt/cpp/math_opt.h"
15// IWYU pragma: friend "ortools/math_opt/cpp/.*"
16
17// This headers defines C++ wrappers of solver specific initialization
18// parameters that can be streamed to be exchanged with another process.
19//
20// Parameters that can't be streamed (for example instances of C/C++ types that
21// only exist in the process memory) are dealt with implementations of
22// the NonStreamableSolverInitArguments.
23#ifndef ORTOOLS_MATH_OPT_CPP_STREAMABLE_SOLVER_INIT_ARGUMENTS_H_
24#define ORTOOLS_MATH_OPT_CPP_STREAMABLE_SOLVER_INIT_ARGUMENTS_H_
25
26#include <cstdint>
27#include <optional>
28#include <string>
29
30#include "absl/status/statusor.h"
33
34namespace operations_research {
35namespace math_opt {
36
37// Streamable Pdlp specific parameters for solver instantiation.
39
40// Streamable CpSat specific parameters for solver instantiation.
42
43// Streamable GScip specific parameters for solver instantiation.
45
46// Streamable Glop specific parameters for solver instantiation.
48
49// Streamable Glpk specific parameters for solver instantiation.
51
52// An ISV key for the Gurobi solver.
53//
54// See http://www.gurobi.com/products/licensing-pricing/isv-program.
56 std::string name;
57 std::string application_name;
58 int32_t expiration = 0;
59 std::string key;
60
63 const GurobiInitializerProto::ISVKey& key_proto);
64};
65
66// Streamable Gurobi specific parameters for solver instantiation.
68 // An optional ISV key to use to instantiate the solver. This is ignored if a
69 // `primary_env` is provided in `NonStreamableGurobiInitArguments`.
70 std::optional<GurobiISVKey> isv_key;
71
72 // Returns the proto corresponding to these parameters.
74
75 // Parses the proto corresponding to these parameters.
77 const GurobiInitializerProto& args_proto);
78};
79
80// Streamable Xpress specific parameters for solver instantiation.
82 // If present and set to true then variable and constraint names are
83 // extracted into the underlying Xpress instance. This can help debugging
84 // (especially if models are exported to disk) but also incurs runtime and
85 // memory overhead.
86 std::optional<bool> extract_names;
87
88 // Returns the proto corresponding to these parameters.
90
91 // Parses the proto corresponding to these parameters.
93 const XpressInitializerProto& args_proto);
94};
95
96// Solver initialization parameters that can be streamed to be exchanged with
97// another process.
98//
99// Parameters that can't be streamed (for example instances of C/C++ types that
100// only exist in the process memory) are dealt with implementations of
101// the NonStreamableSolverInitArguments.
103 std::optional<StreamableCpSatInitArguments> cp_sat;
104 std::optional<StreamableGScipInitArguments> gscip;
105 std::optional<StreamableGlopInitArguments> glop;
106 std::optional<StreamableGlpkInitArguments> glpk;
107 std::optional<StreamableGurobiInitArguments> gurobi;
108 std::optional<StreamableXpressInitArguments> xpress;
109
110 // Returns the proto corresponding to these parameters.
112
113 // Parses the proto corresponding to these parameters.
114 static absl::StatusOr<StreamableSolverInitArguments> FromProto(
115 const SolverInitializerProto& args_proto);
116};
117
118} // namespace math_opt
119} // namespace operations_research
120
121#endif // ORTOOLS_MATH_OPT_CPP_STREAMABLE_SOLVER_INIT_ARGUMENTS_H_
OR-Tools root namespace.
static GurobiISVKey FromProto(const GurobiInitializerProto::ISVKey &key_proto)
static StreamableGurobiInitArguments FromProto(const GurobiInitializerProto &args_proto)
static absl::StatusOr< StreamableSolverInitArguments > FromProto(const SolverInitializerProto &args_proto)
static StreamableXpressInitArguments FromProto(const XpressInitializerProto &args_proto)