OR-Tools  8.0
cp_model_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_SAT_CP_MODEL_SOLVER_H_
15 #define OR_TOOLS_SAT_CP_MODEL_SOLVER_H_
16 
17 #include <functional>
18 #include <string>
19 #include <vector>
20 
23 #include "ortools/sat/model.h"
25 
26 namespace operations_research {
27 namespace sat {
28 
30 CpSolverResponse Solve(const CpModelProto& model_proto);
31 
33 CpSolverResponse SolveWithParameters(const CpModelProto& model_proto,
34  const SatParameters& params);
35 
37 std::string CpModelStats(const CpModelProto& model);
38 
45 std::string CpSolverResponseStats(const CpSolverResponse& response,
46  bool has_objective = true);
47 
59 CpSolverResponse SolveCpModel(const CpModelProto& model_proto, Model* model);
60 
61 #if !defined(__PORTABLE_PLATFORM__)
62 
66 CpSolverResponse SolveWithParameters(const CpModelProto& model_proto,
67  const std::string& params);
68 #endif // !__PORTABLE_PLATFORM__
69 
78 std::function<void(Model*)> NewFeasibleSolutionObserver(
79  const std::function<void(const CpSolverResponse& response)>& observer);
80 
92 void SetSynchronizationFunction(std::function<CpSolverResponse()> f,
93  Model* model);
94 
102 #if !defined(__PORTABLE_PLATFORM__)
103 std::function<SatParameters(Model*)> NewSatParameters(
104  const std::string& params);
105 #endif // !__PORTABLE_PLATFORM__
106 std::function<SatParameters(Model*)> NewSatParameters(
107  const SatParameters& parameters);
108 
109 } // namespace sat
110 } // namespace operations_research
111 
112 #endif // OR_TOOLS_SAT_CP_MODEL_SOLVER_H_
response
SharedResponseManager * response
Definition: cp_model_solver.cc:2027
integral_types.h
cp_model.pb.h
operations_research::sat::NewFeasibleSolutionObserver
std::function< void(Model *)> NewFeasibleSolutionObserver(const std::function< void(const CpSolverResponse &response)> &observer)
Creates a solution observer with the model with model.Add(NewFeasibleSolutionObserver([](response){....
Definition: cp_model_solver.cc:862
model_proto
CpModelProto const * model_proto
Definition: cp_model_solver.cc:2023
model.h
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition: dense_doubly_linked_list.h:21
operations_research::sat::Model
Class that owns everything related to a particular optimization model.
Definition: sat/model.h:38
sat_parameters.pb.h
operations_research::sat::CpModelStats
std::string CpModelStats(const CpModelProto &model_proto)
Returns a string with some statistics on the given CpModelProto.
Definition: cp_model_solver.cc:147
operations_research::sat::NewSatParameters
std::function< SatParameters(Model *)> NewSatParameters(const std::string &params)
Creates parameters for the solver, which you can add to the model with.
Definition: cp_model_solver.cc:871
model
GRBmodel * model
Definition: gurobi_interface.cc:195
operations_research::sat::SolveCpModel
CpSolverResponse SolveCpModel(const CpModelProto &model_proto, Model *model)
Solves the given CpModelProto.
Definition: cp_model_solver.cc:2822
operations_research::sat::CpSolverResponseStats
std::string CpSolverResponseStats(const CpSolverResponse &response, bool has_objective)
Returns a string with some statistics on the solver response.
Definition: cp_model_solver.cc:269
operations_research::sat::Solve
CpSolverResponse Solve(const CpModelProto &model_proto)
Solves the given CpModelProto and returns an instance of CpSolverResponse.
Definition: cp_model_solver.cc:3150
operations_research::sat::SetSynchronizationFunction
void SetSynchronizationFunction(std::function< CpSolverResponse()> f, Model *model)
If set, the underlying solver will call this function regularly in a deterministic way.
parameters
SatParameters parameters
Definition: cp_model_fz_solver.cc:107
operations_research::sat::SolveWithParameters
CpSolverResponse SolveWithParameters(const CpModelProto &model_proto, const SatParameters &params)
Solves the given CpModelProto with the given parameters.
Definition: cp_model_solver.cc:3155