tentative support for LP_PARSER=OFF
This commit is contained in:
@@ -230,6 +230,7 @@ cc_library(
|
||||
cc_binary(
|
||||
name = "solve",
|
||||
srcs = ["solve.cc"],
|
||||
defines = ["USE_LP_PARSER"],
|
||||
deps = [
|
||||
":linear_solver",
|
||||
":linear_solver_cc_proto",
|
||||
|
||||
@@ -442,11 +442,11 @@ absl::Status AddMinMaxConstraint(const MPGeneralConstraintProto& gen_cst,
|
||||
vars = {scip_resultant_var};
|
||||
vals = {1};
|
||||
if (gen_cst.has_min_constraint()) {
|
||||
RETURN_IF_ERROR(add_lin_constraint(absl::StrCat("_ineq_constant"),
|
||||
-kInfinity, minmax.constant()));
|
||||
RETURN_IF_ERROR(
|
||||
add_lin_constraint("_ineq_constant", -kInfinity, minmax.constant()));
|
||||
} else {
|
||||
RETURN_IF_ERROR(add_lin_constraint(absl::StrCat("_ineq_constant"),
|
||||
minmax.constant(), kInfinity));
|
||||
RETURN_IF_ERROR(
|
||||
add_lin_constraint("_ineq_constant", minmax.constant(), kInfinity));
|
||||
}
|
||||
}
|
||||
for (SCIP_CONS* scip_cons : cons) {
|
||||
|
||||
@@ -133,11 +133,15 @@ MPModelRequest ReadMipModel(const std::string& input) {
|
||||
MPModelRequest request_proto;
|
||||
MPModelProto model_proto;
|
||||
if (absl::EndsWith(input, ".lp")) {
|
||||
#if defined(USE_LP_PARSER)
|
||||
std::string data;
|
||||
CHECK_OK(file::GetContents(input, &data, file::Defaults()));
|
||||
absl::StatusOr<MPModelProto> result = ModelProtoFromLpFormat(data);
|
||||
CHECK_OK(result);
|
||||
model_proto = std::move(result).value();
|
||||
#else // !defined(USE_LP_PARSER)
|
||||
LOG(FATAL) << "Support for parsing LP format is not compiled in.";
|
||||
#endif // !defined(USE_LP_PARSER)
|
||||
} else if (absl::EndsWith(input, ".mps") ||
|
||||
absl::EndsWith(input, ".mps.gz")) {
|
||||
QCHECK_OK(glop::MPSReader().ParseFile(input, &model_proto))
|
||||
|
||||
Reference in New Issue
Block a user