Skip to content

Commit

Permalink
take into account the Ctr sense
Browse files Browse the repository at this point in the history
  • Loading branch information
hlefebvr committed Oct 16, 2023
1 parent 813409e commit 926c50e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/src/optimizers/callbacks/SimpleRounding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ void idol::Heuristics::SimpleRounding::Strategy::operator()(CallbackEvent t_even
throw Exception("SimpleRounding for quadratic problems is not implemented.");
}

std::optional<bool> is_trivially_up_roundable = 0;
std::optional<bool> is_trivially_up_roundable = 0; // The name assumes <= constraints
for (const auto& [ctr, coefficient] : column.linear()) {

if (!coefficient.is_numerical()) {
throw Exception("A coefficient which is non numerical was found when rounding.");
}

bool direction = coefficient.numerical() >= 0.;
const auto type = model.get_ctr_type(ctr);

if (type == Equal) {
return;
}

bool direction = (type == LessOrEqual && coefficient.numerical() >= 0.) || (type == GreaterOrEqual && coefficient.numerical() <= 0.);

if (!is_trivially_up_roundable.has_value()) {
is_trivially_up_roundable = direction;
Expand Down

0 comments on commit 926c50e

Please sign in to comment.