-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
What version of OR-Tools and what language are you using?
Version: main.
Language: C++
The gurobi-wrapper in math-opt has this helper:
absl::Status SafeGurobiDouble(const double d) {
if (std::isfinite(d) && std::abs(d) >= GRB_INFINITY) {
return util::InvalidArgumentErrorBuilder()
<< "finite value: " << d << " will be treated as infinite by Gurobi";
}
return absl::OkStatus();
}It's used to guard against finite-but-out-of-range values like 1e123 while:
#define GRB_INFINITY 1e100These checks ARE EXECUTED in:
GurobiSolver::AddNewLinearConstraintsGurobiSolver::AddNewQuadraticConstraintsGurobiSolver::AddNewIndicatorConstraints
but are only applied to lhs/rhs.
These checks ARE NOT EXECUTED in:
GurobiSolver::ChangeCoefficients
Now while i think gurobi-tests are not part of the public repository, there is gscip_solver_test.cc and this test:
TEST(GScipSolverTest, InvalidCoefficient) {
Model model;
const Variable x = model.AddVariable("x");
model.Maximize(x);
model.AddLinearConstraint(1.0e123 * x <= 2.0, "broken constraint");
EXPECT_THAT(Solve(model, SolverType::kGscip),
StatusIs(absl::StatusCode::kInvalidArgument,
HasSubstr("broken constraint")));
}My claim: (which i can't check as i have no access to gurobi):
- The gurobi wrapper would fail for this test or problems with the same problematic coefficients
(might also be relevant for objective coefficients which i did not check)