Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
cp_model_solver.cc File Reference
#include "ortools/sat/cp_model_solver.h"
#include <algorithm>
#include <atomic>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <deque>
#include <functional>
#include <limits>
#include <memory>
#include <optional>
#include <random>
#include <string>
#include <string_view>
#include <thread>
#include <type_traits>
#include <utility>
#include <vector>
#include "absl/base/log_severity.h"
#include "absl/base/thread_annotations.h"
#include "absl/container/btree_map.h"
#include "absl/container/btree_set.h"
#include "absl/container/flat_hash_map.h"
#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/log/vlog_is_on.h"
#include "absl/random/distributions.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
#include "absl/strings/strip.h"
#include "absl/synchronization/mutex.h"
#include "absl/types/span.h"
#include "google/protobuf/arena.h"
#include "google/protobuf/text_format.h"
#include "ortools/base/helpers.h"
#include "ortools/base/logging.h"
#include "ortools/base/options.h"
#include "ortools/base/timer.h"
#include "ortools/base/version.h"
#include "ortools/port/os.h"
#include "ortools/port/proto_utils.h"
#include "ortools/sat/combine_solutions.h"
#include "ortools/sat/cp_model.pb.h"
#include "ortools/sat/cp_model_checker.h"
#include "ortools/sat/cp_model_copy.h"
#include "ortools/sat/cp_model_lns.h"
#include "ortools/sat/cp_model_mapping.h"
#include "ortools/sat/cp_model_postsolve.h"
#include "ortools/sat/cp_model_presolve.h"
#include "ortools/sat/cp_model_search.h"
#include "ortools/sat/cp_model_solver_helpers.h"
#include "ortools/sat/cp_model_solver_logging.h"
#include "ortools/sat/cp_model_symmetries.h"
#include "ortools/sat/cp_model_utils.h"
#include "ortools/sat/diffn_util.h"
#include "ortools/sat/feasibility_jump.h"
#include "ortools/sat/feasibility_pump.h"
#include "ortools/sat/integer.h"
#include "ortools/sat/integer_base.h"
#include "ortools/sat/linear_model.h"
#include "ortools/sat/linear_programming_constraint.h"
#include "ortools/sat/lp_utils.h"
#include "ortools/sat/lrat_proof_handler.h"
#include "ortools/sat/model.h"
#include "ortools/sat/parameters_validation.h"
#include "ortools/sat/presolve_context.h"
#include "ortools/sat/primary_variables.h"
#include "ortools/sat/routing_cuts.h"
#include "ortools/sat/sat_base.h"
#include "ortools/sat/sat_inprocessing.h"
#include "ortools/sat/sat_parameters.pb.h"
#include "ortools/sat/sat_solver.h"
#include "ortools/sat/shaving_solver.h"
#include "ortools/sat/stat_tables.h"
#include "ortools/sat/subsolver.h"
#include "ortools/sat/synchronization.h"
#include "ortools/sat/util.h"
#include "ortools/sat/work_assignment.h"
#include "ortools/util/logging.h"
#include "ortools/util/random_engine.h"
#include "ortools/util/sigint.h"
#include "ortools/util/sorted_interval_list.h"
#include "ortools/util/testing_utils.h"
#include "ortools/util/time_limit.h"

Go to the source code of this file.

Namespaces

namespace  operations_research
 OR-Tools root namespace.
namespace  operations_research::sat

Functions

 ABSL_FLAG (bool, cp_model_export_model, false, "DEBUG ONLY. When set to true, SolveCpModel() will dump its input model " "protos in text format to 'FLAGS_cp_model_dump_prefix'{name}.pb.txt.")
 ABSL_FLAG (bool, cp_model_dump_text_proto, true, "DEBUG ONLY, dump models in text proto instead of binary proto.")
 ABSL_FLAG (bool, cp_model_dump_problematic_lns, false, "DEBUG ONLY. Similar to --cp_model_dump_submodels, but only dump fragment " "for which we got an issue while validating the postsolved solution. This " "allows to debug presolve issues without dumping all the models.")
 ABSL_FLAG (bool, cp_model_dump_response, false, "DEBUG ONLY. If true, the final response of each solve will be " "dumped to 'FLAGS_cp_model_dump_prefix'response.pb.txt")
 ABSL_FLAG (std::string, cp_model_params, "", "This is interpreted as a text SatParameters proto. The " "specified fields will override the normal ones for all solves.")
 ABSL_FLAG (bool, cp_model_ignore_objective, false, "If true, ignore the objective.")
 ABSL_FLAG (bool, cp_model_ignore_hints, false, "If true, ignore any supplied hints.")
 ABSL_FLAG (bool, cp_model_use_hint_for_debug_only, false, "If true, ignore any supplied hints, but if the hint is valid and " "complete, validate that no buggy propagator make it infeasible.")
 ABSL_FLAG (bool, cp_model_fingerprint_model, true, "Fingerprint the model.")
 ABSL_FLAG (bool, cp_model_check_intermediate_solutions, false, "When true, all intermediate solutions found by the solver will be " "checked. This can be expensive, therefore it is off by default.")
