Google OR-Tools v9.11
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-2024 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"
25
26namespace operations_research {
27
28// Solves the input request.
29//
30// By default this function creates a new primary Gurobi environment, but an
31// existing one can be passed as parameter. This can be useful with single-use
32// Gurobi licenses since it is not possible to create a second environment if
33// one already exists with those licenses.
34//
35// Please note though that the provided environment should not be actively used
36// by another thread at the same time.
37absl::StatusOr<MPSolutionResponse> GurobiSolveProto(
38 LazyMutableCopy<MPModelRequest> request, GRBenv* gurobi_env = nullptr);
39
40// Set parameters specified in the string. The format of the string is a series
41// of tokens separated by either '\n' or by ',' characters.
42// Any token whose first character is a '#' or has zero length is skipped.
43// Comment tokens (i.e. those starting with #) can contain ',' characters.
44// Any other token has the form:
45// parameter_name(separator)value
46// where (separator) is either '=' or ' '.
47// A valid string can look-like:
48// "#\n# Gurobi-specific parameters, still part of the
49// comment\n\nThreads=1\nPresolve 2,SolutionLimit=100" This function will
50// process each and every token, even if an intermediate token is unrecognized.
51absl::Status SetSolverSpecificParameters(absl::string_view parameters,
52 GRBenv* gurobi);
53} // namespace operations_research
54#endif // OR_TOOLS_LINEAR_SOLVER_PROTO_SOLVER_GUROBI_PROTO_SOLVER_H_
SatParameters parameters
Gurobi * gurobi
Definition g_gurobi.cc:45
struct _GRBenv GRBenv
Definition environment.h:32
In SWIG mode, we don't want anything besides these top-level includes.
absl::StatusOr< MPSolutionResponse > GurobiSolveProto(LazyMutableCopy< MPModelRequest > request, GRBenv *gurobi_env)
absl::Status SetSolverSpecificParameters(absl::string_view parameters, GRBenv *gurobi)