From 69874c9b26c021dcdeeea812397f3e8a09c9987b Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Mon, 9 Oct 2023 14:23:43 +0200 Subject: [PATCH] fixup from google3 --- ortools/algorithms/dynamic_partition.h | 3 +-- ortools/constraint_solver/python/constraint_solver.i | 6 ------ ortools/linear_solver/python/model_builder_helper.cc | 9 ++------- ortools/lp_data/sparse_vector.h | 4 ++-- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/ortools/algorithms/dynamic_partition.h b/ortools/algorithms/dynamic_partition.h index 1d5072659d0..4b62db70392 100644 --- a/ortools/algorithms/dynamic_partition.h +++ b/ortools/algorithms/dynamic_partition.h @@ -34,8 +34,8 @@ #include #include +#include "absl/log/check.h" #include "absl/types/span.h" -#include "ortools/base/logging.h" namespace operations_research { @@ -405,7 +405,6 @@ inline std::vector> SimpleDynamicPartition::GetParts( starts.clear(); return result; } - } // namespace operations_research #endif // OR_TOOLS_ALGORITHMS_DYNAMIC_PARTITION_H_ diff --git a/ortools/constraint_solver/python/constraint_solver.i b/ortools/constraint_solver/python/constraint_solver.i index 36790357f3d..422d7ae2902 100644 --- a/ortools/constraint_solver/python/constraint_solver.i +++ b/ortools/constraint_solver/python/constraint_solver.i @@ -116,10 +116,6 @@ PY_CONVERT_HELPER_PTR(LocalSearchFilter); PY_CONVERT_HELPER_PTR(LocalSearchFilterManager); PY_CONVERT_HELPER_INTEXPR_AND_INTVAR(); -%{ - -%} - // Actual conversions. This also includes the conversion to std::vector. PY_CONVERT(IntVar); PY_CONVERT(IntExpr); @@ -2198,6 +2194,4 @@ class PyConstraint(Constraint): def DebugString(self): return "PyConstraint" - - } // %pythoncode diff --git a/ortools/linear_solver/python/model_builder_helper.cc b/ortools/linear_solver/python/model_builder_helper.cc index 190707af272..4759581fac2 100644 --- a/ortools/linear_solver/python/model_builder_helper.cc +++ b/ortools/linear_solver/python/model_builder_helper.cc @@ -416,13 +416,8 @@ PYBIND11_MODULE(model_builder_helper, m) { .def("enable_output", &ModelSolverHelper::EnableOutput, arg("output")) .def("has_solution", &ModelSolverHelper::has_solution) .def("has_response", &ModelSolverHelper::has_response) - .def("status", - [](const ModelSolverHelper& solver) { - // TODO(user): - // - Return the true enum when pybind11_protobuf is working. - // - Return the response proto - return static_cast(solver.status()); - }) + .def("response", &ModelSolverHelper::response) + .def("status", &ModelSolverHelper::status) .def("status_string", &ModelSolverHelper::status_string) .def("wall_time", &ModelSolverHelper::wall_time) .def("user_time", &ModelSolverHelper::user_time) diff --git a/ortools/lp_data/sparse_vector.h b/ortools/lp_data/sparse_vector.h index 139a0664495..74caf9a2b9d 100644 --- a/ortools/lp_data/sparse_vector.h +++ b/ortools/lp_data/sparse_vector.h @@ -383,8 +383,8 @@ class SparseVector { EntryIndex capacity_; // Pointers to the first elements of the index and coefficient arrays. - Index* index_; - Fractional* coefficient_; + Index* index_ = nullptr; + Fractional* coefficient_ = nullptr; // This is here to speed up the CheckNoDuplicates() methods and is mutable // so we can perform checks on const argument.