OR-Tools  8.0
cp_model_search.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_SEARCH_H_
15 #define OR_TOOLS_SAT_CP_MODEL_SEARCH_H_
16 
17 #include <functional>
18 #include <vector>
19 
22 #include "ortools/sat/integer.h"
24 #include "ortools/sat/model.h"
25 
26 namespace operations_research {
27 namespace sat {
28 
29 // Constructs the search strategy specified in the given CpModelProto. A
30 // positive variable ref in the proto is mapped to variable_mapping[ref] in the
31 // model. All the variables referred in the search strategy must be correctly
32 // mapped, the other entries can be set to kNoIntegerVariable.
33 std::function<LiteralIndex()> ConstructSearchStrategy(
34  const CpModelProto& cp_model_proto,
35  const std::vector<IntegerVariable>& variable_mapping,
36  IntegerVariable objective_var, Model* model);
37 
38 // For debugging fixed-search: display information about the named variables
39 // domain before taking each decision. Note that we copy the instrumented
40 // stategy so it doesn't have to outlive the returned functions like the other
41 // arguments.
42 std::function<LiteralIndex()> InstrumentSearchStrategy(
43  const CpModelProto& cp_model_proto,
44  const std::vector<IntegerVariable>& variable_mapping,
45  const std::function<LiteralIndex()>& instrumented_strategy, Model* model);
46 
47 // Returns a different parameters depending on the given worker_id.
48 // This assumes that worker will get an id in [0, num_workers).
49 //
50 // TODO(user): Find a way to know how many search heuristics there are,
51 // and how many threads to pass to LNS with an optimization model.
52 SatParameters DiversifySearchParameters(const SatParameters& params,
53  const CpModelProto& cp_model,
54  const int worker_id, std::string* name);
55 
56 } // namespace sat
57 } // namespace operations_research
58 
59 #endif // OR_TOOLS_SAT_CP_MODEL_SEARCH_H_
integral_types.h
cp_model.pb.h
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::InstrumentSearchStrategy
std::function< LiteralIndex()> InstrumentSearchStrategy(const CpModelProto &cp_model_proto, const std::vector< IntegerVariable > &variable_mapping, const std::function< LiteralIndex()> &instrumented_strategy, Model *model)
Definition: cp_model_search.cc:231
operations_research::sat::DiversifySearchParameters
SatParameters DiversifySearchParameters(const SatParameters &params, const CpModelProto &cp_model, const int worker_id, std::string *name)
Definition: cp_model_search.cc:279
model
GRBmodel * model
Definition: gurobi_interface.cc:195
integer_search.h
operations_research::sat::ConstructSearchStrategy
std::function< LiteralIndex()> ConstructSearchStrategy(const CpModelProto &cp_model_proto, const std::vector< IntegerVariable > &variable_mapping, IntegerVariable objective_var, Model *model)
Definition: cp_model_search.cc:173
integer.h
name
const std::string name
Definition: default_search.cc:807