21#include "absl/status/status.h"
22#include "absl/status/statusor.h"
23#include "absl/strings/string_view.h"
24#include "absl/time/time.h"
25#include "absl/types/span.h"
30#include "ortools/math_opt/parameters.pb.h"
31#include "ortools/math_opt/solvers/gurobi.pb.h"
54 static constexpr SolverType kSolverTypeValues[] = {
58 return absl::MakeConstSpan(kSolverTypeValues);
62 std::string*
const error) {
63 const std::optional enum_value = EnumFromString<SolverType>(text);
64 if (!enum_value.has_value()) {
65 *error =
"unknown value for enumeration";
74 std::ostringstream oss;
83 return "primal_simplex";
85 return "dual_simplex";
93 static constexpr LPAlgorithm kLPAlgorithmValues[] = {
98 return absl::MakeConstSpan(kLPAlgorithmValues);
118 static constexpr Emphasis kEmphasisValues[] = {
122 return absl::MakeConstSpan(kEmphasisValues);
126 GurobiParametersProto result;
128 GurobiParametersProto::Parameter& p = *result.add_parameters();
136 const GurobiParametersProto&
proto) {
138 for (
const GurobiParametersProto::Parameter& p :
proto.parameters()) {
145 SolveParametersProto result;
149 result.mutable_time_limit()));
186 *result.mutable_gscip() =
gscip;
188 *result.mutable_glop() =
glop;
189 *result.mutable_cp_sat() =
cp_sat;
194 const SolveParametersProto&
proto) {
197 if (
proto.has_time_limit()) {
203 if (
proto.has_iteration_limit()) {
206 if (
proto.has_node_limit()) {
209 if (
proto.has_cutoff_limit()) {
212 if (
proto.has_objective_limit()) {
215 if (
proto.has_best_bound_limit()) {
218 if (
proto.has_solution_limit()) {
221 if (
proto.has_threads()) {
224 if (
proto.has_random_seed()) {
227 if (
proto.has_absolute_gap_tolerance()) {
230 if (
proto.has_relative_gap_tolerance()) {
#define ASSIGN_OR_RETURN(lhs, rexpr)
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)
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< int64_t > node_limit
std::optional< Emphasis > heuristics
std::optional< double > absolute_gap_tolerance
std::optional< double > relative_gap_tolerance
std::optional< LPAlgorithm > lp_algorithm
std::optional< Emphasis > presolve
std::optional< int32_t > random_seed
std::optional< int32_t > threads
static absl::StatusOr< SolveParameters > FromProto(const SolveParametersProto &proto)
SolveParametersProto Proto() const
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