OR-Tools  9.6
gurobi_proto_solver.h
Go to the documentation of this file.
1 // Copyright 2010-2022 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_LINEAR_SOLVER_PROTO_SOLVER_GUROBI_PROTO_SOLVER_H_
15 #define OR_TOOLS_LINEAR_SOLVER_PROTO_SOLVER_GUROBI_PROTO_SOLVER_H_
16 
17 #include <string>
18 
19 #include "absl/status/status.h"
20 #include "absl/status/statusor.h"
21 #include "absl/strings/string_view.h"
23 #include "ortools/linear_solver/linear_solver.pb.h"
24 
25 namespace operations_research {
26 
27 // Solves the input request.
28 //
29 // By default this function creates a new primary Gurobi environment, but an
30 // existing one can be passed as parameter. This can be useful with single-use
31 // Gurobi licenses since it is not possible to create a second environment if
32 // one already exists with those licenses.
33 //
34 // Please note though that the provided environment should not be actively used
35 // by another thread at the same time.
36 absl::StatusOr<MPSolutionResponse> GurobiSolveProto(
37  const MPModelRequest& request, GRBenv* gurobi_env = nullptr);
38 
39 // Set parameters specified in the string. The format of the string is a series
40 // of tokens separated by either '\n' or by ',' characters.
41 // Any token whose first character is a '#' or has zero length is skiped.
42 // Comment tokens (i.e. those starting with #) can contain ',' characters.
43 // Any other token has the form:
44 // parameter_name(separator)value
45 // where (separator) is either '=' or ' '.
46 // A valid string can look-like:
47 // "#\n# Gurobi-specific parameters, still part of the
48 // comment\n\nThreads=1\nPresolve 2,SolutionLimit=100" This function will
49 // process each and every token, even if an intermediate token is unrecognized.
50 absl::Status SetSolverSpecificParameters(absl::string_view parameters,
51  GRBenv* gurobi);
52 } // namespace operations_research
53 #endif // OR_TOOLS_LINEAR_SOLVER_PROTO_SOLVER_GUROBI_PROTO_SOLVER_H_
SatParameters parameters
struct _GRBenv GRBenv
Definition: environment.h:32
Gurobi * gurobi
Definition: g_gurobi.cc:42
Collection of objects used to extend the Constraint Solver library.
absl::Status SetSolverSpecificParameters(absl::string_view parameters, GRBenv *gurobi)
absl::StatusOr< MPSolutionResponse > GurobiSolveProto(const MPModelRequest &request, GRBenv *gurobi_env)