diff --git a/ortools/glop/BUILD.bazel b/ortools/glop/BUILD.bazel index 053a27d79a..f97d27785f 100644 --- a/ortools/glop/BUILD.bazel +++ b/ortools/glop/BUILD.bazel @@ -225,6 +225,10 @@ cc_library( "//ortools/lp_data:base", "//ortools/lp_data:lp_utils", "//ortools/lp_data:sparse", + "//ortools/lp_data:sparse_column", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", ], ) diff --git a/ortools/glop/initial_basis.cc b/ortools/glop/initial_basis.cc index 97734b10e6..c2d528e317 100644 --- a/ortools/glop/initial_basis.cc +++ b/ortools/glop/initial_basis.cc @@ -20,8 +20,14 @@ #include #include +#include "absl/base/optimization.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "ortools/glop/markowitz.h" +#include "ortools/lp_data/lp_types.h" #include "ortools/lp_data/lp_utils.h" +#include "ortools/lp_data/sparse.h" +#include "ortools/lp_data/sparse_column.h" namespace operations_research { namespace glop { @@ -219,6 +225,8 @@ int InitialBasis::GetMarosPriority(ColIndex col) const { case VariableType::FIXED_VARIABLE: return 0; } + LOG(FATAL) << "Invalid variable type: " + << static_cast(variable_type_[col]); } int InitialBasis::GetMarosPriority(RowIndex row) const { @@ -388,6 +396,7 @@ int InitialBasis::GetColumnCategory(ColIndex col) const { case VariableType::FIXED_VARIABLE: return 5; } + ABSL_UNREACHABLE(); } Fractional InitialBasis::GetColumnPenalty(ColIndex col) const { diff --git a/ortools/glop/primal_edge_norms.cc b/ortools/glop/primal_edge_norms.cc index 5a39d73899..49603eb133 100644 --- a/ortools/glop/primal_edge_norms.cc +++ b/ortools/glop/primal_edge_norms.cc @@ -14,6 +14,7 @@ #include "ortools/glop/primal_edge_norms.h" #include +#include #include #include "absl/log/check.h" @@ -68,6 +69,7 @@ DenseRow::ConstView PrimalEdgeNorms::GetSquaredNorms() { case GlopParameters::DEVEX: return GetDevexWeights().const_view(); } + LOG(FATAL) << "Invalid pricing rule: " << pricing_rule_; } const DenseRow& PrimalEdgeNorms::GetEdgeSquaredNorms() { diff --git a/ortools/math_opt/core/math_opt_proto_utils.cc b/ortools/math_opt/core/math_opt_proto_utils.cc index 88392dfc34..463aa026b2 100644 --- a/ortools/math_opt/core/math_opt_proto_utils.cc +++ b/ortools/math_opt/core/math_opt_proto_utils.cc @@ -21,6 +21,7 @@ #include #include +#include "absl/base/optimization.h" #include "absl/container/flat_hash_set.h" #include "absl/log/check.h" #include "absl/log/log.h" @@ -403,6 +404,7 @@ absl::Status ModelIsSupported(const ModelProto& model, case SupportType::kSupported: LOG(FATAL) << "Unexpected call with `kSupported`"; } + ABSL_UNREACHABLE(); }; if (const SupportType support = support_menu.integer_variables; support != SupportType::kSupported) { diff --git a/ortools/math_opt/elemental/BUILD.bazel b/ortools/math_opt/elemental/BUILD.bazel index 9781f2b6e3..e75df52c74 100644 --- a/ortools/math_opt/elemental/BUILD.bazel +++ b/ortools/math_opt/elemental/BUILD.bazel @@ -410,6 +410,7 @@ cc_test( ":tagged_id", "//ortools/base:gmock_main", "//ortools/math_opt/testing:stream", + "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/hash:hash_testing", "@abseil-cpp//absl/strings", ], diff --git a/ortools/math_opt/elemental/tagged_id_test.cc b/ortools/math_opt/elemental/tagged_id_test.cc index 49fc1f3435..faefea5c6d 100644 --- a/ortools/math_opt/elemental/tagged_id_test.cc +++ b/ortools/math_opt/elemental/tagged_id_test.cc @@ -18,6 +18,7 @@ #include #include +#include "absl/base/optimization.h" #include "absl/hash/hash_testing.h" #include "absl/strings/str_cat.h" #include "gtest/gtest.h" @@ -39,6 +40,7 @@ std::ostream& operator<<(std::ostream& ostr, const TestEnum& e) { ostr << "kValue0"; return ostr; } + ABSL_UNREACHABLE(); } using TestEnumId = TaggedId; diff --git a/ortools/math_opt/solver_tests/BUILD.bazel b/ortools/math_opt/solver_tests/BUILD.bazel index 9f31d474e6..f769aff01d 100644 --- a/ortools/math_opt/solver_tests/BUILD.bazel +++ b/ortools/math_opt/solver_tests/BUILD.bazel @@ -322,6 +322,7 @@ cc_library( "//ortools/math_opt/cpp:math_opt", "//ortools/math_opt/io:mps_converter", "//ortools/port:proto_utils", + "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/status", "@abseil-cpp//absl/status:statusor", "@abseil-cpp//absl/strings:string_view", diff --git a/ortools/math_opt/solver_tests/multi_objective_tests.cc b/ortools/math_opt/solver_tests/multi_objective_tests.cc index 098d3717b0..2ebefb11c4 100644 --- a/ortools/math_opt/solver_tests/multi_objective_tests.cc +++ b/ortools/math_opt/solver_tests/multi_objective_tests.cc @@ -17,6 +17,7 @@ #include #include +#include "absl/base/optimization.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" @@ -210,6 +211,7 @@ absl::StatusOr SolveWithObjectiveDegradation( case ObjectiveType::kAuxiliary: return model.AddMaximizationObjective(x, /*priority=*/0); } + ABSL_UNREACHABLE(); }(); const Objective priority_1 = [&]() { switch (priority_1_type) { @@ -220,6 +222,7 @@ absl::StatusOr SolveWithObjectiveDegradation( case ObjectiveType::kAuxiliary: return model.AddMinimizationObjective(x, /*priority=*/1); } + ABSL_UNREACHABLE(); }(); ModelSolveParameters model_parameters; switch (tolerance_type) { diff --git a/ortools/math_opt/solvers/gscip/BUILD.bazel b/ortools/math_opt/solvers/gscip/BUILD.bazel index 01474cd389..088812049a 100644 --- a/ortools/math_opt/solvers/gscip/BUILD.bazel +++ b/ortools/math_opt/solvers/gscip/BUILD.bazel @@ -97,6 +97,7 @@ cc_library( "@abseil-cpp//absl/cleanup", "@abseil-cpp//absl/container:flat_hash_map", "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log", "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/memory", "@abseil-cpp//absl/status", @@ -215,6 +216,7 @@ cc_library( deps = [ "//ortools/base:logging", "//ortools/linear_solver:scip_helper_macros", + "@abseil-cpp//absl/log:die_if_null", "@abseil-cpp//absl/status:statusor", "@abseil-cpp//absl/strings", "@scip", @@ -225,7 +227,10 @@ cc_library( name = "gscip_callback_result", srcs = ["gscip_callback_result.cc"], hdrs = ["gscip_callback_result.h"], - deps = ["@scip"], + deps = [ + "@abseil-cpp//absl/base:core_headers", + "@scip", + ], ) cc_library( diff --git a/ortools/math_opt/solvers/gscip/gscip.cc b/ortools/math_opt/solvers/gscip/gscip.cc index 7bcac209d5..1b52f6cc68 100644 --- a/ortools/math_opt/solvers/gscip/gscip.cc +++ b/ortools/math_opt/solvers/gscip/gscip.cc @@ -22,10 +22,12 @@ #include #include +#include "absl/base/optimization.h" #include "absl/cleanup/cleanup.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/status/statusor.h" @@ -35,14 +37,6 @@ #include "absl/synchronization/mutex.h" #include "absl/types/span.h" #include "lpi/lpi.h" -#include "ortools/base/logging.h" -#include "ortools/base/status_macros.h" -#include "ortools/linear_solver/scip_helper_macros.h" -#include "ortools/math_opt/solvers/gscip/gscip.pb.h" -#include "ortools/math_opt/solvers/gscip/gscip_event_handler.h" -#include "ortools/math_opt/solvers/gscip/gscip_parameters.h" -#include "ortools/port/proto_utils.h" -#include "ortools/util/status_macros.h" #include "scip/cons_and.h" #include "scip/cons_indicator.h" #include "scip/cons_linear.h" @@ -53,6 +47,13 @@ #else #include "scip/cons_quadratic.h" #endif // SCIP_VERSION_MAJOR >= 10 +#include "ortools/base/status_macros.h" +#include "ortools/linear_solver/scip_helper_macros.h" +#include "ortools/math_opt/solvers/gscip/gscip.pb.h" +#include "ortools/math_opt/solvers/gscip/gscip_event_handler.h" +#include "ortools/math_opt/solvers/gscip/gscip_parameters.h" +#include "ortools/port/proto_utils.h" +#include "ortools/util/status_macros.h" #include "scip/cons_sos1.h" #include "scip/cons_sos2.h" #include "scip/def.h" @@ -102,6 +103,7 @@ SCIP_VARTYPE ConvertVarType(const GScipVarType var_type) { case GScipVarType::kInteger: return SCIP_VARTYPE_INTEGER; } + ABSL_UNREACHABLE(); } GScipVarType ConvertVarType(const SCIP_VARTYPE var_type) { @@ -115,6 +117,7 @@ GScipVarType ConvertVarType(const SCIP_VARTYPE var_type) { case SCIP_VARTYPE_BINARY: return GScipVarType::kBinary; } + LOG(FATAL) << "Unrecognized SCIP_VARTYPE: " << var_type; } GScipOutput::Status ConvertStatus(const SCIP_STATUS scip_status) { diff --git a/ortools/math_opt/solvers/gscip/gscip_callback_result.cc b/ortools/math_opt/solvers/gscip/gscip_callback_result.cc index 5d6b4ba71c..c4d1da265a 100644 --- a/ortools/math_opt/solvers/gscip/gscip_callback_result.cc +++ b/ortools/math_opt/solvers/gscip/gscip_callback_result.cc @@ -13,6 +13,7 @@ #include "ortools/math_opt/solvers/gscip/gscip_callback_result.h" +#include "absl/base/optimization.h" #include "scip/type_result.h" namespace operations_research { @@ -56,6 +57,7 @@ SCIP_RESULT ConvertGScipCallbackResult(const GScipCallbackResult result) { case GScipCallbackResult::kDelayNode: return SCIP_DELAYNODE; } + ABSL_UNREACHABLE(); } } // namespace operations_research diff --git a/ortools/math_opt/tools/BUILD.bazel b/ortools/math_opt/tools/BUILD.bazel index d9e61c8b67..58d9f1b1e0 100644 --- a/ortools/math_opt/tools/BUILD.bazel +++ b/ortools/math_opt/tools/BUILD.bazel @@ -41,6 +41,7 @@ cc_binary( "//ortools/util:sigint", "//ortools/util:status_macros", "@abseil-cpp//absl/base:no_destructor", + "@abseil-cpp//absl/base:nullability", "@abseil-cpp//absl/flags:flag", "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/status", @@ -81,6 +82,7 @@ cc_library( "//ortools/math_opt/io:mps_converter", "//ortools/math_opt/io:proto_converter", "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/container:flat_hash_map", "@abseil-cpp//absl/log", "@abseil-cpp//absl/status", diff --git a/ortools/math_opt/tools/file_format_flags.cc b/ortools/math_opt/tools/file_format_flags.cc index 01e11c1722..bf57e67fb7 100644 --- a/ortools/math_opt/tools/file_format_flags.cc +++ b/ortools/math_opt/tools/file_format_flags.cc @@ -20,6 +20,7 @@ #include #include "absl/algorithm/container.h" +#include "absl/base/optimization.h" #include "absl/container/flat_hash_map.h" #include "absl/log/log.h" #include "absl/status/status.h" @@ -69,6 +70,7 @@ std::string AbslUnparseFlag(const FileFormat f) { case FileFormat::kLP: return "lp"; } + ABSL_UNREACHABLE(); } std::ostream& operator<<(std::ostream& out, const FileFormat f) { @@ -232,6 +234,7 @@ ReadModel(const absl::string_view file_path, const FileFormat format) { return std::make_pair(std::move(model), std::nullopt); } } + ABSL_UNREACHABLE(); } absl::Status WriteModel(const absl::string_view file_path, @@ -267,6 +270,7 @@ absl::Status WriteModel(const absl::string_view file_path, return file::SetContents(file_path, lp_data, file::Defaults()); } } + ABSL_UNREACHABLE(); } } // namespace operations_research::math_opt diff --git a/ortools/pdlp/BUILD.bazel b/ortools/pdlp/BUILD.bazel index 0e76eccfbb..64d668b803 100644 --- a/ortools/pdlp/BUILD.bazel +++ b/ortools/pdlp/BUILD.bazel @@ -135,6 +135,7 @@ cc_library( "//ortools/lp_data:proto_utils", "//ortools/util:logging", "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/base:nullability", "@abseil-cpp//absl/log", "@abseil-cpp//absl/log:check", diff --git a/ortools/pdlp/primal_dual_hybrid_gradient.cc b/ortools/pdlp/primal_dual_hybrid_gradient.cc index b86f3e9f1c..415a145598 100644 --- a/ortools/pdlp/primal_dual_hybrid_gradient.cc +++ b/ortools/pdlp/primal_dual_hybrid_gradient.cc @@ -54,6 +54,7 @@ #include "Eigen/SparseCore" #include "absl/algorithm/container.h" #include "absl/base/nullability.h" +#include "absl/base/optimization.h" #include "absl/log/check.h" #include "absl/log/log.h" #include "absl/status/status.h" @@ -250,6 +251,7 @@ void LogIterationStats(int verbosity_level, bool use_feasibility_polishing, case IterationType::kPresolveTermination: return "t "; } + ABSL_UNREACHABLE(); } else { return ""; } diff --git a/ortools/routing/BUILD.bazel b/ortools/routing/BUILD.bazel index 1e67a04d6c..76d07855dc 100644 --- a/ortools/routing/BUILD.bazel +++ b/ortools/routing/BUILD.bazel @@ -153,6 +153,7 @@ cc_library( deps = [ ":enums_cc_proto", ":ils_cc_proto", + "@abseil-cpp//absl/base:core_headers", ], ) diff --git a/ortools/routing/ils_parameters_utils.cc b/ortools/routing/ils_parameters_utils.cc index c4cff4b384..ddf5ed0ad2 100644 --- a/ortools/routing/ils_parameters_utils.cc +++ b/ortools/routing/ils_parameters_utils.cc @@ -16,6 +16,7 @@ #include #include +#include "absl/base/optimization.h" #include "ortools/routing/enums.pb.h" #include "ortools/routing/ils.pb.h" @@ -60,6 +61,7 @@ std::string GetRecreateParametersName( case RecreateParameters::PARAMETERS_NOT_SET: return "PARAMETERS_NOT_SET"; } + ABSL_UNREACHABLE(); } } // namespace operations_research::routing diff --git a/ortools/routing/parsers/BUILD.bazel b/ortools/routing/parsers/BUILD.bazel index 022f7e1f6d..8674700e65 100644 --- a/ortools/routing/parsers/BUILD.bazel +++ b/ortools/routing/parsers/BUILD.bazel @@ -310,7 +310,9 @@ cc_library( deps = [ ":simple_graph", "//ortools/base:file", - "//ortools/base:logging", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:str_format", "@abseil-cpp//absl/time", diff --git a/ortools/routing/parsers/solution_serializer.cc b/ortools/routing/parsers/solution_serializer.cc index a92efccbff..a28c567401 100644 --- a/ortools/routing/parsers/solution_serializer.cc +++ b/ortools/routing/parsers/solution_serializer.cc @@ -14,16 +14,25 @@ #include "ortools/routing/parsers/solution_serializer.h" #include +#include #include #include #include #include +#include "absl/base/attributes.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/ascii.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/time/clock.h" #include "absl/time/time.h" #include "absl/types/span.h" -#include "ortools/base/logging.h" +#include "ortools/base/file.h" +#include "ortools/base/helpers.h" +#include "ortools/base/options.h" +#include "ortools/routing/parsers/simple_graph.h" namespace operations_research::routing { diff --git a/ortools/routing/parsers/solution_serializer.h b/ortools/routing/parsers/solution_serializer.h index d1f545cafa..4e3996579a 100644 --- a/ortools/routing/parsers/solution_serializer.h +++ b/ortools/routing/parsers/solution_serializer.h @@ -17,19 +17,20 @@ #ifndef ORTOOLS_ROUTING_PARSERS_SOLUTION_SERIALIZER_H_ #define ORTOOLS_ROUTING_PARSERS_SOLUTION_SERIALIZER_H_ +#include #include #include #include #include #include +#include "absl/base/attributes.h" +#include "absl/base/optimization.h" +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/types/span.h" -#include "ortools/base/file.h" -#include "ortools/base/helpers.h" -#include "ortools/base/logging.h" #include "ortools/routing/parsers/simple_graph.h" namespace operations_research::routing { @@ -162,6 +163,7 @@ class RoutingSolution { case RoutingOutputFormat::kNEARPLIB: return SerializeToNEARPLIBString(); } + ABSL_UNREACHABLE(); } // Serializes the full solution to the given file, including metadata like @@ -180,6 +182,7 @@ class RoutingSolution { case RoutingOutputFormat::kNEARPLIB: return SerializeToNEARPLIBSolutionFile(); } + ABSL_UNREACHABLE(); } // Serializes the full solution to the given file, including metadata like @@ -263,6 +266,7 @@ std::string FormatStatistic(absl::string_view name, T value, case RoutingOutputFormat::kNEARPLIB: return absl::StrCat(name, " : ", value); } + ABSL_UNREACHABLE(); } // Specialization for doubles to show a higher precision: without this @@ -282,6 +286,7 @@ inline std::string FormatStatistic(absl::string_view name, double value, case RoutingOutputFormat::kNEARPLIB: return absl::StrFormat("%s : %f", name, value); } + ABSL_UNREACHABLE(); } // Prints a formatted solution or solver statistic according to the given diff --git a/ortools/sat/2d_rectangle_presolve.cc b/ortools/sat/2d_rectangle_presolve.cc index a3edee8627..152e48191f 100644 --- a/ortools/sat/2d_rectangle_presolve.cc +++ b/ortools/sat/2d_rectangle_presolve.cc @@ -318,6 +318,7 @@ struct Edge { .y_start = rectangle.y_min, .size = rectangle.SizeY()}; } + LOG(FATAL) << "Invalid edge position: " << static_cast(pos); } template @@ -598,6 +599,7 @@ IntegerValue GetClockwiseStart(EdgePosition edge, const Rectangle& rectangle) { case EdgePosition::TOP: return rectangle.x_min; } + LOG(FATAL) << "Invalid edge position: " << static_cast(edge); } IntegerValue GetClockwiseEnd(EdgePosition edge, const Rectangle& rectangle) { @@ -611,6 +613,7 @@ IntegerValue GetClockwiseEnd(EdgePosition edge, const Rectangle& rectangle) { case EdgePosition::TOP: return rectangle.x_max; } + LOG(FATAL) << "Invalid edge position: " << static_cast(edge); } // Given a list of rectangles and their neighbours graph, find the list of diff --git a/ortools/sat/2d_rectangle_presolve.h b/ortools/sat/2d_rectangle_presolve.h index 1ed1295fa2..19a4cbe666 100644 --- a/ortools/sat/2d_rectangle_presolve.h +++ b/ortools/sat/2d_rectangle_presolve.h @@ -21,6 +21,7 @@ #include "absl/algorithm/container.h" #include "absl/container/flat_hash_map.h" #include "absl/container/inlined_vector.h" +#include "absl/log/log.h" #include "absl/types/span.h" #include "ortools/sat/diffn_util.h" #include "ortools/sat/integer_base.h" @@ -180,6 +181,7 @@ class Neighbours { case EdgePosition::RIGHT: return std::tie(a.y_min, a.y_max) > std::tie(b.y_min, b.y_max); } + LOG(FATAL) << "Invalid edge position: " << static_cast(edge_); } EdgePosition edge_; }; diff --git a/ortools/sat/BUILD.bazel b/ortools/sat/BUILD.bazel index 0820d99794..46c06284b6 100644 --- a/ortools/sat/BUILD.bazel +++ b/ortools/sat/BUILD.bazel @@ -426,6 +426,7 @@ cc_library( "//ortools/util:bitset", "//ortools/util:saturated_arithmetic", "//ortools/util:sorted_interval_list", + "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/container:flat_hash_map", "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/flags:flag", @@ -2308,6 +2309,7 @@ cc_library( ":sat_base", ":scheduling_helpers", ":util", + "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/base:log_severity", "@abseil-cpp//absl/log", "@abseil-cpp//absl/log:check", @@ -3684,14 +3686,12 @@ cc_library( ":integer_base", ":scheduling_helpers", ":util", - "//ortools/base:logging", "//ortools/base:stl_util", "//ortools/base:strong_vector", "//ortools/graph:connected_components", "//ortools/graph:strongly_connected_components", "//ortools/util:fixed_shape_binary_tree", "//ortools/util:integer_pq", - "//ortools/util:saturated_arithmetic", "//ortools/util:strong_integers", "@abseil-cpp//absl/algorithm:container", "@abseil-cpp//absl/container:btree", @@ -3703,7 +3703,6 @@ cc_library( "@abseil-cpp//absl/log:vlog_is_on", "@abseil-cpp//absl/random:bit_gen_ref", "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/types:optional", "@abseil-cpp//absl/types:span", ], ) diff --git a/ortools/sat/cp_model_utils.cc b/ortools/sat/cp_model_utils.cc index 678cc67781..1d925ea1c2 100644 --- a/ortools/sat/cp_model_utils.cc +++ b/ortools/sat/cp_model_utils.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/base/optimization.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/flags/flag.h" @@ -547,6 +548,7 @@ absl::string_view ConstraintCaseName( case ConstraintProto::ConstraintCase::CONSTRAINT_NOT_SET: return "kEmpty"; } + ABSL_UNREACHABLE(); } std::vector UsedVariables(const ConstraintProto& ct) { diff --git a/ortools/sat/diffn_util.cc b/ortools/sat/diffn_util.cc index 7bb8e668d9..31c99b487f 100644 --- a/ortools/sat/diffn_util.cc +++ b/ortools/sat/diffn_util.cc @@ -41,7 +41,6 @@ #include "absl/log/vlog_is_on.h" #include "absl/random/bit_gen_ref.h" #include "absl/types/span.h" -#include "ortools/base/logging.h" #include "ortools/base/stl_util.h" #include "ortools/base/strong_vector.h" #include "ortools/graph/connected_components.h" @@ -1114,6 +1113,7 @@ constexpr const EdgeInfo& GetEdgeInfo(ProbingRectangle::Edge edge) { case Edge::TOP: return EdgeInfoHolder::kTop; } + LOG(FATAL) << "Invalid edge: " << static_cast(edge); } IntegerValue GetSmallest1DIntersection(ProbingRectangle::Direction direction, @@ -1129,6 +1129,7 @@ IntegerValue GetSmallest1DIntersection(ProbingRectangle::Direction direction, range.bounding_area.y_max, range.y_size, rectangle.y_min, rectangle.y_max); } + LOG(FATAL) << "Invalid direction: " << static_cast(direction); } } // namespace @@ -1391,6 +1392,7 @@ IntegerValue ProbingRectangle::GetShrinkDeltaArea(Edge edge) const { case Edge::TOP: return (current_rectangle.y_max - coordinate) * current_rectangle.SizeX(); } + LOG(FATAL) << "Invalid edge: " << static_cast(edge); } void ProbingRectangle::CacheShrinkDeltaEnergy(int dimension) { @@ -1493,6 +1495,7 @@ bool ProbingRectangle::CanShrink(Edge edge) const { case Edge::TOP: return (indexes_[Edge::TOP] > next_indexes_[Edge::BOTTOM]); } + LOG(FATAL) << "Invalid edge: " << static_cast(edge); } namespace { diff --git a/ortools/sat/diffn_util.h b/ortools/sat/diffn_util.h index 5291a71b2a..110f8f59fd 100644 --- a/ortools/sat/diffn_util.h +++ b/ortools/sat/diffn_util.h @@ -28,14 +28,13 @@ #include "absl/container/flat_hash_set.h" #include "absl/container/inlined_vector.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/random/bit_gen_ref.h" #include "absl/strings/str_format.h" -#include "absl/types/optional.h" #include "absl/types/span.h" #include "ortools/sat/integer_base.h" #include "ortools/sat/scheduling_helpers.h" #include "ortools/sat/util.h" -#include "ortools/util/saturated_arithmetic.h" #include "ortools/util/strong_integers.h" namespace operations_research { @@ -471,6 +470,7 @@ struct RectangleInRange { .y_min = bounding_area.y_max - y_size, .y_max = bounding_area.y_max}; } + LOG(FATAL) << "Invalid corner: " << static_cast(p); } Rectangle GetBoudingBox() const { return bounding_area; } diff --git a/ortools/sat/no_overlap_2d_helper.cc b/ortools/sat/no_overlap_2d_helper.cc index 35f7c08e15..d25712be18 100644 --- a/ortools/sat/no_overlap_2d_helper.cc +++ b/ortools/sat/no_overlap_2d_helper.cc @@ -19,6 +19,7 @@ #include #include "absl/base/log_severity.h" +#include "absl/base/optimization.h" #include "absl/log/check.h" #include "absl/log/log.h" #include "absl/types/span.h" @@ -188,6 +189,7 @@ bool NoOverlap2DConstraintHelper::PropagateRelativePosition( return LeftBoxBeforeRightBoxOnFirstDimension( second, first, y_helper_.get(), x_helper_.get()); } + ABSL_UNREACHABLE(); } void NoOverlap2DConstraintHelper::Reset(