19#include "absl/status/statusor.h"
20#include "absl/strings/str_cat.h"
21#include "absl/strings/string_view.h"
27 SolverResourcesProto ret;
28 if (
cpu.has_value()) {
29 ret.set_cpu(
cpu.value());
31 if (
ram.has_value()) {
32 ret.set_ram(
ram.value());
38 const SolverResourcesProto&
proto) {
40 if (
proto.has_cpu()) {
43 if (
proto.has_ram()) {
51 std::string*
const error) {
52 SolverResourcesProto
proto;
57 if (!resources.ok()) {
58 *error = absl::StrCat(
59 "SolverResourcesProto was invalid and could not convert to "
61 resources.status().ToString());
64 *solver_resources = *std::move(resources);
CpModelProto proto
The output proto.
An object oriented wrapper for quadratic constraints in ModelStorage.
bool AbslParseFlag(const absl::string_view text, SolverType *const value, std::string *const error)
std::string AbslUnparseFlag(const SolverType value)
std::string ProtobufTextFormatPrintToStringForFlag(const google::protobuf::Message &proto)
bool ProtobufParseTextProtoForFlag(absl::string_view text, ProtoType *message_out, std::string *error_out)
SolverResourcesProto Proto() const
std::optional< double > cpu
static absl::StatusOr< SolverResources > FromProto(const SolverResourcesProto &proto)
std::optional< double > ram