Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
cp_model_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_SAT_CP_MODEL_SOLVER_H_
15#define ORTOOLS_SAT_CP_MODEL_SOLVER_H_
16
17#include <functional>
18#include <string>
19
20#include "absl/flags/declare.h"
21#include "absl/strings/string_view.h"
24#include "ortools/sat/model.h"
26
27#ifndef SWIG
28OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_dump_response);
29#endif
30
31namespace operations_research {
32namespace sat {
33
35std::string CpSatSolverVersion();
36
38CpSolverResponse Solve(const CpModelProto& model_proto);
39
41CpSolverResponse SolveWithParameters(const CpModelProto& model_proto,
42 const SatParameters& params);
43
45std::string CpModelStats(const CpModelProto& model);
46
53std::string CpSolverResponseStats(const CpSolverResponse& response,
54 bool has_objective = true);
55
69CpSolverResponse SolveCpModel(const CpModelProto& model_proto, Model* model);
70
71#if !defined(__PORTABLE_PLATFORM__)
76CpSolverResponse SolveWithParameters(const CpModelProto& model_proto,
77 absl::string_view params);
78#endif // !__PORTABLE_PLATFORM__
79
99std::function<void(Model*)> NewFeasibleSolutionObserver(
100 const std::function<void(const CpSolverResponse& response)>& callback);
101
110std::function<void(Model*)> NewFeasibleSolutionLogCallback(
111 const std::function<std::string(const CpSolverResponse& response)>&
112 callback);
113
120std::function<void(Model*)> NewBestBoundCallback(
121 const std::function<void(double)>& callback);
122
130std::function<SatParameters(Model*)> NewSatParameters(absl::string_view params);
131std::function<SatParameters(Model*)> NewSatParameters(
132 const SatParameters& parameters);
133
135void StopSearch(Model* model);
136
137} // namespace sat
138} // namespace operations_research
139
140#endif // ORTOOLS_SAT_CP_MODEL_SOLVER_H_
#define OR_DLL
Definition base_export.h:27
Definition model.h:345
OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_dump_response)
CpSolverResponse Solve(const CpModelProto &model_proto)
Solves the given CpModelProto and returns an instance of CpSolverResponse.
std::string CpModelStats(const CpModelProto &model_proto)
Returns a string with some statistics on the given CpModelProto.
std::function< SatParameters(Model *)> NewSatParameters(absl::string_view params)
std::string CpSatSolverVersion()
Returns a string that describes the version of the solver.
CpSolverResponse SolveCpModel(const CpModelProto &model_proto, Model *model)
std::function< void(Model *)> NewBestBoundCallback(const std::function< void(double)> &callback)
CpSolverResponse SolveWithParameters(const CpModelProto &model_proto, const SatParameters &params)
Solves the given CpModelProto with the given parameters.
std::function< void(Model *)> NewFeasibleSolutionLogCallback(const std::function< std::string(const CpSolverResponse &response)> &callback)
void StopSearch(Model *model)
Stops the current search.
std::function< void(Model *)> NewFeasibleSolutionObserver(const std::function< void(const CpSolverResponse &response)> &callback)
std::string CpSolverResponseStats(const CpSolverResponse &response, bool has_objective)
OR-Tools root namespace.