Google OR-Tools v9.11
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-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_SAT_CP_MODEL_SOLVER_H_
15#define OR_TOOLS_SAT_CP_MODEL_SOLVER_H_
16
17#include <functional>
18#include <string>
19
20#include "ortools/sat/cp_model.pb.h"
21#include "ortools/sat/model.h"
22#include "ortools/sat/sat_parameters.pb.h"
23
24namespace operations_research {
25namespace sat {
26
28std::string CpSatSolverVersion();
29
31CpSolverResponse Solve(const CpModelProto& model_proto);
32
34CpSolverResponse SolveWithParameters(const CpModelProto& model_proto,
35 const SatParameters& params);
36
38std::string CpModelStats(const CpModelProto& model);
39
46std::string CpSolverResponseStats(const CpSolverResponse& response,
47 bool has_objective = true);
48
60CpSolverResponse SolveCpModel(const CpModelProto& model_proto, Model* model);
61
62#if !defined(__PORTABLE_PLATFORM__)
67CpSolverResponse SolveWithParameters(const CpModelProto& model_proto,
68 const std::string& params);
69#endif // !__PORTABLE_PLATFORM__
70
90std::function<void(Model*)> NewFeasibleSolutionObserver(
91 const std::function<void(const CpSolverResponse& response)>& callback);
92
101std::function<void(Model*)> NewFeasibleSolutionLogCallback(
102 const std::function<std::string(const CpSolverResponse& response)>&
103 callback);
104
111std::function<void(Model*)> NewBestBoundCallback(
112 const std::function<void(double)>& callback);
113
121#if !defined(__PORTABLE_PLATFORM__)
122std::function<SatParameters(Model*)> NewSatParameters(
123 const std::string& params);
124#endif // !__PORTABLE_PLATFORM__
125std::function<SatParameters(Model*)> NewSatParameters(
126 const SatParameters& parameters);
127
128// TODO(user): Clean this up.
130void LoadAndSolveCpModelForTest(const CpModelProto& model_proto, Model* model);
131
132} // namespace sat
133} // namespace operations_research
134
135#endif // OR_TOOLS_SAT_CP_MODEL_SOLVER_H_
SatParameters parameters
GRBmodel * model
MPCallback * callback
CpSolverResponse Solve(const CpModelProto &model_proto)
Solves the given CpModelProto and returns an instance of CpSolverResponse.
std::function< SatParameters(Model *)> NewSatParameters(const std::string &params)
void LoadAndSolveCpModelForTest(const CpModelProto &model_proto, Model *model)
std::string CpModelStats(const CpModelProto &model_proto)
Returns a string with some statistics on the given CpModelProto.
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)
std::function< void(Model *)> NewFeasibleSolutionObserver(const std::function< void(const CpSolverResponse &response)> &callback)
std::string CpSolverResponseStats(const CpSolverResponse &response, bool has_objective)
In SWIG mode, we don't want anything besides these top-level includes.