Skip to content

Commit

Permalink
export from google3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Feb 10, 2025
1 parent f9177bd commit fc237ea
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 135 deletions.
2 changes: 2 additions & 0 deletions ortools/algorithms/set_cover.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import "ortools/util/int128.proto";
option java_package = "com.google.ortools.algorithms";
option java_multiple_files = true;

// TODO(user): use uint64 instead of int32 for indices, as the solver
// supports it.
message SetCoverProto {
message Subset {
// The cost for using the given subset.
Expand Down
1 change: 0 additions & 1 deletion ortools/algorithms/set_cover_invariant.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class SetCoverDecision {
// are covered 1 time or less (not overcovered) in the current solution;
// is_redundant_, whether a subset can be removed from the solution.
// is_redundant_[subset] == (num_non_overcovered_elements_[subet] == 0).

class SetCoverInvariant {
public:
// The consistency level of the invariant.
Expand Down
4 changes: 3 additions & 1 deletion ortools/algorithms/set_cover_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,14 @@ void SetCoverModel::CreateSparseRowView() {
for (const SubsetIndex subset : SubsetRange()) {
// Sort the columns. It's not super-critical to improve performance here
// as this needs to be done only once.
// std::sort(columns_[subset].begin(), columns_[subset].end());
BaseInt* data = reinterpret_cast<BaseInt*>(columns_[subset].data());
RadixSort(absl::MakeSpan(data, columns_[subset].size()));

ElementIndex preceding_element(-1);
for (const ElementIndex element : columns_[subset]) {
DCHECK_GT(element, preceding_element); // Fail if there is a repetition.
++row_sizes[element];
preceding_element = element;
}
}
for (const ElementIndex element : ElementRange()) {
Expand Down
1 change: 0 additions & 1 deletion ortools/algorithms/set_cover_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ class SetCoverModel {
bool elements_in_subsets_are_sorted_;

// Costs for each subset.

SubsetCostVector subset_costs_;

// Vector of columns. Each column corresponds to a subset and contains the
Expand Down
8 changes: 4 additions & 4 deletions ortools/algorithms/set_cover_solve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "absl/log/check.h"
#include "absl/strings/match.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "ortools/algorithms/set_cover_heuristics.h"
#include "ortools/algorithms/set_cover_invariant.h"
Expand Down Expand Up @@ -141,8 +142,7 @@ FileFormat ParseFileFormat(const std::string& format_name) {
}
}

SetCoverModel ReadModel(const std::string& input_file,
FileFormat input_format) {
SetCoverModel ReadModel(absl::string_view input_file, FileFormat input_format) {
switch (input_format) {
case FileFormat::ORLIB_SCP:
return ReadOrlibScp(input_file);
Expand All @@ -160,7 +160,7 @@ SetCoverModel ReadModel(const std::string& input_file,
}
}

SubsetBoolVector ReadSolution(const std::string& input_file,
SubsetBoolVector ReadSolution(absl::string_view input_file,
FileFormat input_format) {
switch (input_format) {
case FileFormat::TXT:
Expand Down Expand Up @@ -198,7 +198,7 @@ void WriteModel(const SetCoverModel& model, const std::string& output_file,
}

void WriteSolution(const SetCoverModel& model, const SubsetBoolVector& solution,
const std::string& output_file, FileFormat output_format) {
absl::string_view output_file, FileFormat output_format) {
switch (output_format) {
case FileFormat::TXT:
WriteSetCoverSolutionText(model, solution, output_file);
Expand Down
2 changes: 1 addition & 1 deletion ortools/flatzinc/checker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ bool CheckSetNotIn(const Constraint& ct,
bool CheckSetInReif(const Constraint& ct,
const std::function<int64_t(Variable*)>& evaluator) {
const int64_t value = Eval(ct.arguments[0], evaluator);
const bool status = Eval(ct.arguments[2], evaluator) != 0;
const int64_t status = Eval(ct.arguments[2], evaluator);
return status == ct.arguments[1].Contains(value);
}

Expand Down
4 changes: 2 additions & 2 deletions ortools/java/com/google/ortools/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public static synchronized void loadNativeLibraries() {
URI resourceURI = getNativeResourceURI();
Path tempPath = unpackNativeResources(resourceURI);
// libraries order does matter !
List<String> dlls = Arrays.asList(
"zlib1", "abseil_dll", "re2", "utf8_validity", "libprotobuf", "highs", "ortools", "jniortools");
List<String> dlls = Arrays.asList("zlib1", "abseil_dll", "re2", "utf8_validity",
"libprotobuf", "highs", "ortools", "jniortools");
for (String dll : dlls) {
try {
// System.out.println("System.load(" + dll + ")");
Expand Down
83 changes: 0 additions & 83 deletions ortools/sat/go/cpmodel/cp_solver_c.cc

This file was deleted.

41 changes: 0 additions & 41 deletions ortools/sat/go/cpmodel/cp_solver_c.h

This file was deleted.

1 change: 0 additions & 1 deletion ortools/util/fixed_shape_binary_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ class FixedShapeBinaryTree {
template <typename TypeWithPushBack>
void PartitionIntervalIntoNodes(LeafIndex first_leaf, LeafIndex last_leaf,
TypeWithPushBack* result) const {
DCHECK_LE(first_leaf, last_leaf);
TreeNodeIndex prev(0);
TreeNodeIndex current = GetNodeStartOfRange(first_leaf, last_leaf);
if (current == Root()) {
Expand Down

0 comments on commit fc237ea

Please sign in to comment.