OR-Tools  9.3
gurobi_proto_solver.h
Go to the documentation of this file.
1// Copyright 2010-2021 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_GUROBI_PROTO_SOLVER_H_
15#define OR_TOOLS_LINEAR_SOLVER_GUROBI_PROTO_SOLVER_H_
16
17#include <string>
18
19#include "absl/status/status.h"
20#include "absl/status/statusor.h"
22#include "ortools/linear_solver/linear_solver.pb.h"
23
24namespace operations_research {
25
26// Solves the input request.
27//
28// By default this function creates a new master 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 const 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 skiped.
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(const std::string& parameters,
50 GRBenv* gurobi);
51} // namespace operations_research
52#endif // OR_TOOLS_LINEAR_SOLVER_GUROBI_PROTO_SOLVER_H_
SatParameters parameters
struct _GRBenv GRBenv
Definition: environment.h:25
Gurobi * gurobi
Definition: g_gurobi.cc:36
Collection of objects used to extend the Constraint Solver library.
absl::Status SetSolverSpecificParameters(const std::string &parameters, GRBenv *gurobi)
absl::StatusOr< MPSolutionResponse > GurobiSolveProto(const MPModelRequest &request, GRBenv *gurobi_env)