14#ifndef OR_TOOLS_SAT_CP_MODEL_SEARCH_H_
15#define OR_TOOLS_SAT_CP_MODEL_SEARCH_H_
22#include "absl/container/flat_hash_map.h"
24#include "ortools/sat/cp_model.pb.h"
30#include "ortools/sat/sat_parameters.pb.h"
52 int64_t
Min(
int var)
const;
53 int64_t
Max(
int var)
const;
69 const CpModelProto& cp_model_proto,
Model*
model);
73 const CpModelProto& cp_model_proto,
Model*
model);
78 const std::vector<IntegerVariable>& variable_mapping,
98 const CpModelProto& cp_model_proto,
99 const std::vector<IntegerVariable>& variable_mapping,
109 SatParameters base_params);
114 const SatParameters& base_params,
const CpModelProto& cp_model,
123 absl::Span<const SatParameters> base_params,
int num_params_to_generate);
129 const SatParameters& base_params);
141 std::vector<SatParameters>
Filter(absl::Span<const SatParameters>
input) {
142 std::vector<SatParameters> result;
143 for (
const SatParameters& param :
input) {
144 if (
Keep(param.name())) {
145 result.push_back(param);
154 std::string
LastName()
const {
return last_name_; }
164 bool FNMatch(absl::string_view pattern, absl::string_view str);
166 std::vector<std::string> filter_patterns_;
167 std::vector<std::string> ignore_patterns_;
168 std::string last_name_;
170 std::vector<std::string> ignored_;
BooleanOrIntegerLiteral GreaterOrEqual(int var, int64_t value) const
Helpers to generate a decision.
BooleanOrIntegerLiteral LowerOrEqual(int var, int64_t value) const
BooleanOrIntegerLiteral MedianValue(int var) const
int64_t Max(int var) const
CpModelView(Model *model)
int64_t Min(int var) const
int NumVariables() const
The valid indices for the calls below are in [0, num_variables).
bool IsFixed(int var) const
Getters about the current domain of the given variable.
Simple class used to filter executed subsolver names.
SubsolverNameFilter(const SatParameters ¶ms)
Warning, params must outlive the class and be constant.
std::vector< SatParameters > Filter(absl::Span< const SatParameters > input)
Applies Keep() to all the input list.
bool Keep(absl::string_view name)
Shall we keep a parameter with given name?
std::string LastName() const
const std::vector< std::string > & AllIgnored()
Returns the list of all ignored subsolver for use in logs.
const std::string name
A name for logging purposes.
void STLSortAndRemoveDuplicates(T *v, const LessFunc &less_func)
std::vector< SatParameters > GetFullWorkerParameters(const SatParameters &base_params, const CpModelProto &cp_model, int num_already_present, SubsolverNameFilter *filter)
std::function< BooleanOrIntegerLiteral()> ConstructFixedSearchStrategy(std::function< BooleanOrIntegerLiteral()> user_search, std::function< BooleanOrIntegerLiteral()> heuristic_search, std::function< BooleanOrIntegerLiteral()> integer_completion)
std::function< BooleanOrIntegerLiteral()> ConstructHintSearchStrategy(const CpModelProto &cp_model_proto, CpModelMapping *mapping, Model *model)
Constructs a search strategy that follow the hint from the model.
std::function< BooleanOrIntegerLiteral()> ConstructHeuristicSearchStrategy(const CpModelProto &cp_model_proto, Model *model)
Constructs a search strategy tailored for the current model.
std::function< BooleanOrIntegerLiteral()> InstrumentSearchStrategy(const CpModelProto &cp_model_proto, const std::vector< IntegerVariable > &variable_mapping, std::function< BooleanOrIntegerLiteral()> instrumented_strategy, Model *model)
std::vector< SatParameters > GetFirstSolutionBaseParams(const SatParameters &base_params)
std::function< BooleanOrIntegerLiteral()> ConstructIntegerCompletionSearchStrategy(const std::vector< IntegerVariable > &variable_mapping, IntegerVariable objective_var, Model *model)
Constructs an integer completion search strategy.
std::vector< SatParameters > RepeatParameters(absl::Span< const SatParameters > base_params, int num_params_to_generate)
std::function< BooleanOrIntegerLiteral()> ConstructUserSearchStrategy(const CpModelProto &cp_model_proto, Model *model)
Constructs the search strategy specified in the given CpModelProto.
absl::flat_hash_map< std::string, SatParameters > GetNamedParameters(SatParameters base_params)
In SWIG mode, we don't want anything besides these top-level includes.
static int input(yyscan_t yyscanner)