OR-Tools  9.3
cp_model_solver.cc File Reference

Go to the source code of this file.

Classes

struct  SolutionObservers
 

Namespaces

namespace  operations_research
 Collection of objects used to extend the Constraint Solver library.
 
namespace  operations_research::sat
 

Functions

 ABSL_FLAG (std::string, cp_model_dump_prefix, "/tmp/", "Prefix filename for all dumped files")
 
 ABSL_FLAG (bool, cp_model_dump_models, false, "DEBUG ONLY. When set to true, SolveCpModel() will dump its model " "protos (original model, presolved model, mapping model) in text " "format to 'FLAGS_cp_model_dump_prefix'{model|presolved_model|" "mapping_model}.pb.txt.")
 
 ABSL_FLAG (bool, cp_model_dump_lns, false, "DEBUG ONLY. When set to true, solve will dump all " "lns models proto in text format to " "'FLAGS_cp_model_dump_prefix'lns_xxx.pb.txt.")
 
 ABSL_FLAG (bool, cp_model_dump_problematic_lns, false, "DEBUG ONLY. Similar to --cp_model_dump_lns, 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 (std::string, drat_output, "", "If non-empty, a proof in DRAT format will be written to this file. " "This will only be used for pure-SAT problems.")
 
 ABSL_FLAG (bool, drat_check, false, "If true, a proof in DRAT format will be stored in memory and " "checked if the problem is UNSAT. This will only be used for " "pure-SAT problems.")
 
 ABSL_FLAG (double, max_drat_time_in_seconds, std::numeric_limits< double >::infinity(), "Maximum time in seconds to check the DRAT proof. This will only " "be used is the drat_check flag is enabled.")
 
 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 (std::string, contention_profile, "", "If non-empty, dump a contention pprof proto to the specified " "destination at the end of the solve.")
 
std::string CpModelStats (const CpModelProto &model)
 Returns a string with some statistics on the given CpModelProto. More...
 
std::string CpSolverResponseStats (const CpSolverResponse &response, bool has_objective=true)
 Returns a string with some statistics on the solver response. More...
 
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){...}));. More...
 
std::function< SatParameters(Model *)> NewSatParameters (const std::string &params)
 Creates parameters for the solver, which you can add to the model with. More...
 
std::function< SatParameters(Model *)> NewSatParameters (const sat::SatParameters &parameters)
 
CpSolverResponse SolveCpModel (const CpModelProto &model_proto, Model *model)
 Solves the given CpModelProto. More...
 
CpSolverResponse Solve (const CpModelProto &model_proto)
 Solves the given CpModelProto and returns an instance of CpSolverResponse. More...
 
CpSolverResponse SolveWithParameters (const CpModelProto &model_proto, const SatParameters &params)
 Solves the given CpModelProto with the given parameters. More...
 
CpSolverResponse SolveWithParameters (const CpModelProto &model_proto, const std::string &params)
 Solves the given CpModelProto with the given sat parameters as string in JSon format, and returns an instance of CpSolverResponse. More...
 

Function Documentation

◆ ABSL_FLAG() [1/11]

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/11]

ABSL_FLAG ( bool  ,
cp_model_dump_lns  ,
false  ,
"DEBUG ONLY. When set to  true,
solve will dump all " "lns models proto in text format to " " 'FLAGS_cp_model_dump_prefix 'lns_xxx.pb.txt."   
)

◆ ABSL_FLAG() [3/11]

ABSL_FLAG ( bool  ,
cp_model_dump_models  ,
false  ,
"DEBUG ONLY. When set to  true,
SolveCpModel() will dump its model " "protos(original model, presolved model, mapping model) in text " "format to 'FLAGS_cp_model_dump_prefix'{model|presolved_model|" "mapping_model}.pb.txt."   
)

◆ ABSL_FLAG() [4/11]

ABSL_FLAG ( bool  ,
cp_model_dump_problematic_lns  ,
false  ,
"DEBUG ONLY. Similar to --  cp_model_dump_lns,
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() [5/11]

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() [6/11]

ABSL_FLAG ( bool  ,
drat_check  ,
false  ,
"If  true,
a proof in DRAT format will be stored in memory and " "checked if the problem is UNSAT. This will only be used for " "pure-SAT problems."   
)

◆ ABSL_FLAG() [7/11]

ABSL_FLAG ( double  ,
max_drat_time_in_seconds  ,
std::numeric_limits< double >  ::infinity(),
"Maximum time in seconds to check the DRAT proof. This will only " "be used is the drat_check flag is enabled."   
)

◆ ABSL_FLAG() [8/11]

ABSL_FLAG ( std::string  ,
contention_profile  ,
""  ,
"If non-  empty,
dump a contention pprof proto to the specified " "destination at the end of the solve."   
)

◆ ABSL_FLAG() [9/11]

ABSL_FLAG ( std::string  ,
cp_model_dump_prefix  ,
"/tmp/"  ,
"Prefix filename for all dumped files"   
)

◆ ABSL_FLAG() [10/11]

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

ABSL_FLAG ( std::string  ,
drat_output  ,
""  ,
"If non-  empty,
a proof in DRAT format will be written to this file. " "This will only be used for pure-SAT problems."   
)

Variable Documentation

◆ bounds

SharedBoundsManager* bounds

Definition at line 2051 of file cp_model_solver.cc.

◆ clauses

SharedClausesManager* clauses

Definition at line 2056 of file cp_model_solver.cc.

◆ global_model

Model* global_model

Definition at line 2057 of file cp_model_solver.cc.

◆ incomplete_solutions

SharedIncompleteSolutionManager* incomplete_solutions

Definition at line 2055 of file cp_model_solver.cc.

◆ lp_solutions

SharedLPSolutionRepository* lp_solutions

Definition at line 2054 of file cp_model_solver.cc.

◆ model_proto

CpModelProto const* model_proto

Definition at line 2048 of file cp_model_solver.cc.

◆ relaxation_solutions

SharedRelaxationSolutionRepository* relaxation_solutions

Definition at line 2053 of file cp_model_solver.cc.

◆ response

SharedResponseManager* response

Definition at line 2052 of file cp_model_solver.cc.

◆ time_limit

ModelSharedTimeLimit* time_limit

Definition at line 2050 of file cp_model_solver.cc.

◆ wall_timer

WallTimer* wall_timer

Definition at line 2049 of file cp_model_solver.cc.