OR-Tools  9.3
cp_model_solver.h
Go to the documentation of this file.
1// Copyright 2010-2021 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
22#include "ortools/sat/cp_model.pb.h"
23#include "ortools/sat/model.h"
24#include "ortools/sat/sat_parameters.pb.h"
25
26namespace operations_research {
27namespace sat {
28
30CpSolverResponse Solve(const CpModelProto& model_proto);
31
33CpSolverResponse SolveWithParameters(const CpModelProto& model_proto,
34 const SatParameters& params);
35
37std::string CpModelStats(const CpModelProto& model);
38
45std::string CpSolverResponseStats(const CpSolverResponse& response,
46 bool has_objective = true);
47
59CpSolverResponse SolveCpModel(const CpModelProto& model_proto, Model* model);
60
61#if !defined(__PORTABLE_PLATFORM__)
66CpSolverResponse SolveWithParameters(const CpModelProto& model_proto,
67 const std::string& params);
68#endif // !__PORTABLE_PLATFORM__
69
89std::function<void(Model*)> NewFeasibleSolutionObserver(
90 const std::function<void(const CpSolverResponse& response)>& observer);
91
99#if !defined(__PORTABLE_PLATFORM__)
100std::function<SatParameters(Model*)> NewSatParameters(
101 const std::string& params);
102#endif // !__PORTABLE_PLATFORM__
103std::function<SatParameters(Model*)> NewSatParameters(
104 const SatParameters& parameters);
105
106} // namespace sat
107} // namespace operations_research
108
109#endif // OR_TOOLS_SAT_CP_MODEL_SOLVER_H_
Class that owns everything related to a particular optimization model.
Definition: sat/model.h:42
SatParameters parameters
CpModelProto const * model_proto
SharedResponseManager * response
GRBmodel * model
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){....
std::function< SatParameters(Model *)> NewSatParameters(const std::string &params)
Creates parameters for the solver, which you can add to the model with.
std::string CpSolverResponseStats(const CpSolverResponse &response, bool has_objective)
Returns a string with some statistics on the solver response.
std::string CpModelStats(const CpModelProto &model_proto)
Returns a string with some statistics on the given CpModelProto.
CpSolverResponse SolveCpModel(const CpModelProto &model_proto, Model *model)
Solves the given CpModelProto.
CpSolverResponse SolveWithParameters(const CpModelProto &model_proto, const SatParameters &params)
Solves the given CpModelProto with the given parameters.
CpSolverResponse Solve(const CpModelProto &model_proto)
Solves the given CpModelProto and returns an instance of CpSolverResponse.
Collection of objects used to extend the Constraint Solver library.