Google OR-Tools v9.11
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 <random>
#include <string>
#include <thread>
#include <utility>
#include <vector>
#include "ortools/base/logging.h"
#include "ortools/base/timer.h"
#include "ortools/base/helpers.h"
#include "ortools/base/options.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/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/synchronization/mutex.h"
#include "absl/types/span.h"
#include "google/protobuf/arena.h"
#include "google/protobuf/text_format.h"
#include "ortools/port/proto_utils.h"
#include "ortools/sat/cp_model.pb.h"
#include "ortools/sat/cp_model_checker.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_symmetries.h"
#include "ortools/sat/cp_model_utils.h"
#include "ortools/sat/feasibility_jump.h"
#include "ortools/sat/feasibility_pump.h"
#include "ortools/sat/integer.h"
#include "ortools/sat/linear_model.h"
#include "ortools/sat/lp_utils.h"
#include "ortools/sat/model.h"
#include "ortools/sat/parameters_validation.h"
#include "ortools/sat/presolve_context.h"
#include "ortools/sat/sat_base.h"
#include "ortools/sat/sat_inprocessing.h"
#include "ortools/sat/sat_parameters.pb.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/base/version.h"
#include "ortools/util/sorted_interval_list.h"
#include "ortools/util/time_limit.h"

Go to the source code of this file.

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 
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, debug_model_copy, false, "If true, copy the input model as if with no basic presolve")
 
 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_fingerprint_model, true, "Fingerprint the model.")
 
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 (const std::string &params)
 
std::function< SatParameters(Model *)> operations_research::sat::NewSatParameters (const sat::SatParameters &parameters)
 
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, const std::string &params)
 
void operations_research::sat::LoadAndSolveCpModelForTest (const CpModelProto &model_proto, Model *model)
 

Function Documentation

◆ ABSL_FLAG() [1/9]

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() [2/9]

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() [3/9]

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

◆ ABSL_FLAG() [4/9]

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."  )

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

◆ ABSL_FLAG() [5/9]

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

◆ ABSL_FLAG() [6/9]

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

◆ ABSL_FLAG() [7/9]

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

◆ ABSL_FLAG() [8/9]

ABSL_FLAG ( bool ,
debug_model_copy ,
false ,
"If true,
copy the input model as if with no basic presolve"  )

◆ ABSL_FLAG() [9/9]

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."  )