OR-Tools  8.2
sat_proto_solver.h
Go to the documentation of this file.
1 // Copyright 2010-2018 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_SAT_PROTO_SOLVER_H_
15 #define OR_TOOLS_LINEAR_SOLVER_SAT_PROTO_SOLVER_H_
16 
17 #include "absl/status/statusor.h"
18 #include "ortools/linear_solver/linear_solver.pb.h"
19 #include "ortools/sat/sat_parameters.pb.h"
20 
21 namespace operations_research {
22 
23 // Solve the input MIP model with the SAT solver.
24 //
25 // If possible, std::move the request into this function call to avoid a copy.
26 //
27 // If you need to change the solver parameters, please use the
28 // EncodeSatParametersAsString() function below to set the request's
29 // solver_specific_parameters field.
30 absl::StatusOr<MPSolutionResponse> SatSolveProto(
31  MPModelRequest request, std::atomic<bool>* interrupt_solve = nullptr);
32 
33 // Returns a string that should be used in MPModelRequest's
34 // solver_specific_parameters field to encode the SAT parameters.
35 //
36 // The returned string's content depends on the version of the proto library
37 // that is linked in the binary.
38 //
39 // By default it will contain the textual representation of the input proto.
40 // But when the proto-lite is used, it will contain the binary stream of the
41 // proto instead since it is not possible to build the textual representation in
42 // that case.
43 //
44 // The SatSolveProto() function will test if the proto-lite is used and expect a
45 // binary stream when it is the case. So in order for your code to be portable,
46 // you should always use this function to set the specific parameters.
47 std::string EncodeSatParametersAsString(const sat::SatParameters& parameters);
48 
49 } // namespace operations_research
50 
51 #endif // OR_TOOLS_LINEAR_SOLVER_SAT_PROTO_SOLVER_H_
SatParameters parameters
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
std::string EncodeSatParametersAsString(const sat::SatParameters &parameters)
absl::StatusOr< MPSolutionResponse > SatSolveProto(MPModelRequest request, std::atomic< bool > *interrupt_solve)