Google OR-Tools v9.14
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"
21
22namespace operations_research {
23namespace math_opt {
24
27 isv_key_proto.set_name(name);
29 isv_key_proto.set_expiration(expiration);
30 isv_key_proto.set_key(key);
31 return isv_key_proto;
32}
33
35 const GurobiInitializerProto::ISVKey& key_proto) {
36 return GurobiISVKey{
37 .name = key_proto.name(),
38 .application_name = key_proto.application_name(),
39 .expiration = key_proto.expiration(),
40 .key = key_proto.key(),
41 };
42}
43
45 GurobiInitializerProto params_proto;
46
47 if (isv_key) {
48 *params_proto.mutable_isv_key() = isv_key->Proto();
49 }
50
51 return params_proto;
52}
53
55 const GurobiInitializerProto& args_proto) {
57 if (args_proto.has_isv_key()) {
58 args.isv_key = GurobiISVKey::FromProto(args_proto.isv_key());
59 }
60 return args;
61}
62
64 SolverInitializerProto params_proto;
65
66 if (gurobi) {
67 *params_proto.mutable_gurobi() = gurobi->Proto();
68 }
69
70 return params_proto;
71}
72
73absl::StatusOr<StreamableSolverInitArguments>
75 const SolverInitializerProto& args_proto) {
77 if (args_proto.has_gurobi()) {
79 }
80 return args;
81}
82
83} // namespace math_opt
84} // namespace operations_research
bool has_isv_key() const
.operations_research.math_opt.GurobiInitializerProto.ISVKey isv_key = 1;
Definition gurobi.pb.h:1186
GurobiInitializerProto_ISVKey ISVKey
nested types -------------------------------------------------—
Definition gurobi.pb.h:886
::operations_research::math_opt::GurobiInitializerProto_ISVKey *PROTOBUF_NONNULL mutable_isv_key()
Definition gurobi.pb.h:1255
const ::operations_research::math_opt::GurobiInitializerProto_ISVKey & isv_key() const
Definition gurobi.pb.h:1201
const ::operations_research::math_opt::GurobiInitializerProto & gurobi() const
bool has_gurobi() const
.operations_research.math_opt.GurobiInitializerProto gurobi = 1;
::operations_research::math_opt::GurobiInitializerProto *PROTOBUF_NONNULL mutable_gurobi()
An object oriented wrapper for quadratic constraints in ModelStorage.
Definition gurobi_isv.cc:28
In SWIG mode, we don't want anything besides these top-level includes.
static GurobiISVKey FromProto(const GurobiInitializerProto::ISVKey &key_proto)
Streamable Gurobi specific parameters for solver instantiation.
static StreamableGurobiInitArguments FromProto(const GurobiInitializerProto &args_proto)
Parses the proto corresponding to these parameters.
GurobiInitializerProto Proto() const
Returns the proto corresponding to these parameters.
SolverInitializerProto Proto() const
Returns the proto corresponding to these parameters.
static absl::StatusOr< StreamableSolverInitArguments > FromProto(const SolverInitializerProto &args_proto)
Parses the proto corresponding to these parameters.