19#include "absl/strings/string_view.h"
20#include "absl/types/span.h"
21#include "ortools/math_opt/solvers/gurobi.pb.h"
23#include "absl/status/status.h"
48 static constexpr SolverType kSolverTypeValues[] = {
53 return absl::MakeConstSpan(kSolverTypeValues);
57 std::string*
const error) {
58 const std::optional enum_value = EnumFromString<SolverType>(text);
59 if (!enum_value.has_value()) {
60 *error =
"unknown value for enumeration";
69 std::ostringstream oss;
78 return "primal_simplex";
80 return "dual_simplex";
88 static constexpr LPAlgorithm kLPAlgorithmValues[] = {
93 return absl::MakeConstSpan(kLPAlgorithmValues);
113 static constexpr Emphasis kEmphasisValues[] = {
117 return absl::MakeConstSpan(kEmphasisValues);
121 StrictnessProto result;
131 GurobiParametersProto result;
133 GurobiParametersProto::Parameter& p = *result.add_parameters();
141 const GurobiParametersProto&
proto) {
143 for (
const GurobiParametersProto::Parameter& p :
proto.parameters()) {
150 SolveParametersProto result;
155 result.mutable_time_limit()));
189 *result.mutable_gscip() =
gscip;
191 *result.mutable_glop() =
glop;
192 *result.mutable_cp_sat() =
cp_sat;
197 const SolveParametersProto&
proto) {
201 if (
proto.has_time_limit()) {
207 if (
proto.has_iteration_limit()) {
210 if (
proto.has_cutoff_limit()) {
213 if (
proto.has_objective_limit()) {
216 if (
proto.has_best_bound_limit()) {
219 if (
proto.has_solution_limit()) {
222 if (
proto.has_threads()) {
225 if (
proto.has_random_seed()) {
228 if (
proto.has_absolute_gap_limit()) {
231 if (
proto.has_relative_gap_limit()) {
bool AbslParseFlag(const absl::string_view text, SolverType *const value, std::string *const error)
std::string AbslUnparseFlag(const SolverType value)
std::optional< typename EnumProto< P >::Cpp > EnumFromProto(const P proto_value)
Enum< E >::Proto EnumToProto(const std::optional< E > value)
Collection of objects used to extend the Constraint Solver library.
inline ::absl::StatusOr< absl::Duration > DecodeGoogleApiProto(const google::protobuf::Duration &proto)
inline ::absl::StatusOr< google::protobuf::Duration > EncodeGoogleApiProto(absl::Duration d)
#define ASSIGN_OR_RETURN(lhs, rexpr)
static std::optional< absl::string_view > ToOptString(E value)
static absl::Span< const E > AllValues()
static GurobiParameters FromProto(const GurobiParametersProto &proto)
GurobiParametersProto Proto() const
gtl::linked_hash_map< std::string, std::string > param_values
std::optional< double > best_bound_limit
std::optional< Emphasis > scaling
std::optional< int32_t > solution_limit
absl::Duration time_limit
std::optional< Emphasis > heuristics
std::optional< LPAlgorithm > lp_algorithm
std::optional< Emphasis > presolve
std::optional< double > absolute_gap_limit
std::optional< int32_t > random_seed
std::optional< int32_t > threads
static absl::StatusOr< SolveParameters > FromProto(const SolveParametersProto &proto)
SolveParametersProto Proto() const
std::optional< double > relative_gap_limit
sat::SatParameters cp_sat
std::optional< double > objective_limit
std::optional< Emphasis > cuts
std::optional< int64_t > iteration_limit
std::optional< double > cutoff_limit
glop::GlopParameters glop
StrictnessProto Proto() const
static Strictness FromProto(const StrictnessProto &proto)