std::string operations_research::sat::CpSatSolverVersion ()
 Returns a string that describes the version of the solver.
std::string operations_research::sat::CpModelStats (const CpModelProto &model)
 Returns a string with some statistics on the given CpModelProto.
std::string operations_research::sat::CpSolverResponseStats (const CpSolverResponse &response, bool has_objective)
std::function< void(Model *)> operations_research::sat::NewFeasibleSolutionObserver (const std::function< void(const CpSolverResponse &response)> &callback)
std::function< void(Model *)> operations_research::sat::NewFeasibleSolutionLogCallback (const std::function< std::string(const CpSolverResponse &response)> &callback)
std::function< void(Model *)> operations_research::sat::NewBestBoundCallback (const std::function< void(double)> &callback)
std::function< SatParameters(Model *)> operations_research::sat::NewSatParameters (absl::string_view params)
std::function< SatParameters(Model *)> operations_research::sat::NewSatParameters (const sat::SatParameters &parameters)
void operations_research::sat::StopSearch (Model *model)
 Stops the current search.
CpSolverResponse operations_research::sat::SolveCpModel (const CpModelProto &model_proto, Model *model)
CpSolverResponse operations_research::sat::Solve (const CpModelProto &model_proto)
 Solves the given CpModelProto and returns an instance of CpSolverResponse.
CpSolverResponse operations_research::sat::SolveWithParameters (const CpModelProto &model_proto, const SatParameters &params)
 Solves the given CpModelProto with the given parameters.
CpSolverResponse operations_research::sat::SolveWithParameters (const CpModelProto &model_proto, absl::string_view params)

Function Documentation

◆ ABSL_FLAG() [1/10]

ABSL_FLAG ( bool ,
cp_model_check_intermediate_solutions ,
false ,
"When true,
all intermediate solutions found by the solver will be " "checked. This can be expensive,
therefore it is off by default."  )

◆ ABSL_FLAG() [2/10]

ABSL_FLAG ( bool ,
cp_model_dump_problematic_lns ,
false ,
"DEBUG ONLY. Similar to -- cp_model_dump_submodels,
but only dump fragment " "for which we got an issue while validating the postsolved solution. This " "allows to debug presolve issues without dumping all the models."  )

◆ ABSL_FLAG() [3/10]

ABSL_FLAG ( bool ,
cp_model_dump_response ,
false ,
"DEBUG ONLY. If true,
the final response of each solve will be " "dumped to 'FLAGS_cp_model_dump_prefix 'response.pb.txt"  )

◆ ABSL_FLAG() [4/10]

ABSL_FLAG ( bool ,
cp_model_dump_text_proto ,
true ,
"DEBUG ONLY,
dump models in text proto instead of binary proto."  )

◆ ABSL_FLAG() [5/10]

ABSL_FLAG ( bool ,
cp_model_export_model ,
false ,
"DEBUG ONLY. When set to true,
SolveCpModel() will dump its input model " "protos in text format to 'FLAGS_cp_model_dump_prefix'{name}.pb.txt."  )

◆ ABSL_FLAG() [6/10]

ABSL_FLAG ( bool ,
cp_model_fingerprint_model ,
true ,
"Fingerprint the model."  )

◆ ABSL_FLAG() [7/10]

ABSL_FLAG ( bool ,
cp_model_ignore_hints ,
false ,
"If true,
ignore any supplied hints."  )

◆ ABSL_FLAG() [8/10]

ABSL_FLAG ( bool ,
cp_model_ignore_objective ,
false ,
"If true,
ignore the objective."  )

◆ ABSL_FLAG() [9/10]

ABSL_FLAG ( bool ,
cp_model_use_hint_for_debug_only ,
false ,
"If true,
ignore any supplied hints,
but if the hint is valid and " " complete,
validate that no buggy propagator make it infeasible."  )

◆ ABSL_FLAG() [10/10]

ABSL_FLAG ( std::string ,
cp_model_params ,
"" ,
"This is interpreted as a text SatParameters proto. The " "specified fields will override the normal ones for all solves."  )