Google OR-Tools
v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
sat_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 OR_TOOLS_LINEAR_SOLVER_PROTO_SOLVER_SAT_PROTO_SOLVER_H_
15
#define OR_TOOLS_LINEAR_SOLVER_PROTO_SOLVER_SAT_PROTO_SOLVER_H_
16
17
#include <atomic>
18
#include <functional>
19
#include <string>
20
21
#include "
ortools/linear_solver/linear_solver.pb.h
"
22
#include "
ortools/util/lazy_mutable_copy.h
"
23
#include "
ortools/util/logging.h
"
24
25
namespace
operations_research
{
26
27
// Solve the input MIP model with the SAT solver.
28
//
29
// If possible, std::move the request into this function call to avoid a copy.
30
//
31
// If you need to change the solver parameters, please use the
32
// EncodeParametersAsString() function to set the request's
33
// solver_specific_parameters field.
34
//
35
// The optional interrupt_solve can be used to interrupt the solve early. It
36
// must only be set to true, never reset to false. It is also used internally by
37
// the solver that will set it to true for its own internal logic. As a
38
// consequence the caller should ignore the stored value and should not use the
39
// same atomic for different concurrent calls.
40
//
41
// The optional logging_callback will be called when the SAT parameter
42
// log_search_progress is set to true. Passing a callback will disable the
43
// default logging to INFO. Note though that by default the SAT parameter
44
// log_to_stdout is true so even with a callback, the logs will appear on stdout
45
// too unless log_to_stdout is set to false. The enable_internal_solver_output
46
// in the request will act as the SAT parameter log_search_progress.
47
//
48
// The optional solution_callback will be called on each intermediate solution
49
// found by the solver. The solver may call solution_callback from multiple
50
// threads, but it will ensure that at most one thread executes
51
// solution_callback at a time.
52
MPSolutionResponse
SatSolveProto
(
53
LazyMutableCopy<MPModelRequest>
request,
54
std::atomic<bool>* interrupt_solve =
nullptr
,
55
std::function<
void
(
const
std::string&)> logging_callback =
nullptr
,
56
std::function<
void
(
const
MPSolution
&)> solution_callback =
nullptr
);
57
58
// Returns a string that describes the version of the CP-SAT solver.
59
std::string
SatSolverVersion
();
60
61
}
// namespace operations_research
62
63
#endif
// OR_TOOLS_LINEAR_SOLVER_PROTO_SOLVER_SAT_PROTO_SOLVER_H_
operations_research::LazyMutableCopy
Definition
lazy_mutable_copy.h:44
operations_research::MPSolutionResponse
Definition
linear_solver.pb.h:3761
operations_research::MPSolution
Definition
linear_solver.pb.h:1507
lazy_mutable_copy.h
linear_solver.pb.h
operations_research
In SWIG mode, we don't want anything besides these top-level includes.
Definition
binary_indexed_tree.h:21
operations_research::SatSolveProto
MPSolutionResponse SatSolveProto(LazyMutableCopy< MPModelRequest > request, std::atomic< bool > *interrupt_solve, std::function< void(const std::string &)> logging_callback, std::function< void(const MPSolution &)> solution_callback)
Definition
sat_proto_solver.cc:160
operations_research::SatSolverVersion
std::string SatSolverVersion()
Returns a string that describes the version of the CP-SAT solver.
Definition
sat_proto_solver.cc:493
logging.h
ortools
linear_solver
proto_solver
sat_proto_solver.h
Generated by
1.14.0