Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
streamable_solver_init_arguments.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
15
16#include <optional>
17
18#include "absl/status/statusor.h"
22
23namespace operations_research {
24namespace math_opt {
25
28 isv_key_proto.set_name(name);
30 isv_key_proto.set_expiration(expiration);
31 isv_key_proto.set_key(key);
32 return isv_key_proto;
33}
34
36 const GurobiInitializerProto::ISVKey& key_proto) {
37 return GurobiISVKey{
38 .name = key_proto.name(),
39 .application_name = key_proto.application_name(),
40 .expiration = key_proto.expiration(),
41 .key = key_proto.key(),
42 };
43}
44
46 GurobiInitializerProto params_proto;
47
48 if (isv_key) {
49 *params_proto.mutable_isv_key() = isv_key->Proto();
50 }
51
52 return params_proto;
53}
54
56 const GurobiInitializerProto& args_proto) {
58 if (args_proto.has_isv_key()) {
59 args.isv_key = GurobiISVKey::FromProto(args_proto.isv_key());
60 }
61 return args;
62}
63
65 XpressInitializerProto params_proto;
66
67 if (extract_names.has_value()) {
68 params_proto.set_extract_names(extract_names.value());
69 }
70
71 return params_proto;
72}
73
75 const XpressInitializerProto& args_proto) {
77 if (args_proto.has_extract_names()) {
78 args.extract_names = args_proto.extract_names();
79 }
80 return args;
81}
82
84 SolverInitializerProto params_proto;
85
86 if (gurobi) {
87 *params_proto.mutable_gurobi() = gurobi->Proto();
88 }
89 if (xpress) {
90 *params_proto.mutable_xpress() = xpress->Proto();
91 }
92
93 return params_proto;
94}
95
96absl::StatusOr<StreamableSolverInitArguments>
98 const SolverInitializerProto& args_proto) {
100 if (args_proto.has_gurobi()) {
102 }
103 if (args_proto.has_xpress()) {
105 }
106 return args;
107}
108
109} // namespace math_opt
110} // namespace operations_research
::operations_research::math_opt::GurobiInitializerProto_ISVKey *PROTOBUF_NONNULL mutable_isv_key()
Definition gurobi.pb.h:1254
const ::operations_research::math_opt::GurobiInitializerProto_ISVKey & isv_key() const
Definition gurobi.pb.h:1200
::operations_research::math_opt::XpressInitializerProto *PROTOBUF_NONNULL mutable_xpress()
const ::operations_research::math_opt::GurobiInitializerProto & gurobi() const
const ::operations_research::math_opt::XpressInitializerProto & xpress() const
::operations_research::math_opt::GurobiInitializerProto *PROTOBUF_NONNULL mutable_gurobi()
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)