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