19#include "absl/memory/memory.h"
20#include "absl/status/status.h"
21#include "absl/status/statusor.h"
22#include "absl/strings/string_view.h"
31#include "ortools/math_opt/model.pb.h"
34#include "scip/scip_prob.h"
39absl::Status ScipConvertLpToMps(
const std::string& lp_filename_in,
40 const std::string& mps_filename_out) {
44 SCIPreadProb(gscip->scip(), lp_filename_in.c_str(),
"lp"));
46 gscip->scip(), mps_filename_out.c_str(),
"mps", FALSE));
47 return absl::OkStatus();
56 return absl::InternalError(
57 "creating temporary directory when parsing LP file failed");
59 const std::string lp_file =
file::JoinPath(dir->path(),
"model.lp");
61 const std::string mps_file =
file::JoinPath(dir->path(),
"model.mps");
65 <<
"failed to convert LP file with SCIP";
70 _ <<
"failed to parse MPS (produced by SCIP from LP file)");
#define ASSIGN_OR_RETURN(lhs, rexpr)
#define RETURN_IF_ERROR(expr)
static TempPath * Create(Location location)
absl::StatusOr< std::string > GetContents(absl::string_view path, Options options)
absl::Status SetContents(absl::string_view filename, absl::string_view contents, Options options)
An object oriented wrapper for quadratic constraints in ModelStorage.
absl::StatusOr< ModelProto > MpsToModelProto(absl::string_view mps_data)
Converts a string with the contents of an MPS file into a ModelProto.
absl::StatusOr< ModelProto > ModelProtoFromLp(const absl::string_view lp_data)
#define RETURN_IF_SCIP_ERROR(x)
#define OR_ASSIGN_OR_RETURN3(lhs, rexpr, error_expression)