Skip to content

Commit

Permalink
algorithms: export from google3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Sep 9, 2024
1 parent 3c6e0b1 commit 16afc12
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions ortools/algorithms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ cc_library(
"//ortools/linear_solver",
"//ortools/lp_data:base",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/types:span",
],
)
Expand Down
2 changes: 1 addition & 1 deletion ortools/algorithms/set_cover_invariant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ std::tuple<Cost, ElementToIntVector> SetCoverInvariant::ComputeCostAndCoverage(

ElementToIntVector SetCoverInvariant::ComputeCoverageInFocus(
const absl::Span<const SubsetIndex> focus) const {
ElementToIntVector coverage;
ElementToIntVector coverage(coverage_.size());
for (const SubsetIndex subset : focus) {
if (is_selected_[subset]) {
for (const ElementIndex element : model_->columns()[subset]) {
Expand Down
4 changes: 3 additions & 1 deletion ortools/algorithms/set_cover_mip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <cstdint>
#include <limits>

#include "absl/log/check.h"
#include "absl/types/span.h"
#include "ortools/algorithms/set_cover_invariant.h"
#include "ortools/algorithms/set_cover_model.h"
Expand All @@ -29,7 +30,8 @@ namespace {
// Returns the vector a - b.
ElementToIntVector Subtract(const ElementToIntVector& a,
const ElementToIntVector& b) {
ElementToIntVector delta;
ElementToIntVector delta(a.size());
DCHECK_EQ(a.size(), b.size());
for (const ElementIndex i : a.index_range()) {
delta[i] = a[i] - b[i];
}
Expand Down

0 comments on commit 16afc12

Please sign in to comment.