Google OR-Tools: ortools/sat/cp_model_solver.h Source File

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef ORTOOLS_SAT_CP_MODEL_SOLVER_H_

15#define ORTOOLS_SAT_CP_MODEL_SOLVER_H_

16

17#include <functional>

18#include <string>

19

20#include "absl/flags/declare.h"

21#include "absl/strings/string_view.h"

26

27#ifndef SWIG

29#endif

30

32namespace sat {

33

36

38CpSolverResponse Solve(const CpModelProto& model_proto);

39

42 const SatParameters& params);

43

45std::string CpModelStats(const CpModelProto& model);

46

54 bool has_objective = true);

55

69CpSolverResponse SolveCpModel(const CpModelProto& model_proto, Model* model);

70

71#if !defined(__PORTABLE_PLATFORM__)

77 absl::string_view params);

78#endif

79

100 const std::function<void(const CpSolverResponse& response)>& callback);

101

111 const std::function<std::string(const CpSolverResponse& response)>&

112 callback);

113

121 const std::function<void(double)>& callback);

122

132 const SatParameters& parameters);

133

136

137}

138}

139

140#endif

OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_dump_response)

CpSolverResponse Solve(const CpModelProto &model_proto)

Solves the given CpModelProto and returns an instance of CpSolverResponse.

std::string CpModelStats(const CpModelProto &model_proto)

Returns a string with some statistics on the given CpModelProto.

std::function< SatParameters(Model *)> NewSatParameters(absl::string_view params)

std::string CpSatSolverVersion()

Returns a string that describes the version of the solver.

CpSolverResponse SolveCpModel(const CpModelProto &model_proto, Model *model)

std::function< void(Model *)> NewBestBoundCallback(const std::function< void(double)> &callback)

CpSolverResponse SolveWithParameters(const CpModelProto &model_proto, const SatParameters &params)

Solves the given CpModelProto with the given parameters.

std::function< void(Model *)> NewFeasibleSolutionLogCallback(const std::function< std::string(const CpSolverResponse &response)> &callback)

void StopSearch(Model *model)

Stops the current search.

std::function< void(Model *)> NewFeasibleSolutionObserver(const std::function< void(const CpSolverResponse &response)> &callback)

std::string CpSolverResponseStats(const CpSolverResponse &response, bool has_objective)