From f98afa8e426cfa1c1819c96cf8ef05837892241e Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Fri, 22 Jul 2022 14:35:40 +0200 Subject: [PATCH] Add missing STL include --- ortools/algorithms/dynamic_partition.cc | 1 + ortools/algorithms/dynamic_permutation.cc | 2 + ortools/algorithms/hungarian.cc | 2 + ortools/algorithms/hungarian_test.cc | 2 + .../algorithms/knapsack_solver_for_cuts.cc | 2 + ortools/algorithms/samples/knapsack.cc | 1 + .../samples/simple_knapsack_program.cc | 1 + ortools/algorithms/sparse_permutation.cc | 1 + ortools/base/case.cc | 1 + ortools/bop/bop_base.h | 2 + ortools/bop/bop_fs.h | 1 + ortools/bop/bop_lns.h | 1 + ortools/bop/bop_ls.cc | 2 + ortools/bop/bop_ls.h | 2 + ortools/bop/bop_portfolio.cc | 1 + ortools/bop/bop_portfolio.h | 2 + ortools/bop/bop_solver.cc | 1 + ortools/bop/bop_types.h | 1 + ortools/bop/complete_optimizer.cc | 1 + ortools/bop/complete_optimizer.h | 1 + ortools/bop/integral_solver.cc | 1 + ortools/constraint_solver/assignment.cc | 1 + ortools/constraint_solver/assignment.proto | 2 + .../constraint_solver/constraint_solver.cc | 2 + .../constraint_solver/constraint_solveri.h | 3 + .../constraint_solver/demon_profiler.proto | 1 + ortools/constraint_solver/docs/CP.md | 1 + ortools/constraint_solver/docs/ROUTING.md | 1 + ortools/constraint_solver/docs/routing_svg.py | 1 + ortools/constraint_solver/routing.h | 5 +- .../routing_index_manager.cc | 2 + .../routing_lp_scheduling.cc | 10 ++++ .../constraint_solver/routing_lp_scheduling.h | 2 +- .../constraint_solver/routing_parameters.cc | 2 + .../constraint_solver/routing_parameters.h | 1 + ortools/constraint_solver/routing_sat.cc | 1 + ortools/constraint_solver/routing_search.cc | 2 + ortools/constraint_solver/routing_search.h | 2 + .../samples/minimal_jobshop_cp.cc | 6 ++ .../constraint_solver/samples/nurses_cp.cc | 4 ++ .../samples/simple_cp_program.cc | 1 + .../samples/simple_ls_program.cc | 2 + .../samples/simple_routing_program.cc | 1 + ortools/constraint_solver/samples/tsp.cc | 1 + .../samples/tsp_circuit_board.cc | 1 + .../constraint_solver/samples/tsp_cities.cc | 1 + .../samples/tsp_cities_routes.cc | 1 + .../samples/tsp_distance_matrix.cc | 1 + ortools/constraint_solver/samples/vrp.cc | 1 + .../constraint_solver/samples/vrp_breaks.cc | 1 + .../constraint_solver/samples/vrp_capacity.cc | 1 + .../samples/vrp_drop_nodes.cc | 1 + .../samples/vrp_global_span.cc | 1 + .../samples/vrp_initial_routes.cc | 1 + .../samples/vrp_pickup_delivery.cc | 1 + .../samples/vrp_pickup_delivery_fifo.cc | 1 + .../samples/vrp_pickup_delivery_lifo.cc | 1 + .../samples/vrp_resources.cc | 2 + .../constraint_solver/samples/vrp_routes.cc | 1 + .../samples/vrp_starts_ends.cc | 1 + .../samples/vrp_time_windows.cc | 2 + .../samples/vrp_with_time_limit.cc | 1 + .../samples/vrptw_store_solution_data.cc | 2 + ortools/constraint_solver/trace.cc | 1 + ortools/constraint_solver/utilities.cc | 1 + ortools/constraint_solver/visitor.cc | 1 + ortools/flatzinc/BUILD.bazel | 1 + ortools/flatzinc/checker.cc | 1 + ortools/flatzinc/cp_model_fz_solver.cc | 1 + ortools/flatzinc/fz.cc | 3 + ortools/flatzinc/model.h | 1 + ortools/flatzinc/parser_util.cc | 2 + ortools/flatzinc/parser_util.h | 1 + ortools/flatzinc/presolve.cc | 1 + ortools/flatzinc/presolve.h | 2 + ortools/glop/basis_representation.cc | 1 + ortools/glop/basis_representation.h | 1 + ortools/glop/entering_variable.cc | 2 + ortools/glop/entering_variable.h | 1 + ortools/glop/initial_basis.cc | 2 + ortools/glop/initial_basis.h | 2 + ortools/glop/lu_factorization.cc | 1 + ortools/glop/lu_factorization.h | 1 + ortools/glop/markowitz.cc | 1 + ortools/glop/markowitz.h | 1 + ortools/glop/preprocessor.cc | 7 +++ ortools/glop/preprocessor.h | 2 + ortools/glop/primal_edge_norms.h | 1 + ortools/glop/rank_one_update.h | 2 + ortools/glop/reduced_costs.h | 1 + ortools/glop/samples/simple_glop_program.cc | 1 + ortools/glop/update_row.h | 1 + ortools/glop/variable_values.cc | 1 + ortools/glop/variable_values.h | 1 + ortools/glpk/glpk_formatters.cc | 1 + ortools/graph/assignment.cc | 1 + ortools/graph/christofides.h | 1 + ortools/graph/graph.h | 1 + ortools/graph/graphs.h | 2 + ortools/graph/max_flow.cc | 2 + ortools/graph/min_cost_flow.cc | 1 + ortools/graph/one_tree_lower_bound.h | 3 + ortools/graph/perfect_matching.cc | 1 + ortools/graph/perfect_matching.h | 1 + ortools/graph/python/max_flow.cc | 2 + ortools/graph/samples/assignment_min_flow.cc | 1 + ortools/graph/samples/balance_min_flow.cc | 1 + .../graph/samples/simple_max_flow_program.cc | 1 + .../samples/simple_min_cost_flow_program.cc | 1 + ortools/graph/shortestpaths.cc | 1 + ortools/gscip/gscip_ext.cc | 3 + ortools/gscip/gscip_ext.h | 1 + ortools/gscip/legacy_scip_params.cc | 1 + ortools/linear_solver/bop_interface.cc | 2 + ortools/linear_solver/glop_interface.cc | 1 + ortools/linear_solver/gurobi_proto_solver.cc | 1 + ortools/linear_solver/linear_expr.cc | 2 + ortools/linear_solver/linear_solver.cc | 1 + ortools/linear_solver/linear_solver.h | 1 + .../linear_solver/linear_solver_callback.cc | 1 + ortools/linear_solver/model_exporter.cc | 2 + ortools/linear_solver/model_validator.cc | 1 + .../samples/assignment_groups_mip.cc | 1 + .../linear_solver/samples/assignment_mip.cc | 1 + .../samples/assignment_task_sizes_mip.cc | 1 + .../samples/assignment_teams_mip.cc | 1 + .../linear_solver/samples/bin_packing_mip.cc | 2 + .../samples/integer_programming_example.cc | 1 + .../samples/linear_programming_example.cc | 1 + .../linear_solver/samples/mip_var_array.cc | 3 + .../samples/multiple_knapsack_mip.cc | 1 + .../samples/simple_lp_program.cc | 3 + .../samples/simple_mip_program.cc | 2 + ortools/linear_solver/samples/stigler_diet.cc | 1 + ortools/linear_solver/sat_proto_solver.cc | 3 + ortools/linear_solver/sat_solver_utils.cc | 1 + ortools/linear_solver/sat_solver_utils.h | 1 + ortools/linear_solver/scip_callback.cc | 2 + ortools/lp_data/lp_data.cc | 1 + ortools/lp_data/lp_data.h | 1 + ortools/lp_data/lp_types.h | 12 ++-- ortools/lp_data/lp_utils.h | 2 + ortools/lp_data/matrix_utils.cc | 2 + ortools/lp_data/mps_reader.cc | 3 + ortools/lp_data/sparse.cc | 1 + ortools/lp_data/sparse.h | 1 + ortools/lp_data/sparse_column.h | 2 + ortools/math_opt/core/BUILD.bazel | 2 + ortools/math_opt/core/math_opt_proto_utils.cc | 1 + ortools/math_opt/core/math_opt_proto_utils.h | 33 ++++++++++- ortools/math_opt/core/sparse_submatrix.cc | 1 + ortools/math_opt/cpp/enums.h | 1 + ortools/math_opt/cpp/formatters.h | 1 + ortools/math_opt/cpp/id_map.h | 1 + ortools/math_opt/cpp/linear_constraint.h | 1 + ortools/math_opt/cpp/matchers.cc | 2 + ortools/math_opt/cpp/matchers.h | 1 + ortools/math_opt/cpp/message_callback.h | 2 + ortools/math_opt/cpp/model.cc | 4 +- ortools/math_opt/cpp/model.h | 5 ++ ortools/math_opt/cpp/parameters.cc | 1 + ortools/math_opt/cpp/solve_result.cc | 2 + ortools/math_opt/cpp/solve_result.h | 1 + ortools/math_opt/cpp/sparse_containers.cc | 2 + ortools/math_opt/cpp/statistics.cc | 2 + ortools/math_opt/cpp/statistics.h | 1 + .../cpp/streamable_solver_init_arguments.cc | 1 + .../math_opt/cpp/variable_and_expressions.cc | 1 + .../math_opt/cpp/variable_and_expressions.h | 1 + ortools/math_opt/model.proto | 59 +++++++++++++++++++ ortools/math_opt/model_update.proto | 18 ++++++ ortools/math_opt/solvers/cp_sat_solver.h | 2 - ortools/math_opt/solvers/glpk_solver.cc | 2 + ortools/math_opt/solvers/glpk_solver.h | 1 + ortools/math_opt/solvers/gscip_solver.cc | 1 + ortools/math_opt/solvers/gscip_solver.h | 2 +- ortools/math_opt/solvers/gurobi/g_gurobi.cc | 3 + ortools/math_opt/solvers/gurobi/g_gurobi.h | 2 + ortools/math_opt/solvers/gurobi_solver.cc | 1 - ortools/math_opt/solvers/gurobi_solver.h | 1 + ortools/math_opt/solvers/pdlp_bridge.cc | 1 + ortools/math_opt/storage/model_storage.cc | 1 - ortools/math_opt/storage/model_storage.h | 1 + .../math_opt/storage/model_storage_types.h | 1 + ortools/math_opt/storage/sparse_matrix.cc | 14 ++++- ortools/math_opt/storage/sparse_matrix.h | 5 ++ ortools/math_opt/tools/mathopt_solve_main.cc | 1 + ortools/math_opt/validators/enum_sets.cc | 1 + ortools/math_opt/validators/enum_sets.h | 1 + ortools/math_opt/validators/ids_validator.cc | 1 + ortools/math_opt/validators/ids_validator.h | 2 + .../python/pywrap_model_builder_helper.cc | 1 + .../wrappers/model_builder_helper.cc | 2 + .../wrappers/model_builder_helper.h | 1 + ortools/packing/arc_flow_builder.cc | 3 + ortools/packing/arc_flow_solver.cc | 2 + ortools/packing/binpacking_2d_parser.cc | 1 + ortools/packing/vector_bin_packing_parser.cc | 1 + ortools/pdlp/sharder.cc | 4 ++ ortools/sat/cp_model_presolve.cc | 4 ++ ortools/scheduling/BUILD.bazel | 2 + .../scheduling/jobshop_scheduling_parser.cc | 3 + ortools/scheduling/rcpsp_parser.cc | 2 + ortools/util/fp_roundtrip_conv.cc | 2 + ortools/util/fp_roundtrip_conv.h | 1 + ortools/util/logging.cc | 1 + ortools/util/permutation.h | 17 ++---- ortools/util/piecewise_linear_function.h | 1 + ortools/util/range_query_function.cc | 1 + ortools/util/sorted_interval_list.cc | 1 + ortools/util/stats.cc | 1 + ortools/util/stats.h | 1 + ortools/util/strong_integers.h | 8 +-- ortools/util/time_limit.cc | 2 + 214 files changed, 457 insertions(+), 32 deletions(-) diff --git a/ortools/algorithms/dynamic_partition.cc b/ortools/algorithms/dynamic_partition.cc index 6e26046547..d2590eaec2 100644 --- a/ortools/algorithms/dynamic_partition.cc +++ b/ortools/algorithms/dynamic_partition.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" diff --git a/ortools/algorithms/dynamic_permutation.cc b/ortools/algorithms/dynamic_permutation.cc index a164838572..0699807d3e 100644 --- a/ortools/algorithms/dynamic_permutation.cc +++ b/ortools/algorithms/dynamic_permutation.cc @@ -14,7 +14,9 @@ #include "ortools/algorithms/dynamic_permutation.h" #include +#include #include +#include #include "ortools/algorithms/sparse_permutation.h" diff --git a/ortools/algorithms/hungarian.cc b/ortools/algorithms/hungarian.cc index 3e5f5fa3c7..46f5cbd492 100644 --- a/ortools/algorithms/hungarian.cc +++ b/ortools/algorithms/hungarian.cc @@ -14,8 +14,10 @@ #include "ortools/algorithms/hungarian.h" #include +#include #include #include +#include #include "absl/strings/str_format.h" #include "ortools/base/logging.h" diff --git a/ortools/algorithms/hungarian_test.cc b/ortools/algorithms/hungarian_test.cc index b149ff3cbe..8790e4978f 100644 --- a/ortools/algorithms/hungarian_test.cc +++ b/ortools/algorithms/hungarian_test.cc @@ -15,7 +15,9 @@ #include "ortools/algorithms/hungarian.h" +#include #include +#include #include "absl/container/flat_hash_map.h" #include "gtest/gtest.h" diff --git a/ortools/algorithms/knapsack_solver_for_cuts.cc b/ortools/algorithms/knapsack_solver_for_cuts.cc index 2d81e7e670..eeae77500c 100644 --- a/ortools/algorithms/knapsack_solver_for_cuts.cc +++ b/ortools/algorithms/knapsack_solver_for_cuts.cc @@ -15,10 +15,12 @@ #include #include +#include #include #include #include #include +#include #include "ortools/base/logging.h" diff --git a/ortools/algorithms/samples/knapsack.cc b/ortools/algorithms/samples/knapsack.cc index b1e3e4ea57..05ee471c04 100644 --- a/ortools/algorithms/samples/knapsack.cc +++ b/ortools/algorithms/samples/knapsack.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "ortools/algorithms/knapsack_solver.h" // [END import] diff --git a/ortools/algorithms/samples/simple_knapsack_program.cc b/ortools/algorithms/samples/simple_knapsack_program.cc index a42858928a..7678efd4a5 100644 --- a/ortools/algorithms/samples/simple_knapsack_program.cc +++ b/ortools/algorithms/samples/simple_knapsack_program.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "ortools/algorithms/knapsack_solver.h" // [END import] diff --git a/ortools/algorithms/sparse_permutation.cc b/ortools/algorithms/sparse_permutation.cc index 2beaf0fede..23870bd41e 100644 --- a/ortools/algorithms/sparse_permutation.cc +++ b/ortools/algorithms/sparse_permutation.cc @@ -15,6 +15,7 @@ #include #include +#include #include "absl/strings/str_join.h" #include "ortools/base/logging.h" diff --git a/ortools/base/case.cc b/ortools/base/case.cc index 643b904ea7..a045bc8169 100644 --- a/ortools/base/case.cc +++ b/ortools/base/case.cc @@ -16,6 +16,7 @@ #include "ortools/base/case.h" #include +#include #include #include "absl/hash/hash.h" diff --git a/ortools/bop/bop_base.h b/ortools/bop/bop_base.h index c3ee3261f9..c7357c751e 100644 --- a/ortools/bop/bop_base.h +++ b/ortools/bop/bop_base.h @@ -16,7 +16,9 @@ #include #include +#include #include +#include #include "absl/synchronization/mutex.h" #include "ortools/base/basictypes.h" diff --git a/ortools/bop/bop_fs.h b/ortools/bop/bop_fs.h index 7944399ae4..f4aadf631e 100644 --- a/ortools/bop/bop_fs.h +++ b/ortools/bop/bop_fs.h @@ -15,6 +15,7 @@ #define OR_TOOLS_BOP_BOP_FS_H_ #include +#include #include #include "ortools/base/basictypes.h" diff --git a/ortools/bop/bop_lns.h b/ortools/bop/bop_lns.h index 7d939dc872..3e374c1987 100644 --- a/ortools/bop/bop_lns.h +++ b/ortools/bop/bop_lns.h @@ -15,6 +15,7 @@ #define OR_TOOLS_BOP_BOP_LNS_H_ #include +#include #include #include diff --git a/ortools/bop/bop_ls.cc b/ortools/bop/bop_ls.cc index caf44d3974..33ae64b5c8 100644 --- a/ortools/bop/bop_ls.cc +++ b/ortools/bop/bop_ls.cc @@ -14,10 +14,12 @@ #include "ortools/bop/bop_ls.h" #include +#include #include #include #include #include +#include #include "absl/memory/memory.h" #include "absl/strings/str_format.h" diff --git a/ortools/bop/bop_ls.h b/ortools/bop/bop_ls.h index e9f1df6d55..3069d0ad2f 100644 --- a/ortools/bop/bop_ls.h +++ b/ortools/bop/bop_ls.h @@ -29,7 +29,9 @@ #include #include +#include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" diff --git a/ortools/bop/bop_portfolio.cc b/ortools/bop/bop_portfolio.cc index 2f90c9516e..3e23b57566 100644 --- a/ortools/bop/bop_portfolio.cc +++ b/ortools/bop/bop_portfolio.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include "absl/memory/memory.h" #include "absl/strings/str_format.h" diff --git a/ortools/bop/bop_portfolio.h b/ortools/bop/bop_portfolio.h index 12098b62a6..027baeda42 100644 --- a/ortools/bop/bop_portfolio.h +++ b/ortools/bop/bop_portfolio.h @@ -15,7 +15,9 @@ #define OR_TOOLS_BOP_BOP_PORTFOLIO_H_ #include +#include #include +#include #include "ortools/base/strong_vector.h" #include "ortools/bop/bop_base.h" diff --git a/ortools/bop/bop_solver.cc b/ortools/bop/bop_solver.cc index 6b93d10cee..3b68d77054 100644 --- a/ortools/bop/bop_solver.cc +++ b/ortools/bop/bop_solver.cc @@ -13,6 +13,7 @@ #include "ortools/bop/bop_solver.h" +#include #include #include diff --git a/ortools/bop/bop_types.h b/ortools/bop/bop_types.h index b0bdc0e402..12fca204ed 100644 --- a/ortools/bop/bop_types.h +++ b/ortools/bop/bop_types.h @@ -15,6 +15,7 @@ #define OR_TOOLS_BOP_BOP_TYPES_H_ #include +#include #include #include "ortools/base/basictypes.h" diff --git a/ortools/bop/complete_optimizer.cc b/ortools/bop/complete_optimizer.cc index 15706e992c..80449e40b8 100644 --- a/ortools/bop/complete_optimizer.cc +++ b/ortools/bop/complete_optimizer.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include "ortools/bop/bop_util.h" #include "ortools/sat/boolean_problem.h" diff --git a/ortools/bop/complete_optimizer.h b/ortools/bop/complete_optimizer.h index eeffd0b71a..b1efb3bf5d 100644 --- a/ortools/bop/complete_optimizer.h +++ b/ortools/bop/complete_optimizer.h @@ -30,6 +30,7 @@ #include #include #include +#include #include "ortools/bop/bop_base.h" #include "ortools/bop/bop_solution.h" diff --git a/ortools/bop/integral_solver.cc b/ortools/bop/integral_solver.cc index 7c16c22059..5ef009338e 100644 --- a/ortools/bop/integral_solver.cc +++ b/ortools/bop/integral_solver.cc @@ -16,6 +16,7 @@ #include #include +#include #include #include #include diff --git a/ortools/constraint_solver/assignment.cc b/ortools/constraint_solver/assignment.cc index 1e1363b1c5..6808a70a71 100644 --- a/ortools/constraint_solver/assignment.cc +++ b/ortools/constraint_solver/assignment.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include diff --git a/ortools/constraint_solver/assignment.proto b/ortools/constraint_solver/assignment.proto index da1b2c29f1..cdd5e4b1c8 100644 --- a/ortools/constraint_solver/assignment.proto +++ b/ortools/constraint_solver/assignment.proto @@ -14,6 +14,7 @@ syntax = "proto3"; + package operations_research; // Storage for IntVars. @@ -62,3 +63,4 @@ message AssignmentProto { WorkerInfo worker_info = 4; bool is_valid = 5; } + diff --git a/ortools/constraint_solver/constraint_solver.cc b/ortools/constraint_solver/constraint_solver.cc index d54c740232..f2a9ce757b 100644 --- a/ortools/constraint_solver/constraint_solver.cc +++ b/ortools/constraint_solver/constraint_solver.cc @@ -24,8 +24,10 @@ #include #include #include +#include #include #include +#include #include "absl/memory/memory.h" #include "absl/time/clock.h" diff --git a/ortools/constraint_solver/constraint_solveri.h b/ortools/constraint_solver/constraint_solveri.h index 83c2c3ff37..020e95b5c4 100644 --- a/ortools/constraint_solver/constraint_solveri.h +++ b/ortools/constraint_solver/constraint_solveri.h @@ -1009,6 +1009,7 @@ class IntVarLocalSearchHandler { IntVarLocalSearchHandler>::OnStart; // clang-format on #endif // SWIGPYTHON + // clang-format off %rename(IntVarLocalSearchOperatorTemplate) VarLocalSearchOperator; @@ -3256,6 +3257,8 @@ class PathState::Chain { Iterator begin() const { return Iterator(begin_); } Iterator end() const { return Iterator(end_); } + Chain WithoutFirstNode() const { return Chain(begin_ + 1, end_); } + private: const CommittedNode* const begin_; const CommittedNode* const end_; diff --git a/ortools/constraint_solver/demon_profiler.proto b/ortools/constraint_solver/demon_profiler.proto index 2be48b602e..e276faad36 100644 --- a/ortools/constraint_solver/demon_profiler.proto +++ b/ortools/constraint_solver/demon_profiler.proto @@ -14,6 +14,7 @@ syntax = "proto3"; + package operations_research; message DemonRuns { diff --git a/ortools/constraint_solver/docs/CP.md b/ortools/constraint_solver/docs/CP.md index 3388268a13..633d5d489b 100644 --- a/ortools/constraint_solver/docs/CP.md +++ b/ortools/constraint_solver/docs/CP.md @@ -12,6 +12,7 @@ Java and .Net. Each language have different requirements for the code samples. ### C++ code samples ```cpp +#include #include #include "ortools/constraint_solver/constraint_solver.h" diff --git a/ortools/constraint_solver/docs/ROUTING.md b/ortools/constraint_solver/docs/ROUTING.md index f85066578b..7bb360c2f0 100644 --- a/ortools/constraint_solver/docs/ROUTING.md +++ b/ortools/constraint_solver/docs/ROUTING.md @@ -21,6 +21,7 @@ and .Net. Each language have different requirements for the code samples. ```cpp #include #include +#include #include "ortools/constraint_solver/routing.h" #include "ortools/constraint_solver/routing_enums.pb.h" diff --git a/ortools/constraint_solver/docs/routing_svg.py b/ortools/constraint_solver/docs/routing_svg.py index 3e982e6e7a..9fd664d683 100755 --- a/ortools/constraint_solver/docs/routing_svg.py +++ b/ortools/constraint_solver/docs/routing_svg.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + """Generate SVG for a Routing problem.""" # [START import] diff --git a/ortools/constraint_solver/routing.h b/ortools/constraint_solver/routing.h index eef5ce3573..a2538e941a 100644 --- a/ortools/constraint_solver/routing.h +++ b/ortools/constraint_solver/routing.h @@ -1934,7 +1934,10 @@ class RoutingModel { std::vector vehicle_vars_; std::vector active_; /// Resource variables, indexed first by resource group index and then by - /// vehicle index. + /// vehicle index. A resource variable can have a negative value of -1, iff + /// the corresponding vehicle doesn't require a resource from this resource + /// group, OR if the vehicle is unused (i.e. no visits on its route and + /// vehicle_used_when_empty_[v] is false). // clang-format off std::vector > resource_vars_; // clang-format on diff --git a/ortools/constraint_solver/routing_index_manager.cc b/ortools/constraint_solver/routing_index_manager.cc index 5820171a76..167131c827 100644 --- a/ortools/constraint_solver/routing_index_manager.cc +++ b/ortools/constraint_solver/routing_index_manager.cc @@ -15,6 +15,8 @@ #include #include +#include +#include #include "absl/container/flat_hash_set.h" #include "ortools/base/logging.h" diff --git a/ortools/constraint_solver/routing_lp_scheduling.cc b/ortools/constraint_solver/routing_lp_scheduling.cc index 8aa6c0c661..8deca00cbb 100644 --- a/ortools/constraint_solver/routing_lp_scheduling.cc +++ b/ortools/constraint_solver/routing_lp_scheduling.cc @@ -14,15 +14,23 @@ #include "ortools/constraint_solver/routing_lp_scheduling.h" #include +#include #include #include #include #include #include #include +#include #include #include +#include "absl/algorithm/container.h" +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "absl/memory/memory.h" +#include "absl/strings/str_format.h" +#include "absl/strings/str_join.h" #include "absl/time/time.h" #include "ortools/base/logging.h" #include "ortools/base/mathutil.h" @@ -31,6 +39,8 @@ #include "ortools/constraint_solver/routing_parameters.pb.h" #include "ortools/glop/parameters.pb.h" #include "ortools/graph/min_cost_flow.h" +#include "ortools/sat/cp_model.pb.h" +#include "ortools/sat/lp_utils.h" #include "ortools/util/saturated_arithmetic.h" #include "ortools/util/sorted_interval_list.h" diff --git a/ortools/constraint_solver/routing_lp_scheduling.h b/ortools/constraint_solver/routing_lp_scheduling.h index 7e4546665a..eaa45342e3 100644 --- a/ortools/constraint_solver/routing_lp_scheduling.h +++ b/ortools/constraint_solver/routing_lp_scheduling.h @@ -263,7 +263,7 @@ class RoutingGlopWrapper : public RoutingLinearSolverWrapper { return linear_program_.CreateNewVariable().value(); } void SetVariableName(int index, absl::string_view name) override { - linear_program_.SetVariableName(index, name); + linear_program_.SetVariableName(glop::ColIndex(index), name); } bool SetVariableBounds(int index, int64_t lower_bound, int64_t upper_bound) override { diff --git a/ortools/constraint_solver/routing_parameters.cc b/ortools/constraint_solver/routing_parameters.cc index 048e3c70bd..533e2226f4 100644 --- a/ortools/constraint_solver/routing_parameters.cc +++ b/ortools/constraint_solver/routing_parameters.cc @@ -13,8 +13,10 @@ #include "ortools/constraint_solver/routing_parameters.h" +#include #include #include +#include #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" diff --git a/ortools/constraint_solver/routing_parameters.h b/ortools/constraint_solver/routing_parameters.h index aedd34624a..fa7b09bf79 100644 --- a/ortools/constraint_solver/routing_parameters.h +++ b/ortools/constraint_solver/routing_parameters.h @@ -15,6 +15,7 @@ #define OR_TOOLS_CONSTRAINT_SOLVER_ROUTING_PARAMETERS_H_ #include +#include #include "ortools/constraint_solver/routing_parameters.pb.h" diff --git a/ortools/constraint_solver/routing_sat.cc b/ortools/constraint_solver/routing_sat.cc index 4c0acecbd1..0cf822086a 100644 --- a/ortools/constraint_solver/routing_sat.cc +++ b/ortools/constraint_solver/routing_sat.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/ortools/constraint_solver/routing_search.cc b/ortools/constraint_solver/routing_search.cc index ccfeeb772b..2297f33782 100644 --- a/ortools/constraint_solver/routing_search.cc +++ b/ortools/constraint_solver/routing_search.cc @@ -25,8 +25,10 @@ #include #include #include +#include #include #include +#include #include #include #include diff --git a/ortools/constraint_solver/routing_search.h b/ortools/constraint_solver/routing_search.h index 262ecadb87..ffc387a868 100644 --- a/ortools/constraint_solver/routing_search.h +++ b/ortools/constraint_solver/routing_search.h @@ -19,7 +19,9 @@ #include #include #include +#include #include +#include #include #include #include diff --git a/ortools/constraint_solver/samples/minimal_jobshop_cp.cc b/ortools/constraint_solver/samples/minimal_jobshop_cp.cc index 657bd20ce8..8d4a1ef13b 100644 --- a/ortools/constraint_solver/samples/minimal_jobshop_cp.cc +++ b/ortools/constraint_solver/samples/minimal_jobshop_cp.cc @@ -11,9 +11,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include +#include #include // std::iota +#include +#include #include +#include +#include #include "absl/flags/flag.h" #include "ortools/base/init_google.h" diff --git a/ortools/constraint_solver/samples/nurses_cp.cc b/ortools/constraint_solver/samples/nurses_cp.cc index 8faabf9dcb..1a5ca19b1d 100644 --- a/ortools/constraint_solver/samples/nurses_cp.cc +++ b/ortools/constraint_solver/samples/nurses_cp.cc @@ -11,7 +11,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include #include // std::iota +#include +#include #include "absl/flags/flag.h" #include "ortools/base/init_google.h" diff --git a/ortools/constraint_solver/samples/simple_cp_program.cc b/ortools/constraint_solver/samples/simple_cp_program.cc index 11822a0e46..f0bf3868a9 100644 --- a/ortools/constraint_solver/samples/simple_cp_program.cc +++ b/ortools/constraint_solver/samples/simple_cp_program.cc @@ -13,6 +13,7 @@ // [START program] // [START import] +#include #include #include "ortools/constraint_solver/constraint_solver.h" diff --git a/ortools/constraint_solver/samples/simple_ls_program.cc b/ortools/constraint_solver/samples/simple_ls_program.cc index d16c21dad7..8777a9aa82 100644 --- a/ortools/constraint_solver/samples/simple_ls_program.cc +++ b/ortools/constraint_solver/samples/simple_ls_program.cc @@ -15,6 +15,8 @@ // Local Search. It solves the same trivial problem with a Large // Neighborhood Search approach, a Local Search approach, and a Local // Search with Filter approach. +#include + #include "ortools/base/init_google.h" #include "ortools/base/logging.h" #include "ortools/base/logging_flags.h" diff --git a/ortools/constraint_solver/samples/simple_routing_program.cc b/ortools/constraint_solver/samples/simple_routing_program.cc index a7f8462dc2..958b1e7732 100644 --- a/ortools/constraint_solver/samples/simple_routing_program.cc +++ b/ortools/constraint_solver/samples/simple_routing_program.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include "ortools/constraint_solver/routing.h" #include "ortools/constraint_solver/routing_enums.pb.h" diff --git a/ortools/constraint_solver/samples/tsp.cc b/ortools/constraint_solver/samples/tsp.cc index b7365079a6..90bf9183a4 100644 --- a/ortools/constraint_solver/samples/tsp.cc +++ b/ortools/constraint_solver/samples/tsp.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/tsp_circuit_board.cc b/ortools/constraint_solver/samples/tsp_circuit_board.cc index 5793677ad5..8dc13cb7eb 100644 --- a/ortools/constraint_solver/samples/tsp_circuit_board.cc +++ b/ortools/constraint_solver/samples/tsp_circuit_board.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/tsp_cities.cc b/ortools/constraint_solver/samples/tsp_cities.cc index 9526030d85..7f64fe592f 100644 --- a/ortools/constraint_solver/samples/tsp_cities.cc +++ b/ortools/constraint_solver/samples/tsp_cities.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/tsp_cities_routes.cc b/ortools/constraint_solver/samples/tsp_cities_routes.cc index b4e27e9bf6..0b0d052369 100644 --- a/ortools/constraint_solver/samples/tsp_cities_routes.cc +++ b/ortools/constraint_solver/samples/tsp_cities_routes.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/tsp_distance_matrix.cc b/ortools/constraint_solver/samples/tsp_distance_matrix.cc index 71b02172a7..5301d9702d 100644 --- a/ortools/constraint_solver/samples/tsp_distance_matrix.cc +++ b/ortools/constraint_solver/samples/tsp_distance_matrix.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp.cc b/ortools/constraint_solver/samples/vrp.cc index 2725a2befe..8831f120a7 100644 --- a/ortools/constraint_solver/samples/vrp.cc +++ b/ortools/constraint_solver/samples/vrp.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_breaks.cc b/ortools/constraint_solver/samples/vrp_breaks.cc index 0b607fca80..eee1de0956 100644 --- a/ortools/constraint_solver/samples/vrp_breaks.cc +++ b/ortools/constraint_solver/samples/vrp_breaks.cc @@ -21,6 +21,7 @@ // [START program] // [START import] #include +#include #include #include "ortools/constraint_solver/constraint_solver.h" diff --git a/ortools/constraint_solver/samples/vrp_capacity.cc b/ortools/constraint_solver/samples/vrp_capacity.cc index cab2f08177..84b01b1dc1 100644 --- a/ortools/constraint_solver/samples/vrp_capacity.cc +++ b/ortools/constraint_solver/samples/vrp_capacity.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include #include "google/protobuf/duration.pb.h" diff --git a/ortools/constraint_solver/samples/vrp_drop_nodes.cc b/ortools/constraint_solver/samples/vrp_drop_nodes.cc index 9e4dee5481..d53afc6270 100644 --- a/ortools/constraint_solver/samples/vrp_drop_nodes.cc +++ b/ortools/constraint_solver/samples/vrp_drop_nodes.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include #include "google/protobuf/duration.pb.h" diff --git a/ortools/constraint_solver/samples/vrp_global_span.cc b/ortools/constraint_solver/samples/vrp_global_span.cc index c852fa88f2..de4ffbe7de 100644 --- a/ortools/constraint_solver/samples/vrp_global_span.cc +++ b/ortools/constraint_solver/samples/vrp_global_span.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_initial_routes.cc b/ortools/constraint_solver/samples/vrp_initial_routes.cc index ea0b614741..52e4fe836e 100644 --- a/ortools/constraint_solver/samples/vrp_initial_routes.cc +++ b/ortools/constraint_solver/samples/vrp_initial_routes.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_pickup_delivery.cc b/ortools/constraint_solver/samples/vrp_pickup_delivery.cc index 2f69e38647..b740d0c054 100644 --- a/ortools/constraint_solver/samples/vrp_pickup_delivery.cc +++ b/ortools/constraint_solver/samples/vrp_pickup_delivery.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_pickup_delivery_fifo.cc b/ortools/constraint_solver/samples/vrp_pickup_delivery_fifo.cc index 0a0efa84b4..4b3cc52fa5 100644 --- a/ortools/constraint_solver/samples/vrp_pickup_delivery_fifo.cc +++ b/ortools/constraint_solver/samples/vrp_pickup_delivery_fifo.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_pickup_delivery_lifo.cc b/ortools/constraint_solver/samples/vrp_pickup_delivery_lifo.cc index 35f9125154..502b23794a 100644 --- a/ortools/constraint_solver/samples/vrp_pickup_delivery_lifo.cc +++ b/ortools/constraint_solver/samples/vrp_pickup_delivery_lifo.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_resources.cc b/ortools/constraint_solver/samples/vrp_resources.cc index 003fbed942..962096aa5a 100644 --- a/ortools/constraint_solver/samples/vrp_resources.cc +++ b/ortools/constraint_solver/samples/vrp_resources.cc @@ -14,7 +14,9 @@ // [START program] // [START import] #include +#include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_routes.cc b/ortools/constraint_solver/samples/vrp_routes.cc index c1ebd8507f..6df7757676 100644 --- a/ortools/constraint_solver/samples/vrp_routes.cc +++ b/ortools/constraint_solver/samples/vrp_routes.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_starts_ends.cc b/ortools/constraint_solver/samples/vrp_starts_ends.cc index 0c8e1430bd..ec5122760a 100644 --- a/ortools/constraint_solver/samples/vrp_starts_ends.cc +++ b/ortools/constraint_solver/samples/vrp_starts_ends.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_time_windows.cc b/ortools/constraint_solver/samples/vrp_time_windows.cc index 3ddae06213..889b5928e3 100644 --- a/ortools/constraint_solver/samples/vrp_time_windows.cc +++ b/ortools/constraint_solver/samples/vrp_time_windows.cc @@ -14,7 +14,9 @@ // [START program] // [START import] #include +#include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/samples/vrp_with_time_limit.cc b/ortools/constraint_solver/samples/vrp_with_time_limit.cc index 4d61d1973f..fb5a536ba3 100644 --- a/ortools/constraint_solver/samples/vrp_with_time_limit.cc +++ b/ortools/constraint_solver/samples/vrp_with_time_limit.cc @@ -15,6 +15,7 @@ // [START import] #include #include +#include #include #include "google/protobuf/duration.pb.h" diff --git a/ortools/constraint_solver/samples/vrptw_store_solution_data.cc b/ortools/constraint_solver/samples/vrptw_store_solution_data.cc index c32d0ddf3b..d8eb377d17 100644 --- a/ortools/constraint_solver/samples/vrptw_store_solution_data.cc +++ b/ortools/constraint_solver/samples/vrptw_store_solution_data.cc @@ -14,7 +14,9 @@ // [START program] // [START import] #include +#include #include +#include #include #include "ortools/constraint_solver/routing.h" diff --git a/ortools/constraint_solver/trace.cc b/ortools/constraint_solver/trace.cc index 1b4e9ac09f..49501228e8 100644 --- a/ortools/constraint_solver/trace.cc +++ b/ortools/constraint_solver/trace.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/strings/str_format.h" diff --git a/ortools/constraint_solver/utilities.cc b/ortools/constraint_solver/utilities.cc index cf77b425c1..ea851c2c7d 100644 --- a/ortools/constraint_solver/utilities.cc +++ b/ortools/constraint_solver/utilities.cc @@ -13,6 +13,7 @@ #include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" diff --git a/ortools/constraint_solver/visitor.cc b/ortools/constraint_solver/visitor.cc index 35cd145b82..32fd754f5f 100644 --- a/ortools/constraint_solver/visitor.cc +++ b/ortools/constraint_solver/visitor.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "absl/container/flat_hash_map.h" diff --git a/ortools/flatzinc/BUILD.bazel b/ortools/flatzinc/BUILD.bazel index 923b384d4a..99cff45979 100644 --- a/ortools/flatzinc/BUILD.bazel +++ b/ortools/flatzinc/BUILD.bazel @@ -175,6 +175,7 @@ cc_binary( ":parser_lib", ":presolve", "//ortools/base", + "//ortools/base:path", "//ortools/base:threadpool", "//ortools/util:logging", ], diff --git a/ortools/flatzinc/checker.cc b/ortools/flatzinc/checker.cc index d52257505f..ccec7b85a0 100644 --- a/ortools/flatzinc/checker.cc +++ b/ortools/flatzinc/checker.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" diff --git a/ortools/flatzinc/cp_model_fz_solver.cc b/ortools/flatzinc/cp_model_fz_solver.cc index b7e78a2c2f..704b47c247 100644 --- a/ortools/flatzinc/cp_model_fz_solver.cc +++ b/ortools/flatzinc/cp_model_fz_solver.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/strings/match.h" diff --git a/ortools/flatzinc/fz.cc b/ortools/flatzinc/fz.cc index f4bc8148e0..d86fc8de1d 100644 --- a/ortools/flatzinc/fz.cc +++ b/ortools/flatzinc/fz.cc @@ -17,12 +17,15 @@ #include +#include "ortools/base/path.h" + #if defined(__GNUC__) // Linux or Mac OS X. #include #endif // __GNUC__ #include #include +#include #include #include diff --git a/ortools/flatzinc/model.h b/ortools/flatzinc/model.h index 3bccde059b..8a38c6a731 100644 --- a/ortools/flatzinc/model.h +++ b/ortools/flatzinc/model.h @@ -18,6 +18,7 @@ #include #include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/strings/string_view.h" diff --git a/ortools/flatzinc/parser_util.cc b/ortools/flatzinc/parser_util.cc index 76819904d4..0427db7ff9 100644 --- a/ortools/flatzinc/parser_util.cc +++ b/ortools/flatzinc/parser_util.cc @@ -15,7 +15,9 @@ // Included in parser.tab.cc. #include "ortools/flatzinc/parser_util.h" +#include #include +#include #include "ortools/base/integral_types.h" #include "ortools/base/logging.h" diff --git a/ortools/flatzinc/parser_util.h b/ortools/flatzinc/parser_util.h index 42601475df..4f6aa25894 100644 --- a/ortools/flatzinc/parser_util.h +++ b/ortools/flatzinc/parser_util.h @@ -20,6 +20,7 @@ #include #include #include +#include #include "absl/container/flat_hash_map.h" #include "ortools/flatzinc/model.h" diff --git a/ortools/flatzinc/presolve.cc b/ortools/flatzinc/presolve.cc index 0c0854e21f..e3f00a81a9 100644 --- a/ortools/flatzinc/presolve.cc +++ b/ortools/flatzinc/presolve.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include "absl/strings/match.h" #include "absl/strings/str_format.h" diff --git a/ortools/flatzinc/presolve.h b/ortools/flatzinc/presolve.h index 10a1c98744..273c6715f6 100644 --- a/ortools/flatzinc/presolve.h +++ b/ortools/flatzinc/presolve.h @@ -16,7 +16,9 @@ #include #include +#include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" diff --git a/ortools/glop/basis_representation.cc b/ortools/glop/basis_representation.cc index c1bd55f05e..88c9bd3ee0 100644 --- a/ortools/glop/basis_representation.cc +++ b/ortools/glop/basis_representation.cc @@ -14,6 +14,7 @@ #include "ortools/glop/basis_representation.h" #include +#include #include "ortools/base/stl_util.h" #include "ortools/glop/status.h" diff --git a/ortools/glop/basis_representation.h b/ortools/glop/basis_representation.h index 9aeb229662..10cd87075f 100644 --- a/ortools/glop/basis_representation.h +++ b/ortools/glop/basis_representation.h @@ -15,6 +15,7 @@ #define OR_TOOLS_GLOP_BASIS_REPRESENTATION_H_ #include +#include #include "ortools/base/logging.h" #include "ortools/glop/lu_factorization.h" diff --git a/ortools/glop/entering_variable.cc b/ortools/glop/entering_variable.cc index c34651216a..721bbae34f 100644 --- a/ortools/glop/entering_variable.cc +++ b/ortools/glop/entering_variable.cc @@ -14,7 +14,9 @@ #include "ortools/glop/entering_variable.h" #include +#include #include +#include #include "ortools/base/timer.h" #include "ortools/lp_data/lp_utils.h" diff --git a/ortools/glop/entering_variable.h b/ortools/glop/entering_variable.h index 0b2937ad91..6e0aea3acc 100644 --- a/ortools/glop/entering_variable.h +++ b/ortools/glop/entering_variable.h @@ -16,6 +16,7 @@ #include #include +#include #include "absl/random/bit_gen_ref.h" #include "ortools/glop/basis_representation.h" diff --git a/ortools/glop/initial_basis.cc b/ortools/glop/initial_basis.cc index 40bd5900a3..587df936f4 100644 --- a/ortools/glop/initial_basis.cc +++ b/ortools/glop/initial_basis.cc @@ -14,7 +14,9 @@ #include "ortools/glop/initial_basis.h" #include +#include #include +#include #include "ortools/glop/markowitz.h" #include "ortools/lp_data/lp_utils.h" diff --git a/ortools/glop/initial_basis.h b/ortools/glop/initial_basis.h index f9eff42a5d..2d59187393 100644 --- a/ortools/glop/initial_basis.h +++ b/ortools/glop/initial_basis.h @@ -14,6 +14,8 @@ #ifndef OR_TOOLS_GLOP_INITIAL_BASIS_H_ #define OR_TOOLS_GLOP_INITIAL_BASIS_H_ +#include + #include "ortools/lp_data/lp_data.h" #include "ortools/lp_data/lp_types.h" #include "ortools/lp_data/sparse.h" diff --git a/ortools/glop/lu_factorization.cc b/ortools/glop/lu_factorization.cc index 96a2e03756..70a7b9c116 100644 --- a/ortools/glop/lu_factorization.cc +++ b/ortools/glop/lu_factorization.cc @@ -15,6 +15,7 @@ #include #include +#include #include "ortools/lp_data/lp_types.h" #include "ortools/lp_data/lp_utils.h" diff --git a/ortools/glop/lu_factorization.h b/ortools/glop/lu_factorization.h index 07f280261a..bd1b623ed5 100644 --- a/ortools/glop/lu_factorization.h +++ b/ortools/glop/lu_factorization.h @@ -15,6 +15,7 @@ #define OR_TOOLS_GLOP_LU_FACTORIZATION_H_ #include +#include #include "ortools/glop/markowitz.h" #include "ortools/glop/parameters.pb.h" diff --git a/ortools/glop/markowitz.cc b/ortools/glop/markowitz.cc index 821d92f8fd..b42051f28a 100644 --- a/ortools/glop/markowitz.cc +++ b/ortools/glop/markowitz.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include "absl/strings/str_format.h" #include "ortools/lp_data/lp_types.h" diff --git a/ortools/glop/markowitz.h b/ortools/glop/markowitz.h index 751ed03a67..b377f8f03e 100644 --- a/ortools/glop/markowitz.h +++ b/ortools/glop/markowitz.h @@ -76,6 +76,7 @@ #include #include #include +#include #include "absl/container/inlined_vector.h" #include "ortools/base/logging.h" diff --git a/ortools/glop/preprocessor.cc b/ortools/glop/preprocessor.cc index 64cdebba35..28a0700a40 100644 --- a/ortools/glop/preprocessor.cc +++ b/ortools/glop/preprocessor.cc @@ -14,10 +14,17 @@ #include "ortools/glop/preprocessor.h" #include +#include #include +#include +#include +#include #include +#include +#include #include #include +#include #include "absl/strings/str_format.h" #include "ortools/base/iterator_adaptors.h" diff --git a/ortools/glop/preprocessor.h b/ortools/glop/preprocessor.h index b4b55b6a54..0435c7cd07 100644 --- a/ortools/glop/preprocessor.h +++ b/ortools/glop/preprocessor.h @@ -21,8 +21,10 @@ #ifndef OR_TOOLS_GLOP_PREPROCESSOR_H_ #define OR_TOOLS_GLOP_PREPROCESSOR_H_ +#include #include #include +#include #include "ortools/base/strong_vector.h" #include "ortools/glop/parameters.pb.h" diff --git a/ortools/glop/primal_edge_norms.h b/ortools/glop/primal_edge_norms.h index c4514092a0..22fcc55dc5 100644 --- a/ortools/glop/primal_edge_norms.h +++ b/ortools/glop/primal_edge_norms.h @@ -16,6 +16,7 @@ #include #include +#include #include "ortools/glop/basis_representation.h" #include "ortools/glop/parameters.pb.h" diff --git a/ortools/glop/rank_one_update.h b/ortools/glop/rank_one_update.h index 518298c00c..0057ab0960 100644 --- a/ortools/glop/rank_one_update.h +++ b/ortools/glop/rank_one_update.h @@ -14,6 +14,8 @@ #ifndef OR_TOOLS_GLOP_RANK_ONE_UPDATE_H_ #define OR_TOOLS_GLOP_RANK_ONE_UPDATE_H_ +#include + #include "ortools/base/logging.h" #include "ortools/lp_data/lp_types.h" #include "ortools/lp_data/lp_utils.h" diff --git a/ortools/glop/reduced_costs.h b/ortools/glop/reduced_costs.h index 56bb56504b..b0996feb19 100644 --- a/ortools/glop/reduced_costs.h +++ b/ortools/glop/reduced_costs.h @@ -15,6 +15,7 @@ #define OR_TOOLS_GLOP_REDUCED_COSTS_H_ #include +#include #include "absl/random/bit_gen_ref.h" #include "ortools/glop/basis_representation.h" diff --git a/ortools/glop/samples/simple_glop_program.cc b/ortools/glop/samples/simple_glop_program.cc index c7efa33655..5dcbbbed5c 100644 --- a/ortools/glop/samples/simple_glop_program.cc +++ b/ortools/glop/samples/simple_glop_program.cc @@ -15,6 +15,7 @@ // [START program] // [START import] #include +#include #include "ortools/glop/lp_solver.h" #include "ortools/lp_data/lp_data.h" diff --git a/ortools/glop/update_row.h b/ortools/glop/update_row.h index 9ca6cd799d..42a487e973 100644 --- a/ortools/glop/update_row.h +++ b/ortools/glop/update_row.h @@ -16,6 +16,7 @@ #include #include +#include #include "ortools/glop/basis_representation.h" #include "ortools/glop/parameters.pb.h" diff --git a/ortools/glop/variable_values.cc b/ortools/glop/variable_values.cc index 42047e2f89..cc8638f880 100644 --- a/ortools/glop/variable_values.cc +++ b/ortools/glop/variable_values.cc @@ -14,6 +14,7 @@ #include "ortools/glop/variable_values.h" #include +#include #include "ortools/graph/iterators.h" #include "ortools/lp_data/lp_utils.h" diff --git a/ortools/glop/variable_values.h b/ortools/glop/variable_values.h index 3e9d36351b..ce6f36ef22 100644 --- a/ortools/glop/variable_values.h +++ b/ortools/glop/variable_values.h @@ -15,6 +15,7 @@ #define OR_TOOLS_GLOP_VARIABLE_VALUES_H_ #include +#include #include "ortools/glop/basis_representation.h" #include "ortools/glop/dual_edge_norms.h" diff --git a/ortools/glpk/glpk_formatters.cc b/ortools/glpk/glpk_formatters.cc index 05194481bc..9434555865 100644 --- a/ortools/glpk/glpk_formatters.cc +++ b/ortools/glpk/glpk_formatters.cc @@ -13,6 +13,7 @@ #include "ortools/glpk/glpk_formatters.h" +#include #include #include diff --git a/ortools/graph/assignment.cc b/ortools/graph/assignment.cc index d796d1be6d..1a6a967e13 100644 --- a/ortools/graph/assignment.cc +++ b/ortools/graph/assignment.cc @@ -14,6 +14,7 @@ #include "ortools/graph/assignment.h" #include +#include #include "ortools/base/commandlineflags.h" #include "ortools/graph/ebert_graph.h" diff --git a/ortools/graph/christofides.h b/ortools/graph/christofides.h index a8ff4173ca..83ffba6502 100644 --- a/ortools/graph/christofides.h +++ b/ortools/graph/christofides.h @@ -28,6 +28,7 @@ #include #include +#include #include "absl/status/status.h" #include "absl/status/statusor.h" diff --git a/ortools/graph/graph.h b/ortools/graph/graph.h index 81e1cc7a66..42e49c3fe7 100644 --- a/ortools/graph/graph.h +++ b/ortools/graph/graph.h @@ -162,6 +162,7 @@ #include #include #include +#include #include #include "absl/base/port.h" diff --git a/ortools/graph/graphs.h b/ortools/graph/graphs.h index c6483a0fc1..b8c84159aa 100644 --- a/ortools/graph/graphs.h +++ b/ortools/graph/graphs.h @@ -17,6 +17,8 @@ #ifndef OR_TOOLS_GRAPH_GRAPHS_H_ #define OR_TOOLS_GRAPH_GRAPHS_H_ +#include + #include "ortools/graph/ebert_graph.h" namespace operations_research { diff --git a/ortools/graph/max_flow.cc b/ortools/graph/max_flow.cc index a534c572c6..f3b5b6fa0a 100644 --- a/ortools/graph/max_flow.cc +++ b/ortools/graph/max_flow.cc @@ -14,8 +14,10 @@ #include "ortools/graph/max_flow.h" #include +#include #include #include +#include #include "absl/memory/memory.h" #include "absl/strings/str_format.h" diff --git a/ortools/graph/min_cost_flow.cc b/ortools/graph/min_cost_flow.cc index 7d46981cef..afdab1253c 100644 --- a/ortools/graph/min_cost_flow.cc +++ b/ortools/graph/min_cost_flow.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "absl/strings/str_format.h" #include "ortools/base/commandlineflags.h" diff --git a/ortools/graph/one_tree_lower_bound.h b/ortools/graph/one_tree_lower_bound.h index 05fd548749..8ce00d2622 100644 --- a/ortools/graph/one_tree_lower_bound.h +++ b/ortools/graph/one_tree_lower_bound.h @@ -123,9 +123,12 @@ #include +#include #include #include #include +#include +#include #include "ortools/base/integral_types.h" #include "ortools/graph/christofides.h" diff --git a/ortools/graph/perfect_matching.cc b/ortools/graph/perfect_matching.cc index 53dccb2c2e..f1dd4d10a3 100644 --- a/ortools/graph/perfect_matching.cc +++ b/ortools/graph/perfect_matching.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include "absl/memory/memory.h" #include "ortools/util/saturated_arithmetic.h" diff --git a/ortools/graph/perfect_matching.h b/ortools/graph/perfect_matching.h index 2eb2978ffb..c4df188f5a 100644 --- a/ortools/graph/perfect_matching.h +++ b/ortools/graph/perfect_matching.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/ortools/graph/python/max_flow.cc b/ortools/graph/python/max_flow.cc index 781ae9460c..f9ae45d190 100644 --- a/ortools/graph/python/max_flow.cc +++ b/ortools/graph/python/max_flow.cc @@ -13,6 +13,8 @@ #include "ortools/graph/max_flow.h" +#include + #include "pybind11/numpy.h" #include "pybind11/pybind11.h" #include "pybind11/stl.h" diff --git a/ortools/graph/samples/assignment_min_flow.cc b/ortools/graph/samples/assignment_min_flow.cc index 7f6e287fdd..7f13adb415 100644 --- a/ortools/graph/samples/assignment_min_flow.cc +++ b/ortools/graph/samples/assignment_min_flow.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include "ortools/graph/min_cost_flow.h" // [END import] diff --git a/ortools/graph/samples/balance_min_flow.cc b/ortools/graph/samples/balance_min_flow.cc index f0c2afa32e..680d0a1a72 100644 --- a/ortools/graph/samples/balance_min_flow.cc +++ b/ortools/graph/samples/balance_min_flow.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include "ortools/graph/min_cost_flow.h" // [END import] diff --git a/ortools/graph/samples/simple_max_flow_program.cc b/ortools/graph/samples/simple_max_flow_program.cc index 8b8312723f..83f8b57af2 100644 --- a/ortools/graph/samples/simple_max_flow_program.cc +++ b/ortools/graph/samples/simple_max_flow_program.cc @@ -15,6 +15,7 @@ // From Taha 'Introduction to Operations Research', example 6.4-2.""" // [START import] #include +#include #include "ortools/graph/max_flow.h" // [END import] diff --git a/ortools/graph/samples/simple_min_cost_flow_program.cc b/ortools/graph/samples/simple_min_cost_flow_program.cc index da3da85a81..b1e64d6ac0 100644 --- a/ortools/graph/samples/simple_min_cost_flow_program.cc +++ b/ortools/graph/samples/simple_min_cost_flow_program.cc @@ -15,6 +15,7 @@ // From Bradley, Hax and Maganti, 'Applied Mathematical Programming', figure 8.1 // [START import] #include +#include #include "ortools/graph/min_cost_flow.h" // [END import] diff --git a/ortools/graph/shortestpaths.cc b/ortools/graph/shortestpaths.cc index 4fcd3bdeb1..9a48408671 100644 --- a/ortools/graph/shortestpaths.cc +++ b/ortools/graph/shortestpaths.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include "ortools/base/commandlineflags.h" #include "ortools/base/integral_types.h" diff --git a/ortools/gscip/gscip_ext.cc b/ortools/gscip/gscip_ext.cc index 9bc66f9e6b..c22a74deb0 100644 --- a/ortools/gscip/gscip_ext.cc +++ b/ortools/gscip/gscip_ext.cc @@ -13,7 +13,10 @@ #include "ortools/gscip/gscip_ext.h" +#include +#include #include +#include #include "ortools/base/logging.h" #include "ortools/base/status_macros.h" diff --git a/ortools/gscip/gscip_ext.h b/ortools/gscip/gscip_ext.h index 35a9716fe0..ac9d1be142 100644 --- a/ortools/gscip/gscip_ext.h +++ b/ortools/gscip/gscip_ext.h @@ -27,6 +27,7 @@ #define OR_TOOLS_GSCIP_GSCIP_EXT_H_ #include +#include #include "absl/status/status.h" #include "ortools/gscip/gscip.h" diff --git a/ortools/gscip/legacy_scip_params.cc b/ortools/gscip/legacy_scip_params.cc index 9292fac083..8d811fcfa9 100644 --- a/ortools/gscip/legacy_scip_params.cc +++ b/ortools/gscip/legacy_scip_params.cc @@ -15,6 +15,7 @@ #include #include +#include #include "absl/status/status.h" #include "absl/strings/numbers.h" diff --git a/ortools/linear_solver/bop_interface.cc b/ortools/linear_solver/bop_interface.cc index 04730278d2..d5a19555bf 100644 --- a/ortools/linear_solver/bop_interface.cc +++ b/ortools/linear_solver/bop_interface.cc @@ -13,7 +13,9 @@ #include #include +#include #include +#include #include #include "absl/base/attributes.h" diff --git a/ortools/linear_solver/glop_interface.cc b/ortools/linear_solver/glop_interface.cc index 8639b6b348..41986f46bd 100644 --- a/ortools/linear_solver/glop_interface.cc +++ b/ortools/linear_solver/glop_interface.cc @@ -13,6 +13,7 @@ #include #include +#include #include #include diff --git a/ortools/linear_solver/gurobi_proto_solver.cc b/ortools/linear_solver/gurobi_proto_solver.cc index 4b00d3cf0e..0d87510d13 100644 --- a/ortools/linear_solver/gurobi_proto_solver.cc +++ b/ortools/linear_solver/gurobi_proto_solver.cc @@ -14,6 +14,7 @@ #include "ortools/linear_solver/gurobi_proto_solver.h" #include +#include #include #include #include diff --git a/ortools/linear_solver/linear_expr.cc b/ortools/linear_solver/linear_expr.cc index d8042c1ba2..86522f22be 100644 --- a/ortools/linear_solver/linear_expr.cc +++ b/ortools/linear_solver/linear_expr.cc @@ -15,7 +15,9 @@ #include #include +#include #include +#include #include "absl/strings/str_join.h" #include "ortools/base/logging.h" diff --git a/ortools/linear_solver/linear_solver.cc b/ortools/linear_solver/linear_solver.cc index 62b1ca0142..82076c22c5 100644 --- a/ortools/linear_solver/linear_solver.cc +++ b/ortools/linear_solver/linear_solver.cc @@ -27,6 +27,7 @@ #include #include #include +#include #include "absl/container/flat_hash_set.h" #include "absl/status/status.h" diff --git a/ortools/linear_solver/linear_solver.h b/ortools/linear_solver/linear_solver.h index 56aa7b31f2..854adaf92d 100644 --- a/ortools/linear_solver/linear_solver.h +++ b/ortools/linear_solver/linear_solver.h @@ -141,6 +141,7 @@ #include #include #include +#include #include #include #include diff --git a/ortools/linear_solver/linear_solver_callback.cc b/ortools/linear_solver/linear_solver_callback.cc index c12a090201..eaf3265bc5 100644 --- a/ortools/linear_solver/linear_solver_callback.cc +++ b/ortools/linear_solver/linear_solver_callback.cc @@ -14,6 +14,7 @@ #include "ortools/linear_solver/linear_solver_callback.h" #include +#include #include "ortools/base/logging.h" diff --git a/ortools/linear_solver/model_exporter.cc b/ortools/linear_solver/model_exporter.cc index c2e74a683b..09de29a3a4 100644 --- a/ortools/linear_solver/model_exporter.cc +++ b/ortools/linear_solver/model_exporter.cc @@ -16,8 +16,10 @@ #include #include #include +#include #include #include +#include #include "absl/container/flat_hash_set.h" #include "absl/status/status.h" diff --git a/ortools/linear_solver/model_validator.cc b/ortools/linear_solver/model_validator.cc index dbaf82a744..728ed6b06c 100644 --- a/ortools/linear_solver/model_validator.cc +++ b/ortools/linear_solver/model_validator.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" diff --git a/ortools/linear_solver/samples/assignment_groups_mip.cc b/ortools/linear_solver/samples/assignment_groups_mip.cc index 098cdc83b7..dc9291d7b0 100644 --- a/ortools/linear_solver/samples/assignment_groups_mip.cc +++ b/ortools/linear_solver/samples/assignment_groups_mip.cc @@ -15,6 +15,7 @@ // Solve a simple assignment problem. // [START import] #include +#include #include #include #include diff --git a/ortools/linear_solver/samples/assignment_mip.cc b/ortools/linear_solver/samples/assignment_mip.cc index 42b292c333..2b47220001 100644 --- a/ortools/linear_solver/samples/assignment_mip.cc +++ b/ortools/linear_solver/samples/assignment_mip.cc @@ -13,6 +13,7 @@ // [START program] // [START import] +#include #include #include "ortools/base/logging.h" diff --git a/ortools/linear_solver/samples/assignment_task_sizes_mip.cc b/ortools/linear_solver/samples/assignment_task_sizes_mip.cc index a3581c8254..762721d364 100644 --- a/ortools/linear_solver/samples/assignment_task_sizes_mip.cc +++ b/ortools/linear_solver/samples/assignment_task_sizes_mip.cc @@ -15,6 +15,7 @@ // Solve a simple assignment problem. // [START import] #include +#include #include #include diff --git a/ortools/linear_solver/samples/assignment_teams_mip.cc b/ortools/linear_solver/samples/assignment_teams_mip.cc index fde9238207..4de544609b 100644 --- a/ortools/linear_solver/samples/assignment_teams_mip.cc +++ b/ortools/linear_solver/samples/assignment_teams_mip.cc @@ -15,6 +15,7 @@ // Solve a simple assignment problem. // [START import] #include +#include #include #include diff --git a/ortools/linear_solver/samples/bin_packing_mip.cc b/ortools/linear_solver/samples/bin_packing_mip.cc index c3090e1e9f..6f704dabca 100644 --- a/ortools/linear_solver/samples/bin_packing_mip.cc +++ b/ortools/linear_solver/samples/bin_packing_mip.cc @@ -14,7 +14,9 @@ // [START program] // [START import] #include +#include #include +#include #include #include "ortools/linear_solver/linear_expr.h" diff --git a/ortools/linear_solver/samples/integer_programming_example.cc b/ortools/linear_solver/samples/integer_programming_example.cc index 4a70abdf81..6297121d8e 100644 --- a/ortools/linear_solver/samples/integer_programming_example.cc +++ b/ortools/linear_solver/samples/integer_programming_example.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include "ortools/linear_solver/linear_solver.h" // [END import] diff --git a/ortools/linear_solver/samples/linear_programming_example.cc b/ortools/linear_solver/samples/linear_programming_example.cc index 74ab9b5178..e959dfef3c 100644 --- a/ortools/linear_solver/samples/linear_programming_example.cc +++ b/ortools/linear_solver/samples/linear_programming_example.cc @@ -14,6 +14,7 @@ // [START program] // [START import] #include +#include #include "ortools/linear_solver/linear_solver.h" // [END import] diff --git a/ortools/linear_solver/samples/mip_var_array.cc b/ortools/linear_solver/samples/mip_var_array.cc index 57611609b1..2d9e255785 100644 --- a/ortools/linear_solver/samples/mip_var_array.cc +++ b/ortools/linear_solver/samples/mip_var_array.cc @@ -13,6 +13,9 @@ // [START program] // [START import] +#include +#include + #include "ortools/linear_solver/linear_solver.h" // [END import] diff --git a/ortools/linear_solver/samples/multiple_knapsack_mip.cc b/ortools/linear_solver/samples/multiple_knapsack_mip.cc index 709f77deef..e3dcb21154 100644 --- a/ortools/linear_solver/samples/multiple_knapsack_mip.cc +++ b/ortools/linear_solver/samples/multiple_knapsack_mip.cc @@ -15,6 +15,7 @@ // Solve a multiple knapsack problem using a MIP solver. // [START import] #include +#include #include #include diff --git a/ortools/linear_solver/samples/simple_lp_program.cc b/ortools/linear_solver/samples/simple_lp_program.cc index 804c4d4ca6..5465fda7b1 100644 --- a/ortools/linear_solver/samples/simple_lp_program.cc +++ b/ortools/linear_solver/samples/simple_lp_program.cc @@ -14,6 +14,9 @@ // Minimal example to call the GLOP solver. // [START program] // [START import] +#include +#include + #include "ortools/linear_solver/linear_solver.h" // [END import] diff --git a/ortools/linear_solver/samples/simple_mip_program.cc b/ortools/linear_solver/samples/simple_mip_program.cc index aee7c7ccb8..504818516b 100644 --- a/ortools/linear_solver/samples/simple_mip_program.cc +++ b/ortools/linear_solver/samples/simple_mip_program.cc @@ -14,6 +14,8 @@ // Mixed Integer programming example that shows how to use the API. // [START program] // [START import] +#include + #include "ortools/linear_solver/linear_solver.h" // [END import] diff --git a/ortools/linear_solver/samples/stigler_diet.cc b/ortools/linear_solver/samples/stigler_diet.cc index 38e59f929e..c647441645 100644 --- a/ortools/linear_solver/samples/stigler_diet.cc +++ b/ortools/linear_solver/samples/stigler_diet.cc @@ -15,6 +15,7 @@ // The Stigler diet problem. // [START import] #include +#include #include #include // std::pair #include diff --git a/ortools/linear_solver/sat_proto_solver.cc b/ortools/linear_solver/sat_proto_solver.cc index 08d0db26a9..2a2cce5930 100644 --- a/ortools/linear_solver/sat_proto_solver.cc +++ b/ortools/linear_solver/sat_proto_solver.cc @@ -13,9 +13,12 @@ #include "ortools/linear_solver/sat_proto_solver.h" +#include #include #include +#include #include +#include #include #include diff --git a/ortools/linear_solver/sat_solver_utils.cc b/ortools/linear_solver/sat_solver_utils.cc index 25feb0fad3..b2178ff049 100644 --- a/ortools/linear_solver/sat_solver_utils.cc +++ b/ortools/linear_solver/sat_solver_utils.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include "absl/memory/memory.h" #include "ortools/glop/parameters.pb.h" diff --git a/ortools/linear_solver/sat_solver_utils.h b/ortools/linear_solver/sat_solver_utils.h index b2eb116561..2034e9f8f6 100644 --- a/ortools/linear_solver/sat_solver_utils.h +++ b/ortools/linear_solver/sat_solver_utils.h @@ -15,6 +15,7 @@ #define OR_TOOLS_LINEAR_SOLVER_SAT_SOLVER_UTILS_H_ #include +#include #include "ortools/glop/preprocessor.h" #include "ortools/linear_solver/linear_solver.pb.h" diff --git a/ortools/linear_solver/scip_callback.cc b/ortools/linear_solver/scip_callback.cc index fd712d8276..9e0c619298 100644 --- a/ortools/linear_solver/scip_callback.cc +++ b/ortools/linear_solver/scip_callback.cc @@ -17,8 +17,10 @@ #include #include +#include #include #include +#include #include "absl/strings/str_cat.h" #include "absl/types/span.h" diff --git a/ortools/lp_data/lp_data.cc b/ortools/lp_data/lp_data.cc index 4dcd6756f5..fd392a046b 100644 --- a/ortools/lp_data/lp_data.cc +++ b/ortools/lp_data/lp_data.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/strings/str_cat.h" diff --git a/ortools/lp_data/lp_data.h b/ortools/lp_data/lp_data.h index d30a21763a..b76cd03e05 100644 --- a/ortools/lp_data/lp_data.h +++ b/ortools/lp_data/lp_data.h @@ -25,6 +25,7 @@ #define OR_TOOLS_LP_DATA_LP_DATA_H_ #include // for max +#include #include #include #include // for string diff --git a/ortools/lp_data/lp_types.h b/ortools/lp_data/lp_types.h index 99b2b3b9fc..0af2143fba 100644 --- a/ortools/lp_data/lp_types.h +++ b/ortools/lp_data/lp_types.h @@ -19,7 +19,9 @@ #include #include #include +#include #include +#include #include "ortools/base/basictypes.h" #include "ortools/base/logging.h" @@ -79,13 +81,13 @@ static inline double ToDouble(long double f) { return static_cast(f); } typedef double Fractional; // Range max for type Fractional. DBL_MAX for double for example. -const double kRangeMax = std::numeric_limits::max(); +constexpr double kRangeMax = std::numeric_limits::max(); // Infinity for type Fractional. -const double kInfinity = std::numeric_limits::infinity(); +constexpr double kInfinity = std::numeric_limits::infinity(); // Epsilon for type Fractional, i.e. the smallest e such that 1.0 + e != 1.0 . -const double kEpsilon = std::numeric_limits::epsilon(); +constexpr double kEpsilon = std::numeric_limits::epsilon(); // Returns true if the given value is finite, that means for a double: // not a NaN and not +/- infinity. @@ -96,8 +98,8 @@ inline bool IsFinite(Fractional value) { // Constants to represent invalid row or column index. // It is important that their values be the same because during transposition, // one needs to be converted into the other. -const RowIndex kInvalidRow(-1); -const ColIndex kInvalidCol(-1); +constexpr RowIndex kInvalidRow(-1); +constexpr ColIndex kInvalidCol(-1); // Different statuses for a given problem. enum class ProblemStatus : int8_t { diff --git a/ortools/lp_data/lp_utils.h b/ortools/lp_data/lp_utils.h index 1db7b67776..6ec9bd99e6 100644 --- a/ortools/lp_data/lp_utils.h +++ b/ortools/lp_data/lp_utils.h @@ -16,6 +16,8 @@ #ifndef OR_TOOLS_LP_DATA_LP_UTILS_H_ #define OR_TOOLS_LP_DATA_LP_UTILS_H_ +#include + #include "ortools/base/accurate_sum.h" #include "ortools/lp_data/lp_types.h" #include "ortools/lp_data/scattered_vector.h" diff --git a/ortools/lp_data/matrix_utils.cc b/ortools/lp_data/matrix_utils.cc index d2b2782e6d..101d1d1286 100644 --- a/ortools/lp_data/matrix_utils.cc +++ b/ortools/lp_data/matrix_utils.cc @@ -15,6 +15,8 @@ #include #include +#include +#include #include "ortools/base/hash.h" diff --git a/ortools/lp_data/mps_reader.cc b/ortools/lp_data/mps_reader.cc index e09215115a..9ee8758fa4 100644 --- a/ortools/lp_data/mps_reader.cc +++ b/ortools/lp_data/mps_reader.cc @@ -13,8 +13,11 @@ #include "ortools/lp_data/mps_reader.h" +#include #include +#include #include +#include #include "absl/container/btree_set.h" #include "absl/status/status.h" diff --git a/ortools/lp_data/sparse.cc b/ortools/lp_data/sparse.cc index ccd20d9420..238345b3d1 100644 --- a/ortools/lp_data/sparse.cc +++ b/ortools/lp_data/sparse.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" diff --git a/ortools/lp_data/sparse.h b/ortools/lp_data/sparse.h index cbd2b7cb34..a8935892bf 100644 --- a/ortools/lp_data/sparse.h +++ b/ortools/lp_data/sparse.h @@ -32,6 +32,7 @@ #include #include #include +#include #include "ortools/base/integral_types.h" #include "ortools/lp_data/lp_types.h" diff --git a/ortools/lp_data/sparse_column.h b/ortools/lp_data/sparse_column.h index b9ae33701b..33cdcc0bda 100644 --- a/ortools/lp_data/sparse_column.h +++ b/ortools/lp_data/sparse_column.h @@ -14,6 +14,8 @@ #ifndef OR_TOOLS_LP_DATA_SPARSE_COLUMN_H_ #define OR_TOOLS_LP_DATA_SPARSE_COLUMN_H_ +#include + #include "ortools/lp_data/sparse_vector.h" namespace operations_research { diff --git a/ortools/math_opt/core/BUILD.bazel b/ortools/math_opt/core/BUILD.bazel index 27f8764a56..e9a36cda9e 100644 --- a/ortools/math_opt/core/BUILD.bazel +++ b/ortools/math_opt/core/BUILD.bazel @@ -20,12 +20,14 @@ cc_library( deps = [ ":sparse_vector_view", "//ortools/base", + "//ortools/base:status_builder", "//ortools/math_opt:callback_cc_proto", "//ortools/math_opt:model_cc_proto", "//ortools/math_opt:model_update_cc_proto", "//ortools/math_opt:result_cc_proto", "//ortools/math_opt:sparse_containers_cc_proto", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/status", ], ) diff --git a/ortools/math_opt/core/math_opt_proto_utils.cc b/ortools/math_opt/core/math_opt_proto_utils.cc index 207daadc0e..39a7c7cea3 100644 --- a/ortools/math_opt/core/math_opt_proto_utils.cc +++ b/ortools/math_opt/core/math_opt_proto_utils.cc @@ -22,6 +22,7 @@ #include "absl/container/flat_hash_set.h" #include "ortools/base/integral_types.h" #include "ortools/base/logging.h" +#include "ortools/base/status_builder.h" #include "ortools/math_opt/callback.pb.h" #include "ortools/math_opt/core/sparse_vector_view.h" #include "ortools/math_opt/result.pb.h" diff --git a/ortools/math_opt/core/math_opt_proto_utils.h b/ortools/math_opt/core/math_opt_proto_utils.h index 5107156aa7..b392bff7cc 100644 --- a/ortools/math_opt/core/math_opt_proto_utils.h +++ b/ortools/math_opt/core/math_opt_proto_utils.h @@ -14,11 +14,13 @@ #ifndef OR_TOOLS_MATH_OPT_CORE_MATH_OPT_PROTO_UTILS_H_ #define OR_TOOLS_MATH_OPT_CORE_MATH_OPT_PROTO_UTILS_H_ -#include #include +#include +#include #include "absl/container/flat_hash_set.h" -#include "ortools/base/integral_types.h" +#include "absl/status/status.h" +#include "absl/strings/string_view.h" #include "ortools/base/logging.h" #include "ortools/math_opt/callback.pb.h" #include "ortools/math_opt/model.pb.h" @@ -121,6 +123,33 @@ TerminationProto NoSolutionFoundTermination(const LimitProto limit, TerminationProto TerminateForReason(TerminationReasonProto reason, absl::string_view detail = {}); +enum class SupportType { + kNotSupported = 1, + kSupported = 2, + kNotImplemented = 3, +}; + +struct SupportedProblemStructures { + SupportType integer_variables = SupportType::kNotSupported; + SupportType quadratic_objectives = SupportType::kNotSupported; + SupportType quadratic_constraints = SupportType::kNotSupported; + SupportType sos1_constraints = SupportType::kNotSupported; + SupportType sos2_constraints = SupportType::kNotSupported; + SupportType indicator_constraints = SupportType::kNotSupported; +}; + +// Returns an InvalidArgumentError (respectively, UnimplementedError) if a +// problem structure is present in `model` and not supported (resp., not yet +// implemented) according to `support_menu`. +absl::Status ModelIsSupported(const ModelProto& model, + const SupportedProblemStructures& support_menu, + absl::string_view solver_name); + +// Returns false if a problem structure is present in `update` and not +// not implemented or supported according to `support_menu`. +bool UpdateIsSupported(const ModelUpdateProto& update, + const SupportedProblemStructures& support_menu); + //////////////////////////////////////////////////////////////////////////////// // Inline functions implementations. //////////////////////////////////////////////////////////////////////////////// diff --git a/ortools/math_opt/core/sparse_submatrix.cc b/ortools/math_opt/core/sparse_submatrix.cc index 7a5f71cb21..a296ae67ca 100644 --- a/ortools/math_opt/core/sparse_submatrix.cc +++ b/ortools/math_opt/core/sparse_submatrix.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include #include diff --git a/ortools/math_opt/cpp/enums.h b/ortools/math_opt/cpp/enums.h index 230f436ca0..fd2af4466a 100644 --- a/ortools/math_opt/cpp/enums.h +++ b/ortools/math_opt/cpp/enums.h @@ -77,6 +77,7 @@ #define OR_TOOLS_MATH_OPT_CPP_ENUMS_H_ #include +#include #include #include "absl/strings/string_view.h" diff --git a/ortools/math_opt/cpp/formatters.h b/ortools/math_opt/cpp/formatters.h index 7d3a3a5747..6a66b50767 100644 --- a/ortools/math_opt/cpp/formatters.h +++ b/ortools/math_opt/cpp/formatters.h @@ -16,6 +16,7 @@ #include #include +#include namespace operations_research::math_opt { diff --git a/ortools/math_opt/cpp/id_map.h b/ortools/math_opt/cpp/id_map.h index 3439fbe7f6..d6ba998766 100644 --- a/ortools/math_opt/cpp/id_map.h +++ b/ortools/math_opt/cpp/id_map.h @@ -17,6 +17,7 @@ #include #include +#include #include #include diff --git a/ortools/math_opt/cpp/linear_constraint.h b/ortools/math_opt/cpp/linear_constraint.h index 5d9a0976a2..d531b88527 100644 --- a/ortools/math_opt/cpp/linear_constraint.h +++ b/ortools/math_opt/cpp/linear_constraint.h @@ -17,6 +17,7 @@ #include +#include #include #include "ortools/base/logging.h" diff --git a/ortools/math_opt/cpp/matchers.cc b/ortools/math_opt/cpp/matchers.cc index d7402ab76f..54546a030c 100644 --- a/ortools/math_opt/cpp/matchers.cc +++ b/ortools/math_opt/cpp/matchers.cc @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/ortools/math_opt/cpp/matchers.h b/ortools/math_opt/cpp/matchers.h index c6b61fccb9..1122b1d490 100644 --- a/ortools/math_opt/cpp/matchers.h +++ b/ortools/math_opt/cpp/matchers.h @@ -92,6 +92,7 @@ #define OR_TOOLS_MATH_OPT_CPP_MATCHERS_H_ #include +#include #include #include diff --git a/ortools/math_opt/cpp/message_callback.h b/ortools/math_opt/cpp/message_callback.h index 5307f85300..2be118a61d 100644 --- a/ortools/math_opt/cpp/message_callback.h +++ b/ortools/math_opt/cpp/message_callback.h @@ -16,7 +16,9 @@ #include #include +#include #include +#include #include "absl/strings/string_view.h" #include "ortools/base/source_location.h" diff --git a/ortools/math_opt/cpp/model.cc b/ortools/math_opt/cpp/model.cc index 77bf94053d..38bf38e6c3 100644 --- a/ortools/math_opt/cpp/model.cc +++ b/ortools/math_opt/cpp/model.cc @@ -16,7 +16,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -30,6 +31,7 @@ #include "ortools/base/strong_int.h" #include "ortools/math_opt/cpp/linear_constraint.h" #include "ortools/math_opt/storage/model_storage.h" +#include "ortools/math_opt/storage/model_storage_types.h" namespace operations_research { namespace math_opt { diff --git a/ortools/math_opt/cpp/model.h b/ortools/math_opt/cpp/model.h index 943509090d..5a837f09a8 100644 --- a/ortools/math_opt/cpp/model.h +++ b/ortools/math_opt/cpp/model.h @@ -14,7 +14,10 @@ #ifndef OR_TOOLS_MATH_OPT_CPP_MODEL_H_ #define OR_TOOLS_MATH_OPT_CPP_MODEL_H_ +#include #include +#include +#include #include #include @@ -22,6 +25,7 @@ #include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "ortools/base/logging.h" +#include "ortools/base/status_builder.h" #include "ortools/math_opt/cpp/key_types.h" #include "ortools/math_opt/cpp/linear_constraint.h" // IWYU pragma: export #include "ortools/math_opt/cpp/update_tracker.h" // IWYU pragma: export @@ -29,6 +33,7 @@ #include "ortools/math_opt/model.pb.h" // IWYU pragma: export #include "ortools/math_opt/model_update.pb.h" // IWYU pragma: export #include "ortools/math_opt/storage/model_storage.h" +#include "ortools/math_opt/storage/model_storage_types.h" namespace operations_research { namespace math_opt { diff --git a/ortools/math_opt/cpp/parameters.cc b/ortools/math_opt/cpp/parameters.cc index 5214906dda..05911c2ed3 100644 --- a/ortools/math_opt/cpp/parameters.cc +++ b/ortools/math_opt/cpp/parameters.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include diff --git a/ortools/math_opt/cpp/solve_result.cc b/ortools/math_opt/cpp/solve_result.cc index 4922c4c0bf..e5d54e348b 100644 --- a/ortools/math_opt/cpp/solve_result.cc +++ b/ortools/math_opt/cpp/solve_result.cc @@ -14,6 +14,8 @@ #include "ortools/math_opt/cpp/solve_result.h" #include +#include +#include #include #include #include diff --git a/ortools/math_opt/cpp/solve_result.h b/ortools/math_opt/cpp/solve_result.h index e7063693a6..48423d3cd6 100644 --- a/ortools/math_opt/cpp/solve_result.h +++ b/ortools/math_opt/cpp/solve_result.h @@ -15,6 +15,7 @@ #define OR_TOOLS_MATH_OPT_CPP_SOLVE_RESULT_H_ #include +#include #include #include #include diff --git a/ortools/math_opt/cpp/sparse_containers.cc b/ortools/math_opt/cpp/sparse_containers.cc index d8d730daea..dbd92369d2 100644 --- a/ortools/math_opt/cpp/sparse_containers.cc +++ b/ortools/math_opt/cpp/sparse_containers.cc @@ -13,6 +13,8 @@ #include "ortools/math_opt/cpp/sparse_containers.h" +#include + namespace operations_research::math_opt { namespace { diff --git a/ortools/math_opt/cpp/statistics.cc b/ortools/math_opt/cpp/statistics.cc index 550d2c587d..c9a2327e25 100644 --- a/ortools/math_opt/cpp/statistics.cc +++ b/ortools/math_opt/cpp/statistics.cc @@ -16,9 +16,11 @@ #include #include #include +#include #include #include #include +#include #include "ortools/math_opt/cpp/model.h" #include "ortools/math_opt/storage/model_storage.h" diff --git a/ortools/math_opt/cpp/statistics.h b/ortools/math_opt/cpp/statistics.h index 12c9967f00..9c5517bbf4 100644 --- a/ortools/math_opt/cpp/statistics.h +++ b/ortools/math_opt/cpp/statistics.h @@ -16,6 +16,7 @@ #include #include +#include #include #include "ortools/math_opt/cpp/model.h" diff --git a/ortools/math_opt/cpp/streamable_solver_init_arguments.cc b/ortools/math_opt/cpp/streamable_solver_init_arguments.cc index 116b58c2ee..a146805c09 100644 --- a/ortools/math_opt/cpp/streamable_solver_init_arguments.cc +++ b/ortools/math_opt/cpp/streamable_solver_init_arguments.cc @@ -14,6 +14,7 @@ #include "ortools/math_opt/cpp/streamable_solver_init_arguments.h" #include +#include #include #include "absl/status/statusor.h" diff --git a/ortools/math_opt/cpp/variable_and_expressions.cc b/ortools/math_opt/cpp/variable_and_expressions.cc index 212c9e47fb..0bdc28d98a 100644 --- a/ortools/math_opt/cpp/variable_and_expressions.cc +++ b/ortools/math_opt/cpp/variable_and_expressions.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include diff --git a/ortools/math_opt/cpp/variable_and_expressions.h b/ortools/math_opt/cpp/variable_and_expressions.h index 0885c68fa0..aafcf99ad7 100644 --- a/ortools/math_opt/cpp/variable_and_expressions.h +++ b/ortools/math_opt/cpp/variable_and_expressions.h @@ -94,6 +94,7 @@ #include #include #include +#include #include #include #include diff --git a/ortools/math_opt/model.proto b/ortools/math_opt/model.proto index e9481b22fd..00361cf789 100644 --- a/ortools/math_opt/model.proto +++ b/ortools/math_opt/model.proto @@ -90,6 +90,9 @@ message LinearConstraintsProto { // A single quadratic constraint of the form: // lb <= sum{linear_terms} + sum{quadratic_terms} <= ub. +// +// If a variable involved in this constraint is deleted, it is treated as if it +// were set to zero. message QuadraticConstraintProto { // Terms that are linear in the decision variables. // @@ -131,6 +134,9 @@ message QuadraticConstraintProto { } // Data for representing a single SOS1 or SOS2 constraint. +// +// If a variable involved in this constraint is deleted, it is treated as if it +// were set to zero. message SosConstraintProto { // The expressions over which to apply the SOS constraint: // * SOS1: At most one element takes a nonzero value. @@ -147,6 +153,50 @@ message SosConstraintProto { string name = 3; } +// Specifies if a constraint is of the form... +enum ConstraintSense { + CONSTRAINT_SENSE_UNSPECIFIED = 0; + // ... lhs <= rhs + CONSTRAINT_SENSE_LESS_THAN = 1; + // ... lhs >= rhs + CONSTRAINT_SENSE_GREATER_THAN = 2; + // ... lhs == rhs + CONSTRAINT_SENSE_EQUAL_TO = 3; +} + +// Data for representing a single indicator constraint of the form: +// Variable(indicator_id) = 1 --> expression sense rhs. +// +// If a variable involved in this constraint is deleted, it is treated as if it +// were set to zero. In particular, deleting the indicator variable means that +// the indicator constraint is vacuous. +message IndicatorConstraintProto { + // An ID corresponding to a binary variable, or unset. If unset, the indicator + // constraint is ignored. If set, we require that: + // * VariablesProto.integers[indicator_id] = true, + // * VariablesProto.lower_bounds[indicator_id] >= 0, + // * VariablesProto.upper_bounds[indicator_id] <= 1. + // These conditions are not validated by MathOpt. If not satisfied, the solver + // may elect to implicitly add them, or to reject the model. + optional int64 indicator_id = 1; + + // Must be a valid linear expression with respect to the containing model: + // * All stated conditions on `SparseDoubleVectorProto`, + // * All elements of `expression.values` must be finite, + // * `expression.ids` are a subset of `VariablesProto.ids`. + SparseDoubleVectorProto expression = 2; + + ConstraintSense sense = 3; + + // Cannot be NaN or infinite. + double rhs = 4; + + // Parent messages may have uniqueness requirements on this field; e.g., see + // `ModelProto.indicator_constraints` and + // `IndicatorConstraintUpdatesProto.new_constraints`. + string name = 5; +} + // An optimization problem. For full details, see go/mathopt-model. // // MathOpt supports: @@ -157,6 +207,7 @@ message SosConstraintProto { // * Quadratic constraints // * Logical constraints // > SOS1 and SOS2 constraints +// > Indicator constraints // // By default, constraints are represented in "id-to-data" maps. However, we // represent linear constraints in a more efficient "struct-of-arrays" format. @@ -168,6 +219,9 @@ message ModelProto { // The variable coefficients for the linear constraints. // + // If a variable involved in this constraint is deleted, it is treated as if + // it were set to zero. + // // Requirements: // * linear_constraint_matrix.row_ids are elements of linear_constraints.ids. // * linear_constraint_matrix.column_ids are elements of variables.ids. @@ -200,4 +254,9 @@ message ModelProto { // `expressions` list; if `weights` are presented, the ordering is taken with // respect to these values in increasing order. map sos2_constraints = 8; + + // Indicator constraints in the model, which enforce that, if a binary + // "indicator variable" is set to one, then an "implicated constraint" must + // hold. + map indicator_constraints = 9; } diff --git a/ortools/math_opt/model_update.proto b/ortools/math_opt/model_update.proto index 7570365722..6bd9c22acf 100644 --- a/ortools/math_opt/model_update.proto +++ b/ortools/math_opt/model_update.proto @@ -141,6 +141,23 @@ message SosConstraintUpdatesProto { map new_constraints = 2; } +// Data for updates to indicator constraints; only addition and deletion, no +// support for in-place constraint updates. +message IndicatorConstraintUpdatesProto { + // Removes indicator constraints from the model. + // + // Each value must be in [0, max(int64)). Values must be in strictly + // increasing order. Applies only to existing indicator constraint ids that + // have not yet been deleted. + repeated int64 deleted_constraint_ids = 1; + + // Add new indicator constraints to the model. All keys must be in + // [0, max(int64)), and must be greater than any ids used in the initial model + // and previous updates. All nonempty names should be distinct from existing + // names and each other. + map new_constraints = 2; +} + // Updates to a ModelProto. message ModelUpdateProto { // Removes variables from the model. @@ -202,4 +219,5 @@ message ModelUpdateProto { // Updates the general constraints (addition and deletion only). SosConstraintUpdatesProto sos1_constraint_updates = 10; SosConstraintUpdatesProto sos2_constraint_updates = 11; + IndicatorConstraintUpdatesProto indicator_constraint_updates = 12; } diff --git a/ortools/math_opt/solvers/cp_sat_solver.h b/ortools/math_opt/solvers/cp_sat_solver.h index f5e814fb25..20ae2b4cd0 100644 --- a/ortools/math_opt/solvers/cp_sat_solver.h +++ b/ortools/math_opt/solvers/cp_sat_solver.h @@ -14,8 +14,6 @@ #ifndef OR_TOOLS_MATH_OPT_SOLVERS_CP_SAT_SOLVER_H_ #define OR_TOOLS_MATH_OPT_SOLVERS_CP_SAT_SOLVER_H_ -#include - #include #include #include diff --git a/ortools/math_opt/solvers/glpk_solver.cc b/ortools/math_opt/solvers/glpk_solver.cc index 28a43fe24c..b47cfa4f87 100644 --- a/ortools/math_opt/solvers/glpk_solver.cc +++ b/ortools/math_opt/solvers/glpk_solver.cc @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/ortools/math_opt/solvers/glpk_solver.h b/ortools/math_opt/solvers/glpk_solver.h index eef80b5d27..f8d5e6844b 100644 --- a/ortools/math_opt/solvers/glpk_solver.h +++ b/ortools/math_opt/solvers/glpk_solver.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "absl/container/flat_hash_map.h" diff --git a/ortools/math_opt/solvers/gscip_solver.cc b/ortools/math_opt/solvers/gscip_solver.cc index c461192820..8e982c6a12 100644 --- a/ortools/math_opt/solvers/gscip_solver.cc +++ b/ortools/math_opt/solvers/gscip_solver.cc @@ -14,6 +14,7 @@ #include "ortools/math_opt/solvers/gscip_solver.h" #include +#include #include #include #include diff --git a/ortools/math_opt/solvers/gscip_solver.h b/ortools/math_opt/solvers/gscip_solver.h index fcec9a4228..6dcec9349a 100644 --- a/ortools/math_opt/solvers/gscip_solver.h +++ b/ortools/math_opt/solvers/gscip_solver.h @@ -16,7 +16,7 @@ #include #include -#include +#include #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" diff --git a/ortools/math_opt/solvers/gurobi/g_gurobi.cc b/ortools/math_opt/solvers/gurobi/g_gurobi.cc index 4390baef8b..de39291d93 100644 --- a/ortools/math_opt/solvers/gurobi/g_gurobi.cc +++ b/ortools/math_opt/solvers/gurobi/g_gurobi.cc @@ -13,9 +13,12 @@ #include "ortools/math_opt/solvers/gurobi/g_gurobi.h" +#include +#include #include #include #include +#include #include "absl/status/status.h" #include "absl/status/statusor.h" diff --git a/ortools/math_opt/solvers/gurobi/g_gurobi.h b/ortools/math_opt/solvers/gurobi/g_gurobi.h index 733848c778..488387a577 100644 --- a/ortools/math_opt/solvers/gurobi/g_gurobi.h +++ b/ortools/math_opt/solvers/gurobi/g_gurobi.h @@ -36,7 +36,9 @@ #include #include #include +#include #include +#include #include "absl/status/status.h" #include "absl/status/statusor.h" diff --git a/ortools/math_opt/solvers/gurobi_solver.cc b/ortools/math_opt/solvers/gurobi_solver.cc index 87b2bdaa4b..b05a1540ec 100644 --- a/ortools/math_opt/solvers/gurobi_solver.cc +++ b/ortools/math_opt/solvers/gurobi_solver.cc @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/ortools/math_opt/solvers/gurobi_solver.h b/ortools/math_opt/solvers/gurobi_solver.h index ffafcdf750..735e7fb7d6 100644 --- a/ortools/math_opt/solvers/gurobi_solver.h +++ b/ortools/math_opt/solvers/gurobi_solver.h @@ -22,6 +22,7 @@ #include #include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/time/time.h" diff --git a/ortools/math_opt/solvers/pdlp_bridge.cc b/ortools/math_opt/solvers/pdlp_bridge.cc index 87b818319a..e2202c0eb7 100644 --- a/ortools/math_opt/solvers/pdlp_bridge.cc +++ b/ortools/math_opt/solvers/pdlp_bridge.cc @@ -24,6 +24,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" +#include "ortools/base/status_macros.h" #include "ortools/math_opt/core/inverted_bounds.h" #include "ortools/math_opt/core/math_opt_proto_utils.h" #include "ortools/math_opt/core/sparse_vector_view.h" diff --git a/ortools/math_opt/storage/model_storage.cc b/ortools/math_opt/storage/model_storage.cc index f148eb2969..bcd8c4f6d9 100644 --- a/ortools/math_opt/storage/model_storage.cc +++ b/ortools/math_opt/storage/model_storage.cc @@ -13,7 +13,6 @@ #include "ortools/math_opt/storage/model_storage.h" -#include #include #include #include diff --git a/ortools/math_opt/storage/model_storage.h b/ortools/math_opt/storage/model_storage.h index b4b8e26d7c..62136c18ad 100644 --- a/ortools/math_opt/storage/model_storage.h +++ b/ortools/math_opt/storage/model_storage.h @@ -29,6 +29,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" +#include "ortools/base/logging.h" #include "ortools/base/map_util.h" #include "ortools/base/strong_int.h" #include "ortools/math_opt/model.pb.h" diff --git a/ortools/math_opt/storage/model_storage_types.h b/ortools/math_opt/storage/model_storage_types.h index def47546af..a997cd9f3e 100644 --- a/ortools/math_opt/storage/model_storage_types.h +++ b/ortools/math_opt/storage/model_storage_types.h @@ -16,6 +16,7 @@ #include +#include "absl/strings/string_view.h" #include "ortools/base/strong_int.h" namespace operations_research::math_opt { diff --git a/ortools/math_opt/storage/sparse_matrix.cc b/ortools/math_opt/storage/sparse_matrix.cc index e130dd73a9..1ca17ae436 100644 --- a/ortools/math_opt/storage/sparse_matrix.cc +++ b/ortools/math_opt/storage/sparse_matrix.cc @@ -13,7 +13,19 @@ #include "ortools/math_opt/storage/sparse_matrix.h" -#include "ortools/base/map_util.h" +#include +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "absl/meta/type_traits.h" +#include "absl/types/span.h" +#include "ortools/base/strong_int.h" +#include "ortools/math_opt/sparse_containers.pb.h" +#include "ortools/math_opt/storage/model_storage_types.h" namespace operations_research::math_opt { namespace { diff --git a/ortools/math_opt/storage/sparse_matrix.h b/ortools/math_opt/storage/sparse_matrix.h index 6ed64c7096..4917dcbe16 100644 --- a/ortools/math_opt/storage/sparse_matrix.h +++ b/ortools/math_opt/storage/sparse_matrix.h @@ -16,11 +16,16 @@ #define OR_TOOLS_MATH_OPT_STORAGE_SPARSE_MATRIX_H_ #include +#include +#include #include #include +#include "absl/algorithm/container.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "absl/meta/type_traits.h" +#include "absl/types/span.h" #include "ortools/base/map_util.h" #include "ortools/base/strong_int.h" #include "ortools/base/strong_vector.h" diff --git a/ortools/math_opt/tools/mathopt_solve_main.cc b/ortools/math_opt/tools/mathopt_solve_main.cc index 5b8d06e627..827a92e1e0 100644 --- a/ortools/math_opt/tools/mathopt_solve_main.cc +++ b/ortools/math_opt/tools/mathopt_solve_main.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/ortools/math_opt/validators/enum_sets.cc b/ortools/math_opt/validators/enum_sets.cc index dda3d79805..5e24916997 100644 --- a/ortools/math_opt/validators/enum_sets.cc +++ b/ortools/math_opt/validators/enum_sets.cc @@ -13,6 +13,7 @@ #include "ortools/math_opt/validators/enum_sets.h" +#include #include #include #include diff --git a/ortools/math_opt/validators/enum_sets.h b/ortools/math_opt/validators/enum_sets.h index 7efb695160..3459de2e0e 100644 --- a/ortools/math_opt/validators/enum_sets.h +++ b/ortools/math_opt/validators/enum_sets.h @@ -16,6 +16,7 @@ #ifndef OR_TOOLS_MATH_OPT_VALIDATORS_ENUM_SETS_H_ #define OR_TOOLS_MATH_OPT_VALIDATORS_ENUM_SETS_H_ +#include #include #include #include diff --git a/ortools/math_opt/validators/ids_validator.cc b/ortools/math_opt/validators/ids_validator.cc index 0b832f1827..2f5e16826c 100644 --- a/ortools/math_opt/validators/ids_validator.cc +++ b/ortools/math_opt/validators/ids_validator.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "absl/container/flat_hash_set.h" diff --git a/ortools/math_opt/validators/ids_validator.h b/ortools/math_opt/validators/ids_validator.h index a273ec8417..46ef48c090 100644 --- a/ortools/math_opt/validators/ids_validator.h +++ b/ortools/math_opt/validators/ids_validator.h @@ -16,6 +16,8 @@ #include +#include + #include "absl/status/status.h" #include "absl/strings/string_view.h" #include "absl/types/span.h" diff --git a/ortools/model_builder/python/pywrap_model_builder_helper.cc b/ortools/model_builder/python/pywrap_model_builder_helper.cc index eb28e7df2f..937ea93a2e 100644 --- a/ortools/model_builder/python/pywrap_model_builder_helper.cc +++ b/ortools/model_builder/python/pywrap_model_builder_helper.cc @@ -13,6 +13,7 @@ // A pybind11 wrapper for model_builder_helper. +#include #include #include diff --git a/ortools/model_builder/wrappers/model_builder_helper.cc b/ortools/model_builder/wrappers/model_builder_helper.cc index 3cb1531d72..72015903e6 100644 --- a/ortools/model_builder/wrappers/model_builder_helper.cc +++ b/ortools/model_builder/wrappers/model_builder_helper.cc @@ -14,8 +14,10 @@ #include "ortools/model_builder/wrappers/model_builder_helper.h" #include +#include #include #include +#include #include "ortools/linear_solver/linear_solver.h" #include "ortools/linear_solver/linear_solver.pb.h" diff --git a/ortools/model_builder/wrappers/model_builder_helper.h b/ortools/model_builder/wrappers/model_builder_helper.h index 40f8b5f7fe..2ffd6d23fe 100644 --- a/ortools/model_builder/wrappers/model_builder_helper.h +++ b/ortools/model_builder/wrappers/model_builder_helper.h @@ -19,6 +19,7 @@ #include #include #include +#include #include "ortools/linear_solver/linear_solver.pb.h" #include "ortools/linear_solver/model_exporter.h" diff --git a/ortools/packing/arc_flow_builder.cc b/ortools/packing/arc_flow_builder.cc index 561816388d..df3788d951 100644 --- a/ortools/packing/arc_flow_builder.cc +++ b/ortools/packing/arc_flow_builder.cc @@ -15,6 +15,9 @@ #include #include +#include +#include +#include #include "absl/container/flat_hash_map.h" #include "absl/strings/str_cat.h" diff --git a/ortools/packing/arc_flow_solver.cc b/ortools/packing/arc_flow_solver.cc index 370536e95e..ec08f9a3f0 100644 --- a/ortools/packing/arc_flow_solver.cc +++ b/ortools/packing/arc_flow_solver.cc @@ -13,7 +13,9 @@ #include "ortools/packing/arc_flow_solver.h" +#include #include +#include #include "absl/container/btree_map.h" #include "absl/flags/flag.h" diff --git a/ortools/packing/binpacking_2d_parser.cc b/ortools/packing/binpacking_2d_parser.cc index dba589d30a..68f7eaa888 100644 --- a/ortools/packing/binpacking_2d_parser.cc +++ b/ortools/packing/binpacking_2d_parser.cc @@ -14,6 +14,7 @@ #include "ortools/packing/binpacking_2d_parser.h" #include +#include #include "absl/strings/numbers.h" #include "absl/strings/str_split.h" diff --git a/ortools/packing/vector_bin_packing_parser.cc b/ortools/packing/vector_bin_packing_parser.cc index 7d848752a1..14bbc222b1 100644 --- a/ortools/packing/vector_bin_packing_parser.cc +++ b/ortools/packing/vector_bin_packing_parser.cc @@ -15,6 +15,7 @@ #include #include +#include #include "absl/strings/numbers.h" #include "absl/strings/str_split.h" diff --git a/ortools/pdlp/sharder.cc b/ortools/pdlp/sharder.cc index df4b98f5ae..4212b0759e 100644 --- a/ortools/pdlp/sharder.cc +++ b/ortools/pdlp/sharder.cc @@ -160,6 +160,10 @@ VectorXd TransposedMatrixVectorProduct( CHECK_EQ(vector.size(), matrix.rows()); VectorXd answer(matrix.cols()); sharder.ParallelForEachShard([&](const Sharder::Shard& shard) { + // NOTE: For very sparse columns, assignment to shard(answer) incurs a + // measurable overhead compared to using a constructor + // (i.e. VectorXd temp = ...). It is not clear why this is the case, nor + // how to avoid it. shard(answer) = shard(matrix).transpose() * vector; }); return answer; diff --git a/ortools/sat/cp_model_presolve.cc b/ortools/sat/cp_model_presolve.cc index 9ab6c30b74..1c965f5587 100644 --- a/ortools/sat/cp_model_presolve.cc +++ b/ortools/sat/cp_model_presolve.cc @@ -6920,6 +6920,10 @@ void CpModelPresolver::DetectDuplicateConstraints() { context_->UpdateRuleStats("duplicate: removed constraint"); } + // TODO(user): We can also do similar stuff to linear constraint that just + // differ at a singleton variable. Or that are equalities. Like if expr + X = + // cte and expr + Y = other_cte, we can see that X is in affine relation with + // Y. const std::vector> duplicates_without_enforcement = FindDuplicateConstraints(*context_->working_model, true); for (const auto& [dup, rep] : duplicates_without_enforcement) { diff --git a/ortools/scheduling/BUILD.bazel b/ortools/scheduling/BUILD.bazel index 4b677fbd97..2f8b905793 100644 --- a/ortools/scheduling/BUILD.bazel +++ b/ortools/scheduling/BUILD.bazel @@ -35,6 +35,7 @@ cc_library( deps = [ ":jobshop_scheduling_cc_proto", "//ortools/base", + "//ortools/base:path", "//ortools/util:filelineiter", "@com_google_absl//absl/strings", "@com_google_protobuf//:protobuf", @@ -60,6 +61,7 @@ cc_library( ":rcpsp_cc_proto", "//ortools/base", "//ortools/base:file", + "//ortools/base:path", "//ortools/util:filelineiter", "@com_google_absl//absl/strings", ], diff --git a/ortools/scheduling/jobshop_scheduling_parser.cc b/ortools/scheduling/jobshop_scheduling_parser.cc index dd6f792658..44c89e0b4f 100644 --- a/ortools/scheduling/jobshop_scheduling_parser.cc +++ b/ortools/scheduling/jobshop_scheduling_parser.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include "absl/strings/numbers.h" #include "absl/strings/str_cat.h" @@ -24,6 +25,7 @@ #include "ortools/base/commandlineflags.h" #include "ortools/base/integral_types.h" #include "ortools/base/logging.h" +#include "ortools/base/path.h" #include "ortools/scheduling/jobshop_scheduling.pb.h" #include "ortools/util/filelineiter.h" @@ -57,6 +59,7 @@ bool JsspParser::ParseFile(const std::string& filename) { // Try to detect the type of the data file. // - fjs suffix -> Flexible Jobshop // - txt suffix -> Taillard or time dependent scheduling. + if (absl::EndsWith(filename, "fjs")) { problem_type_ = FLEXIBLE; } else if (absl::EndsWith(filename, ".txt")) { diff --git a/ortools/scheduling/rcpsp_parser.cc b/ortools/scheduling/rcpsp_parser.cc index 3147b6e927..47bb819dd8 100644 --- a/ortools/scheduling/rcpsp_parser.cc +++ b/ortools/scheduling/rcpsp_parser.cc @@ -15,10 +15,12 @@ #include #include +#include #include "absl/strings/match.h" #include "absl/strings/numbers.h" #include "absl/strings/str_split.h" +#include "ortools/base/path.h" #include "ortools/scheduling/rcpsp.pb.h" #include "ortools/util/filelineiter.h" diff --git a/ortools/util/fp_roundtrip_conv.cc b/ortools/util/fp_roundtrip_conv.cc index 51415857ab..3a42d03b45 100644 --- a/ortools/util/fp_roundtrip_conv.cc +++ b/ortools/util/fp_roundtrip_conv.cc @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include // NOLINT(build/c++11) diff --git a/ortools/util/fp_roundtrip_conv.h b/ortools/util/fp_roundtrip_conv.h index 085cdafe80..2191ab7d9f 100644 --- a/ortools/util/fp_roundtrip_conv.h +++ b/ortools/util/fp_roundtrip_conv.h @@ -18,6 +18,7 @@ #define OR_TOOLS_UTIL_FP_ROUNDTRIP_CONV_H_ #include +#include #include #include "absl/base/attributes.h" diff --git a/ortools/util/logging.cc b/ortools/util/logging.cc index 24c604d10d..3982b083dd 100644 --- a/ortools/util/logging.cc +++ b/ortools/util/logging.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include "absl/strings/str_cat.h" diff --git a/ortools/util/permutation.h b/ortools/util/permutation.h index 09e1475138..edabfdefb2 100644 --- a/ortools/util/permutation.h +++ b/ortools/util/permutation.h @@ -42,17 +42,12 @@ // simple because the containers of interest can be indexable without // providing any consistent way of accessing their contents that // applies to all the containers of interest. For instance, if we -// could insist that every indexable container must define an lvalue -// operator[]() we could simply use that for the assignments we need -// to do while walking around cycles of the permutation. But we cannot -// insist on any such thing. To see why, consider the PackedArray -// class template in ortools/util/packed_array.h -// where operator[] is supplied for rvalues, but because each logical -// array element is packed across potentially multiple instances of -// the underlying data type that the C++ language knows about, there -// is no way to have a C++ reference to an element of a -// PackedArray. There are other such examples besides PackedArray, -// too. This is the main reason we need a codified description (2) of +// could insist that every indexable container must define a +// `value_type& operator[]` we could simply use that for the assignments we need +// to do while walking around cycles of the permutation. This is not guaranteed +// though (common examples are `std::vector` or containers of bit-sized +// integers for which no c++ reference exists). +// This is the main reason we need a codified description (2) of // how to move data around in the indexable container. That // description comes to us via the PermutationApplier constructor's // argument which is a PermutationCycleHandler instance. Such an diff --git a/ortools/util/piecewise_linear_function.h b/ortools/util/piecewise_linear_function.h index 989273e991..8d09d05bb4 100644 --- a/ortools/util/piecewise_linear_function.h +++ b/ortools/util/piecewise_linear_function.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "ortools/base/basictypes.h" diff --git a/ortools/util/range_query_function.cc b/ortools/util/range_query_function.cc index a6abe6a661..d387f005c7 100644 --- a/ortools/util/range_query_function.cc +++ b/ortools/util/range_query_function.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include "ortools/base/integral_types.h" #include "ortools/base/logging.h" diff --git a/ortools/util/sorted_interval_list.cc b/ortools/util/sorted_interval_list.cc index 88e47e50f5..54265ef2b8 100644 --- a/ortools/util/sorted_interval_list.cc +++ b/ortools/util/sorted_interval_list.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/ortools/util/stats.cc b/ortools/util/stats.cc index 11d06d591c..faac3fc44b 100644 --- a/ortools/util/stats.cc +++ b/ortools/util/stats.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include "absl/strings/str_format.h" #include "ortools/base/stl_util.h" diff --git a/ortools/util/stats.h b/ortools/util/stats.h index 2a761562fa..08a1b107e0 100644 --- a/ortools/util/stats.h +++ b/ortools/util/stats.h @@ -70,6 +70,7 @@ #include #include +#include #ifdef HAS_PERF_SUBSYSTEM #include "absl/strings/str_replace.h" diff --git a/ortools/util/strong_integers.h b/ortools/util/strong_integers.h index a1677459db..5c1303ddf8 100644 --- a/ortools/util/strong_integers.h +++ b/ortools/util/strong_integers.h @@ -111,7 +111,7 @@ namespace operations_research { ++value_; \ return *this; \ } \ - const ThisType operator++(int v) { \ + const ThisType operator++(int) { \ ThisType temp(*this); \ ++value_; \ return temp; \ @@ -120,7 +120,7 @@ namespace operations_research { --value_; \ return *this; \ } \ - const ThisType operator--(int v) { \ + const ThisType operator--(int) { \ ThisType temp(*this); \ --value_; \ return temp; \ @@ -152,9 +152,7 @@ class StrongIndex { constexpr StrongIndex() : value_(0) {} - // NOLINTBEGIN(google-explicit-constructor) - constexpr StrongIndex(int value) : value_(value) {} - // NOLINTEND(google-explicit-constructor) + explicit constexpr StrongIndex(int value) : value_(value) {} StrongIndex& operator=(int arg_value) { value_ = arg_value; diff --git a/ortools/util/time_limit.cc b/ortools/util/time_limit.cc index b79be8e289..69e87e9e34 100644 --- a/ortools/util/time_limit.cc +++ b/ortools/util/time_limit.cc @@ -14,6 +14,8 @@ #include "ortools/util/time_limit.h" #include +#include +#include #include #include