Skip to content

Commit fc237ea

Browse files
committed
export from google3
1 parent f9177bd commit fc237ea

File tree

10 files changed

+12
-135
lines changed

10 files changed

+12
-135
lines changed

ortools/algorithms/set_cover.proto

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import "ortools/util/int128.proto";
2020
option java_package = "com.google.ortools.algorithms";
2121
option java_multiple_files = true;
2222

23+
// TODO(user): use uint64 instead of int32 for indices, as the solver
24+
// supports it.
2325
message SetCoverProto {
2426
message Subset {
2527
// The cost for using the given subset.

ortools/algorithms/set_cover_invariant.h

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class SetCoverDecision {
6363
// are covered 1 time or less (not overcovered) in the current solution;
6464
// is_redundant_, whether a subset can be removed from the solution.
6565
// is_redundant_[subset] == (num_non_overcovered_elements_[subet] == 0).
66-
6766
class SetCoverInvariant {
6867
public:
6968
// The consistency level of the invariant.

ortools/algorithms/set_cover_model.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,14 @@ void SetCoverModel::CreateSparseRowView() {
340340
for (const SubsetIndex subset : SubsetRange()) {
341341
// Sort the columns. It's not super-critical to improve performance here
342342
// as this needs to be done only once.
343-
// std::sort(columns_[subset].begin(), columns_[subset].end());
344343
BaseInt* data = reinterpret_cast<BaseInt*>(columns_[subset].data());
345344
RadixSort(absl::MakeSpan(data, columns_[subset].size()));
346345

346+
ElementIndex preceding_element(-1);
347347
for (const ElementIndex element : columns_[subset]) {
348+
DCHECK_GT(element, preceding_element); // Fail if there is a repetition.
348349
++row_sizes[element];
350+
preceding_element = element;
349351
}
350352
}
351353
for (const ElementIndex element : ElementRange()) {

ortools/algorithms/set_cover_model.h

-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ class SetCoverModel {
296296
bool elements_in_subsets_are_sorted_;
297297

298298
// Costs for each subset.
299-
300299
SubsetCostVector subset_costs_;
301300

302301
// Vector of columns. Each column corresponds to a subset and contains the

ortools/algorithms/set_cover_solve.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "absl/log/check.h"
1919
#include "absl/strings/match.h"
2020
#include "absl/strings/str_join.h"
21+
#include "absl/strings/string_view.h"
2122
#include "absl/time/time.h"
2223
#include "ortools/algorithms/set_cover_heuristics.h"
2324
#include "ortools/algorithms/set_cover_invariant.h"
@@ -141,8 +142,7 @@ FileFormat ParseFileFormat(const std::string& format_name) {
141142
}
142143
}
143144

144-
SetCoverModel ReadModel(const std::string& input_file,
145-
FileFormat input_format) {
145+
SetCoverModel ReadModel(absl::string_view input_file, FileFormat input_format) {
146146
switch (input_format) {
147147
case FileFormat::ORLIB_SCP:
148148
return ReadOrlibScp(input_file);
@@ -160,7 +160,7 @@ SetCoverModel ReadModel(const std::string& input_file,
160160
}
161161
}
162162

163-
SubsetBoolVector ReadSolution(const std::string& input_file,
163+
SubsetBoolVector ReadSolution(absl::string_view input_file,
164164
FileFormat input_format) {
165165
switch (input_format) {
166166
case FileFormat::TXT:
@@ -198,7 +198,7 @@ void WriteModel(const SetCoverModel& model, const std::string& output_file,
198198
}
199199

200200
void WriteSolution(const SetCoverModel& model, const SubsetBoolVector& solution,
201-
const std::string& output_file, FileFormat output_format) {
201+
absl::string_view output_file, FileFormat output_format) {
202202
switch (output_format) {
203203
case FileFormat::TXT:
204204
WriteSetCoverSolutionText(model, solution, output_file);

ortools/flatzinc/checker.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ bool CheckSetNotIn(const Constraint& ct,
10721072
bool CheckSetInReif(const Constraint& ct,
10731073
const std::function<int64_t(Variable*)>& evaluator) {
10741074
const int64_t value = Eval(ct.arguments[0], evaluator);
1075-
const bool status = Eval(ct.arguments[2], evaluator) != 0;
1075+
const int64_t status = Eval(ct.arguments[2], evaluator);
10761076
return status == ct.arguments[1].Contains(value);
10771077
}
10781078

ortools/java/com/google/ortools/Loader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ public static synchronized void loadNativeLibraries() {
142142
URI resourceURI = getNativeResourceURI();
143143
Path tempPath = unpackNativeResources(resourceURI);
144144
// libraries order does matter !
145-
List<String> dlls = Arrays.asList(
146-
"zlib1", "abseil_dll", "re2", "utf8_validity", "libprotobuf", "highs", "ortools", "jniortools");
145+
List<String> dlls = Arrays.asList("zlib1", "abseil_dll", "re2", "utf8_validity",
146+
"libprotobuf", "highs", "ortools", "jniortools");
147147
for (String dll : dlls) {
148148
try {
149149
// System.out.println("System.load(" + dll + ")");

ortools/sat/go/cpmodel/cp_solver_c.cc

-83
This file was deleted.

ortools/sat/go/cpmodel/cp_solver_c.h

-41
This file was deleted.

ortools/util/fixed_shape_binary_tree.h

-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ class FixedShapeBinaryTree {
218218
template <typename TypeWithPushBack>
219219
void PartitionIntervalIntoNodes(LeafIndex first_leaf, LeafIndex last_leaf,
220220
TypeWithPushBack* result) const {
221-
DCHECK_LE(first_leaf, last_leaf);
222221
TreeNodeIndex prev(0);
223222
TreeNodeIndex current = GetNodeStartOfRange(first_leaf, last_leaf);
224223
if (current == Root()) {

0 commit comments

Comments
 (0)