diff --git a/examples/cpp/BUILD b/examples/cpp/BUILD index 23e61f8799..af9c215943 100644 --- a/examples/cpp/BUILD +++ b/examples/cpp/BUILD @@ -3,7 +3,8 @@ cc_library( hdrs = ["jobshop.h"], deps = [ "@or_tools_libraries//base", - "@or_tools_libraries//util", + "@or_tools_libraries//base:strings", + "@or_tools_libraries//util:filelineiter", ], ) @@ -12,7 +13,9 @@ cc_library( hdrs = ["flexible_jobshop.h"], deps = [ "@or_tools_libraries//base", - "@or_tools_libraries//util", + "@or_tools_libraries//base:strings", + "@or_tools_libraries//util:filelineiter", + "@or_tools_libraries//util:string_array", ], ) @@ -25,7 +28,9 @@ cc_binary( ":flexible_jobshop_reader", ":jobshop_reader", "@or_tools_libraries//base", - "@or_tools_libraries//util", + "@or_tools_libraries//base:file", + "@or_tools_libraries//base:strings", + "@or_tools_libraries//base:timer", "@or_tools_libraries//sat:disjunctive", "@or_tools_libraries//sat:integer", "@or_tools_libraries//sat:intervals", @@ -42,8 +47,8 @@ cc_binary( copts = ["-DUSE_GLOP"], deps = [ "@or_tools_libraries//base", - "@or_tools_libraries//linear_solver:linear_solver_glop", "@or_tools_libraries//linear_solver:linear_solver_cc_proto", + "@or_tools_libraries//linear_solver:linear_solver_glop", ], ) @@ -55,10 +60,11 @@ cc_binary( "sat_runner.cc", ], deps = [ + "@com_google_protobuf_cc//:protobuf", "@or_tools_libraries//sat:boolean_problem", "@or_tools_libraries//sat:boolean_problem_cc_proto", -# "@or_tools_libraries//sat:cp_model_proto", -# "@or_tools_libraries//sat:cp_model_solver", + # "@or_tools_libraries//sat:cp_model_proto", + # "@or_tools_libraries//sat:cp_model_solver", "@or_tools_libraries//sat:drat", "@or_tools_libraries//sat:lp_utils", "@or_tools_libraries//sat:optimization", @@ -66,10 +72,15 @@ cc_binary( "@or_tools_libraries//sat:simplification", "@or_tools_libraries//sat:symmetry", "@or_tools_libraries//base", - "@com_google_protobuf_cc//:protobuf", + "@or_tools_libraries//base:file", + "@or_tools_libraries//base:strings", + "@or_tools_libraries//base:status", + "@or_tools_libraries//base:random", + "@or_tools_libraries//base:threadpool", "@or_tools_libraries//algorithms:sparse_permutation", "@or_tools_libraries//lp_data:mps_reader", "@or_tools_libraries//lp_data:proto_utils", - "@or_tools_libraries//util", + "@or_tools_libraries//util:filelineiter", + "@or_tools_libraries//util:time_limit", ], ) diff --git a/src/algorithms/BUILD b/src/algorithms/BUILD index c2f28e5464..88fdf945c6 100644 --- a/src/algorithms/BUILD +++ b/src/algorithms/BUILD @@ -1,11 +1,70 @@ package(default_visibility = ["//visibility:public"]) +cc_library( + name = "hungarian", + srcs = ["hungarian.cc"], + hdrs = ["hungarian.h"], + deps = [ + "//base", + "//base:hash", + ], +) + +cc_library( + name = "knapsack_solver_base_lib", + hdrs = ["knapsack_solver.h"], + deps = [ + ":knapsack_solver_for_interface_lib", + "//base", + "//util:time_limit", + ], +) + +cc_library( + name = "knapsack_solver_lib", + hdrs = ["knapsack_solver.h"], + deps = [ + ":knapsack_solver_for_interface_lib", + "//base", + "//linear_solver:linear_solver_glop", + # "//linear_solver:linear_solver_cbc", + # "//linear_solver:linear_solver_glpk", + # "//linear_solver:linear_solver_scip", + "//util:time_limit", + ], +) + +cc_library( + name = "knapsack_solver_for_interface_lib", + srcs = ["knapsack_solver.cc"], + hdrs = ["knapsack_solver.h"], + deps = [ + "//base", + "//base:stl_util", + # We don't link any underlying solver to let the linear_solver_knapsack + # decide what solvers to include. + "//linear_solver:linear_solver_glop", + "//util:bitset", + "//util:time_limit", + ], +) + +cc_library( + name = "dense_doubly_linked_list", + hdrs = ["dense_doubly_linked_list.h"], + deps = [ + "//base", + ], +) + cc_library( name = "dynamic_partition", srcs = ["dynamic_partition.cc"], hdrs = ["dynamic_partition.h"], deps = [ "//base", + "//base:murmur", + "//base:strings", ], ) @@ -15,6 +74,7 @@ cc_library( hdrs = ["sparse_permutation.h"], deps = [ "//base", + "//base:strings", ], ) @@ -25,14 +85,7 @@ cc_library( deps = [ ":sparse_permutation", "//base", - ], -) - -cc_library( - name = "dense_doubly_linked_list", - hdrs = ["dense_doubly_linked_list.h"], - deps = [ - "//base", + "//base:strings", ], ) @@ -46,8 +99,12 @@ cc_library( ":dynamic_permutation", ":sparse_permutation", "//base", + "//base:status", + "//base:strings", "//graph", "//graph:util", - "//util", + "//util:iterators", + "//util:stats", + "//util:time_limit", ], -) \ No newline at end of file +) diff --git a/src/base/BUILD b/src/base/BUILD index 67abd8ebb0..b07bc0cfba 100644 --- a/src/base/BUILD +++ b/src/base/BUILD @@ -1,9 +1,334 @@ package(default_visibility = ["//visibility:public"]) cc_library( - name = 'base', - srcs = glob(['*.cc']), - hdrs = glob(['*.h']), - deps = ["@com_github_gflags_gflags//:gflags", - "@com_google_protobuf_cc//:protobuf",], + name = "base", + srcs = [ + "logging.cc", + ], + hdrs = [ + "basictypes.h", + "casts.h", + "commandlineflags.h", + "integral_types.h", + "logging.h", + "macros.h", + "port.h", + "strtoint.h", # Move to a separate library? + ], + deps = [ + "@com_github_gflags_gflags//:gflags", + ], +) + +cc_library( + name = "status", + hdrs = [ + "status.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "statusor", + hdrs = [ + "statusor.h", + ], + deps = [ + ":base", + ":status", + ], +) + +cc_library( + name = "encodingutils", + hdrs = [ + "encodingutils.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "strings", + srcs = [ + "join.cc", + "numbers.cc", + "split.cc", + "stringpiece.cc", + "stringprintf.cc", + ], + hdrs = [ + "join.h", + "numbers.h", + "split.h", + "stringpiece.h", + "stringpiece_utils.h", + "stringprintf.h", + "strutil.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "sysinfo", + srcs = [ + "sysinfo.cc", + ], + hdrs = [ + "sysinfo.h", + ], + deps = [ + ":base", + ":strings", + ], +) + +cc_library( + name = "file", + srcs = [ + "file.cc", + ], + hdrs = [ + "file.h", + ], + deps = [ + ":base", + ":status", + ":strings", + "@com_google_protobuf_cc//:protobuf", + ], +) + +cc_library( + name = "recordio", + srcs = [ + "recordio.cc", + ], + hdrs = [ + "recordio.h", + ], + deps = [ + ":base", + ":file", + ":status", + ":strings", + "@com_google_protobuf_cc//:protobuf", + ], +) + +cc_library( + name = "callback", + hdrs = [ + "callback.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "filelinereader", + srcs = [ + "filelinereader.cc", + ], + hdrs = [ + "filelinereader.h", + ], + deps = [ + ":base", + ":callback", + ":file", + ":status", + ":strings", + "@com_google_protobuf_cc//:protobuf", + ], +) + +cc_library( + name = "hash", + hdrs = [ + "hash.h", + "thorough_hash.h", + ], + deps = [ + ":base", + ":strings", + "@com_google_protobuf_cc//:protobuf", + ], +) + +cc_library( + name = "typeid", + hdrs = [ + "typeid.h", + ], +) + +cc_library( + name = "random", + srcs = [ + "random.cc", + ], + hdrs = [ + "random.h", + ], + deps = [ + ":base", + ":hash", + ], +) + +cc_library( + name = "cleanup", + hdrs = [ + "cleanup.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "murmur", + hdrs = [ + "murmur.h", + ], + deps = [ + ":base", + ":hash", + ":strings", + ], +) + +cc_library( + name = "map_util", + hdrs = [ + "map_util.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "stl_util", + hdrs = [ + "stl_util.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "sparsetable", + hdrs = [ + "sparsetable.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "accurate_sum", + hdrs = [ + "accurate_sum.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "mathutil", + hdrs = [ + "mathutil.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "strongly_connected_components", + hdrs = [ + "strongly_connected_components.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "timer", + srcs = [ + "time_support.cc", + "timer.cc", + ], + hdrs = [ + "time_support.h", + "timer.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "int_type", + hdrs = ["int_type.h"], + deps = [":base"], +) + +cc_library( + name = "int_type_indexed_vector", + hdrs = ["int_type_indexed_vector.h"], + deps = [ + ":base", + ":int_type", + ], +) + +cc_library( + name = "adjustable_priority_queue", + hdrs = [ + "adjustable_priority_queue.h", + "adjustable_priority_queue-inl.h", + ], + deps = [ + "//base", + ], +) + +cc_library( + name = "mutex", + srcs = [ + "mutex.cc", + ], + hdrs = [ + "mutex.h", + ], + deps = [ + ":base", + ], +) + +cc_library( + name = "threadpool", + srcs = [ + "threadpool.cc", + ], + hdrs = [ + "threadpool.h", + ], + deps = [ + ":base", + ":mutex", + ], ) diff --git a/src/base/encodingutils.h b/src/base/encodingutils.h index 84c9523888..0c840ce943 100644 --- a/src/base/encodingutils.h +++ b/src/base/encodingutils.h @@ -14,6 +14,8 @@ #ifndef OR_TOOLS_BASE_ENCODINGUTILS_H_ #define OR_TOOLS_BASE_ENCODINGUTILS_H_ +#include + namespace operations_research { namespace EncodingUtils { diff --git a/src/glop/BUILD b/src/glop/BUILD index 1be0ebae84..0b1e844e7e 100644 --- a/src/glop/BUILD +++ b/src/glop/BUILD @@ -59,6 +59,10 @@ cc_library( deps = [ ":parameters_cc_proto", "//base", + "//base:hash", + "//base:random", + "//base:stl_util", + "//base:strings", "//linear_solver:linear_solver_cc_proto", "//lp_data", "//lp_data:base", @@ -69,6 +73,11 @@ cc_library( "//lp_data:proto_utils", "//lp_data:sparse", "//lp_data:sparse_row", - "//util", + "//util:bitset", + "//util:fp_utils", + "//util:iterators", + "//util:proto_tools", + "//util:stats", + "//util:time_limit", ], ) diff --git a/src/graph/BUILD b/src/graph/BUILD index 7440e3390b..6e65483727 100644 --- a/src/graph/BUILD +++ b/src/graph/BUILD @@ -5,7 +5,7 @@ cc_library( hdrs = ["graph.h"], deps = [ "//base", - "//util", + "//util:iterators", ], ) @@ -24,7 +24,8 @@ cc_library( hdrs = ["util.h"], deps = [ ":graph", - "//base", + "//base:hash", + "//base:map_util", ], ) @@ -33,18 +34,101 @@ cc_library( hdrs = ["io.h"], deps = [ ":graph", - "//base", - "//util", + "//base:status", + "//base:statusor", + "//base:strings", + "//util:filelineiter", ], ) +#cc_library( +# name = "digraph", +# srcs = ["digraph.cc"], +# hdrs = ["digraph.h"], +# deps = [ +# "//base", +# "//base:int_type", +# "//base:int_type_indexed_vector", +# ], +#) + +#proto_library( +# name = "paths_proto", +# srcs = ["paths.proto"], +#) + +#cc_proto_library( +# name = "paths_cc_proto", +# deps = [":paths_proto"], +#) + +cc_library( + name = "shortestpaths", + srcs = [ + "bellman_ford.cc", + "dijkstra.cc", + "shortestpaths.cc", + ], + hdrs = ["shortestpaths.h"], + deps = [ + ":graph", + # ":paths_cc_proto", + "//base", + "//base:adjustable_priority_queue", + "//base:file", + "//base:hash", + "//base:int_type", + # "//base:int_type_indexed_bitmap", + "//base:int_type_indexed_vector", + "//base:recordio", + "//base:sparsetable", + "//base:strings", + # "//thread", + # "//util/coding:prefixvarint", + ], +) + +#cc_library( +# name = "arc_dijkstra", +# hdrs = ["arc_dijkstra.h"], +# deps = [ +# "//base", +# "//base:iterator_adaptors", +# ], +#) + +#cc_library( +# name = "bounded_dijkstra", +# hdrs = ["bounded_dijkstra.h"], +# deps = [ +# "//base", +# "//base:iterator_adaptors", +# "//thread", +# ], +#) + +#cc_library( +# name = "bidirectional_dijkstra", +# hdrs = ["bidirectional_dijkstra.h"], +# deps = [ +# "//base", +# "//base:iterator_adaptors", +# "//base:strings", +# "//thread", +# ], +#) + cc_library( name = "cliques", srcs = ["cliques.cc"], hdrs = ["cliques.h"], deps = [ "//base", - "//util", + "//base:hash", + "//base:int_type", + "//base:int_type_indexed_vector", + "//base:strings", + "//util:time_limit", ], ) @@ -53,19 +137,53 @@ cc_library( hdrs = ["hamiltonian_path.h"], deps = [ "//base", - "//util", + "//util:bitset", + "//util:saturated_arithmetic", + "//util:vector_or_function", + ], +) + +cc_library( + name = "christofides", + hdrs = ["christofides.h"], + deps = [ + ":eulerian_path", + ":minimum_spanning_tree", + "//base", + "//linear_solver:linear_solver_cc_proto", + "//linear_solver:linear_solver_glop", + # "//linear_solver:linear_solver_wrapper", + ], +) + +cc_library( + name = "eulerian_path", + hdrs = ["eulerian_path.h"], + deps = [ + "//base", ], ) cc_library( name = "minimum_spanning_tree", hdrs = ["minimum_spanning_tree.h"], - visibility = ["//visibility:public"], deps = [ ":connectivity", ":graph", "//base", - "//util", + "//base:adjustable_priority_queue", + "//util:vector_or_function", + ], +) + +cc_library( + name = "one_tree_lower_bound", + hdrs = ["one_tree_lower_bound.h"], + deps = [ + ":christofides", + ":minimum_spanning_tree", + "//base", + "//base:strings", ], ) @@ -74,14 +192,142 @@ cc_library( hdrs = ["ebert_graph.h"], deps = [ "//base", - "//util", + # "//testing/production_stub/public:gunit_prod", + "//util:permutation", + "//util:zvector", ], ) +#cc_library( +# name = "strongly_connected_components", +# srcs = ["strongly_connected_components.cc"], +# hdrs = ["strongly_connected_components.h"], +# deps = [ +# ":digraph", +# ":ebert_graph", +# "//base", +# "//base:int_type", +# "//base:int_type_indexed_vector", +# ], +#) + +#cc_library( +# name = "shortest_paths", +# srcs = ["shortest_paths.cc"], +# hdrs = ["shortest_paths.h"], +# deps = [ +# ":ebert_graph", +# ":graph", +# "//base", +# "//base:adjustable_priority_queue", +# "//base:dense_hash_map", +# "//base:file", +# "//base:map_util", +# "//base:stl_util", +# "//thread", +# "//util:zvector", +# ], +#) + cc_library( name = "connectivity", hdrs = ["connectivity.h"], deps = [ "//base", ], -) \ No newline at end of file +) + +proto_library( + name = "flow_problem_proto", + srcs = ["flow_problem.proto"], +) + +cc_proto_library( + name = "flow_problem_cc_proto", + deps = [":flow_problem_proto"], +) + +cc_library( + name = "max_flow", + srcs = ["max_flow.cc"], + hdrs = ["max_flow.h"], + deps = [ + ":ebert_graph", + ":flow_problem_cc_proto", + ":graph", + ":graphs", + "//base", + "//util:stats", + "//util:zvector", + ], +) + +cc_library( + name = "min_cost_flow", + srcs = ["min_cost_flow.cc"], + hdrs = ["min_cost_flow.h"], + deps = [ + ":connectivity", + ":ebert_graph", + ":graph", + ":graphs", + ":max_flow", + "//base", + "//base:mathutil", + "//util:stats", + "//util:zvector", + ], +) + +cc_library( + name = "assignment", + srcs = ["assignment.cc"], + hdrs = ["assignment.h"], + deps = [ + ":ebert_graph", + ":linear_assignment", + "//base", + ], +) + +cc_library( + name = "linear_assignment", + srcs = ["linear_assignment.cc"], + hdrs = ["linear_assignment.h"], + deps = [ + ":ebert_graph", + "//base", + "//base:strings", + # "//testing/production_stub/public:gunit_prod", + "//util:permutation", + "//util:zvector", + ], +) + +#cc_library( +# name = "biconnected", +# srcs = ["biconnected.cc"], +# hdrs = ["biconnected.h"], +# deps = [ +# ":ebert_graph", +# "//base", +# "//util:packed_array", +# ], +#) + +#cc_library( +# name = "hopcroft_karp", +# srcs = ["hopcroft_karp.c"], +# hdrs = ["hopcroft_karp.h"], +#) + +#cc_library( +# name = "dag_connectivity", +# srcs = ["dag_connectivity.cc"], +# hdrs = ["dag_connectivity.h"], +# deps = [ +# "//base", +# "//util:bitset", +# "//util/graph:topologicalsorter", +# ], +#) diff --git a/src/graph/cliques.cc b/src/graph/cliques.cc index a5f1cbdac4..ab4b647ea5 100644 --- a/src/graph/cliques.cc +++ b/src/graph/cliques.cc @@ -20,7 +20,6 @@ #include #include -#include "base/callback.h" #include "base/hash.h" namespace operations_research { diff --git a/src/graph/shortestpaths.cc b/src/graph/shortestpaths.cc index 49bb514e47..20e7cf6233 100644 --- a/src/graph/shortestpaths.cc +++ b/src/graph/shortestpaths.cc @@ -21,7 +21,6 @@ #include #include -#include "base/callback.h" #include "base/casts.h" #include "base/commandlineflags.h" #include "base/integral_types.h" diff --git a/src/linear_solver/BUILD b/src/linear_solver/BUILD index 0a5728704c..360c8b2e32 100644 --- a/src/linear_solver/BUILD +++ b/src/linear_solver/BUILD @@ -32,9 +32,14 @@ cc_library( deps = [ ":linear_solver_cc_proto", "//base", - "//glop:glop", + "//base:file", + "//base:hash", + "//base:map_util", + "//base:random", + "//glop", "//glop:parameters_cc_proto", "//lp_data", - "//util", + "//util:fp_utils", + "//util:proto_tools", ], ) diff --git a/src/lp_data/BUILD b/src/lp_data/BUILD index 11874c8846..8217deefa2 100644 --- a/src/lp_data/BUILD +++ b/src/lp_data/BUILD @@ -1,17 +1,12 @@ package(default_visibility = ["//visibility:public"]) -# Enable a warning to check for floating point to integer conversions. -# In GCC-4.8, this was "-Wreal-conversion", but was removed in 4.9 -# In Clang, this warning is "-Wfloat-conversion" #W_FLOAT_CONVERSION = select({ # "//tools/cc_target_os:android": [""], # "//tools/cc_target_os:ios": ["-Xclang-only=-Wfloat-conversion"], # "//conditions:default": ["-Xclang-only=-Wfloat-conversion"], #}) -# Floating-point code in this directory must not be compiled with -# dangerous optimizations. For example do not assume that FP expressions -# are associative. This is what -fno-fast-math is for. +#SAFE_FP_CODE = W_FLOAT_CONVERSION + ["-fno-fast-math"] SAFE_FP_CODE = ["-fno-fast-math"] cc_library( @@ -20,12 +15,13 @@ cc_library( hdrs = ["lp_types.h"], deps = [ "//base", - "//util", + "//base:hash", + "//base:int_type", + "//base:int_type_indexed_vector", + "//util:bitset", ], ) -# Handling of permutations. - cc_library( name = "permutation", hdrs = ["permutation.h"], @@ -33,12 +29,10 @@ cc_library( deps = [ ":base", "//base", - "//util", + "//util:return_macros", ], ) -# Compressed sparse columns. - cc_library( name = "sparse_vector", hdrs = ["sparse_vector.h"], @@ -47,7 +41,9 @@ cc_library( ":base", ":permutation", "//base", - "//util", + "//base:strings", + "//util:iterators", + "//util:return_macros", ], ) @@ -74,8 +70,6 @@ cc_library( ], ) -# Column-compressed sparse matrices. - cc_library( name = "sparse", srcs = ["sparse.cc"], @@ -89,12 +83,15 @@ cc_library( ":permutation", ":sparse_column", "//base", - "//util", + "//base:hash", + "//base:int_type", + "//base:int_type_indexed_vector", + "//base:strings", + "//util:fp_utils", + "//util:return_macros", ], ) -# Matrix scaler. - cc_library( name = "matrix_scaler", srcs = ["matrix_scaler.cc"], @@ -105,28 +102,22 @@ cc_library( ":lp_utils", ":sparse", "//base", - "//util", + "//base:hash", + "//base:int_type_indexed_vector", + "//util:fp_utils", ], ) -# This header-only library was inserted because the target -# //lp_data:sparse, -# which includes matrix_scaler.h -# cannot depend on the library -# :matrix_scaler: Found an inverse include path. -# See http://go/cxx-layering-faq cc_library( name = "matrix_scaler_hdr", hdrs = ["matrix_scaler.h"], - visibility = ["//visibility:private"], deps = [ ":base", "//base", + "//base:int_type_indexed_vector", ], ) -# Linear Programming data storage. - cc_library( name = "lp_data", srcs = ["lp_data.cc"], @@ -141,12 +132,14 @@ cc_library( ":permutation", ":sparse", "//base", - "//util", + "//base:hash", + "//base:int_type", + "//base:int_type_indexed_vector", + "//base:strings", + "//util:fp_utils", ], ) -# Lp utilities. - cc_library( name = "lp_utils", srcs = ["lp_utils.cc"], @@ -156,6 +149,7 @@ cc_library( ":base", ":sparse_column", "//base", + "//base:accurate_sum", ], ) @@ -168,10 +162,35 @@ cc_library( ":base", ":sparse", "//base", + "//base:hash", ], ) -# Linear Programming printing utilities. +#cc_library( +# name = "lp_parser", +# testonly = 1, +# srcs = ["lp_parser.cc"], +# hdrs = ["lp_parser.h"], +# copts = SAFE_FP_CODE, +# deps = [ +# ":base", +# ":lp_data", +# "//base", +# "//base:strings", +# "//util/regexp/re2", +# ], +#) + +#cc_library( +# name = "lp_constraint_classifier", +# srcs = ["lp_constraint_classifier.cc"], +# hdrs = ["lp_constraint_classifier.h"], +# copts = SAFE_FP_CODE, +# deps = [ +# ":lp_data", +# "//util:fp_utils", +# ], +#) cc_library( name = "lp_print_utils", @@ -181,18 +200,16 @@ cc_library( deps = [ ":base", "//base", - "//util", + "//base:strings", + "//util:rational_approximation", ], ) -# Proto conversion - cc_library( name = "proto_utils", srcs = ["proto_utils.cc"], hdrs = ["proto_utils.h"], copts = SAFE_FP_CODE, - visibility = ["//visibility:public"], deps = [ ":base", ":lp_data", @@ -201,8 +218,6 @@ cc_library( ], ) -# MPS reader. - cc_library( name = "mps_reader", srcs = ["mps_reader.cc"], @@ -213,11 +228,21 @@ cc_library( ":lp_data", ":lp_print_utils", "//base", + "//base:file", + # "//base:file:path", + "//base:filelinereader", + "//base:hash", + "//base:int_type", + "//base:int_type_indexed_vector", + "//base:map_util", + "//base:status", + "//base:strings", + # "//file/localfile", + # "//file/memfile", + # "//file/zipfile", ], ) -# Decompose a LinearProgram into several independent LinearPrograms. - cc_library( name = "lp_decomposer", srcs = ["lp_decomposer.cc"], @@ -227,7 +252,9 @@ cc_library( ":base", ":lp_data", ":lp_utils", - "//base", "//algorithms:dynamic_partition", + "//base", + "//base:hash", + "//base:mutex", ], -) \ No newline at end of file +) diff --git a/src/sat/BUILD b/src/sat/BUILD index 615b61f19f..6dcb99f63c 100644 --- a/src/sat/BUILD +++ b/src/sat/BUILD @@ -1,6 +1,7 @@ # Description: # Home of SAT solver -package(default_visibility = ["//visibility:public"], +package( + default_visibility = ["//visibility:public"], ) proto_library( @@ -108,6 +109,8 @@ cc_library( hdrs = ["model.h"], deps = [ "//base", + "//base:map_util", + "//base:typeid", ], ) @@ -117,16 +120,23 @@ cc_library( deps = [ ":model", "//base", - "//util", + "//base:int_type", + "//base:int_type_indexed_vector", + "//base:strings", + "//util:bitset", ], ) +# W_FLOAT_CONVERSION = "-Xclang-only=-Wfloat-conversion" +W_FLOAT_CONVERSION = "" + cc_library( name = "sat_solver", srcs = [ "sat_solver.cc", ], hdrs = ["sat_solver.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":clause", ":drat", @@ -135,8 +145,20 @@ cc_library( ":sat_base", ":sat_parameters_cc_proto", "//base", + "//base:adjustable_priority_queue", + "//base:int_type", + "//base:int_type_indexed_vector", + "//base:map_util", + "//base:random", + "//base:stl_util", + "//base:strings", + "//util:bitset", + "//util:running_stat", + "//util:saturated_arithmetic", + "//util:stats", + "//util:time_limit", + # "//util/time:clock", "@com_google_protobuf_cc//:protobuf", - "//util", ], ) @@ -144,11 +166,21 @@ cc_library( name = "clause", srcs = ["clause.cc"], hdrs = ["clause.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":sat_base", ":sat_parameters_cc_proto", "//base", - "//util", + "//base:hash", + # "//base:inlined_vector", + "//base:int_type", + "//base:int_type_indexed_vector", + "//base:stl_util", + "//base:strings", + "//util:bitset", + "//util:stats", + "//util:time_limit", + "//base:random", ], ) @@ -156,15 +188,19 @@ cc_library( name = "simplification", srcs = ["simplification.cc"], hdrs = ["simplification.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":drat", ":sat_base", ":sat_parameters_cc_proto", ":sat_solver", ":util", - "//base", "//algorithms:dynamic_partition", - "//util", + "//base", + "//base:adjustable_priority_queue", + "//base:random", + "//base:stl_util", + "//base:strongly_connected_components", ], ) @@ -172,11 +208,13 @@ cc_library( name = "pb_constraint", srcs = ["pb_constraint.cc"], hdrs = ["pb_constraint.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":sat_base", ":sat_parameters_cc_proto", - "//base", - "//util", + "//base:hash", + "//util:saturated_arithmetic", + "//util:stats", ], ) @@ -184,10 +222,12 @@ cc_library( name = "symmetry", srcs = ["symmetry.cc"], hdrs = ["symmetry.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":sat_base", "//algorithms:sparse_permutation", - "//util", + "//base:hash", + "//util:stats", ], ) @@ -195,11 +235,12 @@ cc_library( name = "no_cycle", srcs = ["no_cycle.cc"], hdrs = ["no_cycle.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":model", ":sat_base", ":sat_solver", - "//base", + "//base:stl_util", ], ) @@ -207,12 +248,23 @@ cc_library( name = "integer", srcs = ["integer.cc"], hdrs = ["integer.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":model", ":sat_base", ":sat_solver", "//base", - "//util", + # "//base:inlined_vector", + "//base:int_type", + # "//base:iterator_adaptors", + "//base:map_util", + "//base:stl_util", + "//base:strings", + "//util:bitset", + "//util:iterators", + "//util:rev", + "//util:saturated_arithmetic", + "//util:sorted_interval_list", ], ) @@ -220,6 +272,7 @@ cc_library( name = "intervals", srcs = ["intervals.cc"], hdrs = ["intervals.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":cp_constraints", ":integer", @@ -228,8 +281,7 @@ cc_library( ":precedences", ":sat_base", ":sat_solver", - "//base", - "//util", + "//util:sort", ], ) @@ -237,13 +289,15 @@ cc_library( name = "precedences", srcs = ["precedences.cc"], hdrs = ["precedences.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":integer", ":model", ":sat_base", ":sat_solver", - "//base", - "//util", + "//base:cleanup", + "//base:stl_util", + "//util:bitset", ], ) @@ -251,6 +305,7 @@ cc_library( name = "integer_expr", srcs = ["integer_expr.cc"], hdrs = ["integer_expr.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":integer", ":model", @@ -263,6 +318,7 @@ cc_library( name = "disjunctive", srcs = ["disjunctive.cc"], hdrs = ["disjunctive.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":cp_constraints", ":integer", @@ -271,8 +327,8 @@ cc_library( ":precedences", ":sat_base", ":sat_solver", - "//base", - "//util", + # "//base:iterator_adaptors", + "//util:stats", ], ) @@ -280,6 +336,7 @@ cc_library( name = "timetable", srcs = ["timetable.cc"], hdrs = ["timetable.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":integer", ":intervals", @@ -288,8 +345,7 @@ cc_library( ":precedences", ":sat_base", ":sat_solver", - "//base", - "//util", + "//util:sort", ], ) @@ -297,14 +353,15 @@ cc_library( name = "timetable_edgefinding", srcs = ["timetable_edgefinding.cc"], hdrs = ["timetable_edgefinding.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":integer", ":intervals", ":model", ":sat_base", ":sat_solver", - "//base", - "//util", + "//base:int_type", + "//util:sort", ], ) @@ -312,6 +369,7 @@ cc_library( name = "cumulative", srcs = ["cumulative.cc"], hdrs = ["cumulative.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":disjunctive", ":integer", @@ -329,6 +387,7 @@ cc_library( name = "overload_checker", srcs = ["overload_checker.cc"], hdrs = ["overload_checker.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":integer", ":intervals", @@ -336,7 +395,8 @@ cc_library( ":sat_base", ":sat_solver", "//base", - "//util", + # "//base:iterator_adaptors", + "//util:sort", ], ) @@ -344,50 +404,55 @@ cc_library( name = "boolean_problem", srcs = ["boolean_problem.cc"], hdrs = ["boolean_problem.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":boolean_problem_cc_proto", ":sat_solver", ":simplification", - "//base", "//algorithms:find_graph_symmetries", "//algorithms:sparse_permutation", + "//base", + "//base:hash", + "//base:map_util", + "//base:status", + "//base:strings", "//graph", "//graph:io", "//graph:util", - "//util", ], ) -#cc_library( -# name = "linear_programming_constraint", -# srcs = ["linear_programming_constraint.cc"], -# hdrs = ["linear_programming_constraint.h"], -# deps = [ -# ":integer", -# ":model", -# ":sat_base", -# "//base", -# "//glop:glop", -# "//lp_data", -# "//util", -# ], -#) +cc_library( + name = "linear_programming_constraint", + srcs = ["linear_programming_constraint.cc"], + hdrs = ["linear_programming_constraint.h"], + deps = [ + ":integer", + ":model", + ":sat_base", + "//base", + "//glop", + "//lp_data", + "//util:time_limit", + ], +) cc_library( name = "lp_utils", srcs = ["lp_utils.cc"], hdrs = ["lp_utils.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":boolean_problem", ":boolean_problem_cc_proto", -# ":cp_model_proto", + # ":cp_model_cc_proto", ":sat_solver", - "//base", - "//glop:glop", + "//base:strings", + "//glop", "//linear_solver:linear_solver_cc_proto", "//lp_data", "//lp_data:lp_print_utils", - "//util", + "//util:fp_utils", ], ) @@ -395,6 +460,7 @@ cc_library( name = "optimization", srcs = ["optimization.cc"], hdrs = ["optimization.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":boolean_problem", ":encoding", @@ -403,6 +469,7 @@ cc_library( ":sat_solver", ":util", "//base", + "//base:strings", "@com_google_protobuf_cc//:protobuf", ], ) @@ -411,9 +478,12 @@ cc_library( name = "util", srcs = ["util.cc"], hdrs = ["util.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":sat_parameters_cc_proto", "//base", + "//base:random", + "//base:strings", ], ) @@ -421,10 +491,14 @@ cc_library( name = "table", srcs = ["table.cc"], hdrs = ["table.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":integer", ":model", "//base", + "//base:map_util", + "//base:stl_util", + "//base:strings", ], ) @@ -432,11 +506,14 @@ cc_library( name = "cp_constraints", srcs = ["cp_constraints.cc"], hdrs = ["cp_constraints.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":integer", ":model", "//base", - "//util", + "//base:map_util", + "//util:sort", + "//util:sorted_interval_list", ], ) @@ -444,13 +521,11 @@ cc_library( name = "flow_costs", srcs = ["flow_costs.cc"], hdrs = ["flow_costs.h"], - copts = ["-DUSE_GLOP"], deps = [ ":integer", ":model", ":sat_base", "//linear_solver:linear_solver_glop", -# "//linear_solver:linear_solver_wrapper", ], ) @@ -458,10 +533,12 @@ cc_library( name = "encoding", srcs = ["encoding.cc"], hdrs = ["encoding.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":boolean_problem_cc_proto", ":sat_solver", "//base", + "//base:strings", ], ) @@ -469,25 +546,13 @@ cc_library( name = "drat", srcs = ["drat.cc"], hdrs = ["drat.h"], + copts = [W_FLOAT_CONVERSION], deps = [ ":model", ":sat_base", "//base", + "//base:file", + "//base:hash", + "//base:strings", ], ) - -#cc_library( -# name = "sat_cnf_reader", -# hdrs = ["sat_cnf_reader.h"], -# visibility = [ -# # For //bop:integral_bop_run. -# "//bop:__pkg__", -# ], -# deps = [ -# ":boolean_problem_proto", -# "//base", -# "//strings", -# "//third_party/absl/strings", -# "//util:filelineiter", -# ], -#) diff --git a/src/util/BUILD b/src/util/BUILD index 658376eb67..1cd521f1c2 100644 --- a/src/util/BUILD +++ b/src/util/BUILD @@ -1,10 +1,338 @@ package(default_visibility = ["//visibility:public"]) cc_library( - name = 'util', - srcs = glob(['*.cc']), - hdrs = glob(['*.h']), + name = "filelineiter", + hdrs = ["filelineiter.h"], deps = [ - "//base:base", + "//base", + "//base:file", + "//base:status", + "//base:strings", + ], +) + +cc_library( + name = "vector_map", + hdrs = ["vector_map.h"], + deps = ["//base:map_util"], +) + +cc_library( + name = "bitset", + srcs = ["bitset.cc"], + hdrs = ["bitset.h"], + deps = ["//base"], +) + +cc_library( + name = "cached_log", + srcs = ["cached_log.cc"], + hdrs = ["cached_log.h"], + deps = [ + "//base", + ], +) + +cc_library( + name = "graph_export", + srcs = ["graph_export.cc"], + hdrs = ["graph_export.h"], + deps = [ + "//base", + "//base:file", + "//base:status", + ], +) + +cc_library( + name = "iterators", + hdrs = ["iterators.h"], +) + +cc_library( + name = "zvector", + hdrs = ["zvector.h"], + deps = ["//base"], +) + +cc_library( + name = "permutation", + hdrs = ["permutation.h"], + deps = ["//base"], +) + +cc_library( + name = "xml_helper", + srcs = ["xml_helper.cc"], + hdrs = ["xml_helper.h"], + deps = [ + "//base", + "//base:strings", + ], +) + +#cc_library( +# name = "step_function", +# srcs = ["step_function.cc"], +# hdrs = ["step_function.h"], +# deps = [ +# "//base:strings", +# ":iterators", +# "//base", +# ], +#) + +cc_library( + name = "saturated_arithmetic", + hdrs = ["saturated_arithmetic.h"], + deps = [ + ":bitset", + "//base", + "//base:strings", + ], +) + +cc_library( + name = "piecewise_linear_function", + srcs = ["piecewise_linear_function.cc"], + hdrs = ["piecewise_linear_function.h"], + deps = [ + ":saturated_arithmetic", + "//base", + "//base:strings", + ], +) + +cc_library( + name = "rational_approximation", + srcs = ["rational_approximation.cc"], + hdrs = ["rational_approximation.h"], + deps = [ + "//base", + "//base:strings", + ], +) + +cc_library( + name = "sorted_interval_list", + srcs = ["sorted_interval_list.cc"], + hdrs = ["sorted_interval_list.h"], + deps = [ + ":saturated_arithmetic", + "//base", + "//base:strings", + ], +) + +cc_library( + name = "string_array", + hdrs = ["string_array.h"], +) + +cc_library( + name = "tuple_set", + hdrs = ["tuple_set.h"], + deps = [ + "//base", + "//base:hash", + "//base:map_util", + ], +) + +cc_library( + name = "stats", + srcs = ["stats.cc"], + hdrs = ["stats.h"], + deps = [ + "//base", + "//base:stl_util", + "//base:strings", + # "//base:strings:human_readable", + "//base:sysinfo", + "//base:timer", + "//base:encodingutils", # To replace by port when we export them. + ], +) + +cc_library( + name = "time_limit", + srcs = ["time_limit.cc"], + hdrs = ["time_limit.h"], + deps = [ + ":running_stat", + "//base", + "//base:strings", + "//base:timer", + ], +) + +cc_library( + name = "fp_utils", + srcs = ["fp_utils.cc"], + hdrs = ["fp_utils.h"], + # -frounding-math is needed for code that uses IEEE-754 rounding modes. + # You must also set this flag if you depend on this target and use + # its methods related to IEEE-754 rounding modes. + copts = ["-frounding-math"], + deps = [ + ":bitset", + "//base", + ], +) + +cc_library( + name = "monoid_operation_tree", + srcs = [], + hdrs = ["monoid_operation_tree.h"], + deps = ["//base"], +) + +cc_library( + name = "return_macros", + hdrs = ["return_macros.h"], + deps = ["//base"], +) + +cc_library( + name = "running_stat", + hdrs = ["running_stat.h"], + deps = ["//base"], +) + +cc_library( + name = "proto_tools", + srcs = ["proto_tools.cc"], + hdrs = ["proto_tools.h"], + deps = [ + "//base:strings", + "//base", + "//base:file", + "//base:hash", + # "//net/proto2/io/public", + # "//net/proto2/io/public:io", + # "//net/proto2/public", + # "//net/proto2/util/public:json", + "@com_google_protobuf_cc//:protobuf", + ], +) + +cc_library( + name = "functions_swig_helpers", + hdrs = [ + "functions_swig_helpers.h", + ], + deps = ["//base"], +) + +cc_library( + name = "functions_swig_test_helpers", + testonly = 1, + hdrs = [ + "functions_swig_test_helpers.h", + ], + deps = ["//base"], +) + +cc_library( + name = "range_minimum_query", + hdrs = ["range_minimum_query.h"], + deps = [":bitset"], +) + +cc_library( + name = "range_query_function", + srcs = ["range_query_function.cc"], + hdrs = ["range_query_function.h"], + deps = [ + ":range_minimum_query", + "//base", + ], +) + +cc_library( + name = "rev", + hdrs = ["rev.h"], + deps = [ + "//base", + "//base:map_util", + "//base:strings", + ], +) + +cc_library( + name = "vector_or_function", + hdrs = ["vector_or_function.h"], + visibility = ["//visibility:public"], + deps = [ + "//base", + ], +) + +#cc_library( +# name = "tsplib_parser", +# srcs = ["tsplib_parser.cc"], +# hdrs = ["tsplib_parser.h"], +# visibility = ["//visibility:public"], +# deps = [ +# "//base:strings", +# ":filelineiter", +# "//base", +# "//base:file", +# "//base:file:path", +# "//base:map_util", +# "//base:mathutil", +# "///base:strings", +# "//file/zipfile", +# "//util/regexp/re2", +# ], +#) + +#cc_library( +# name = "pdtsp_parser", +# srcs = ["pdtsp_parser.cc"], +# hdrs = ["pdtsp_parser.h"], +# visibility = ["//visibility:public"], +# deps = [ +# "//base:strings", +# ":filelineiter", +# "//base", +# "//base:file", +# "//base:file:path", +# "//base:mathutil", +# ], +#) + +#cc_library( +# name = "bp_parser", +# srcs = ["bp_parser.cc"], +# hdrs = ["bp_parser.h"], +# visibility = ["//visibility:public"], +# deps = [ +# "//base:strings", +# ":filelineiter", +# "//base", +# "//base:file", +# ], +#) + +cc_library( + name = "rcpsp_parser", + srcs = ["rcpsp_parser.cc"], + hdrs = ["rcpsp_parser.h"], + visibility = ["//visibility:public"], + deps = [ + ":filelineiter", + "//base", + "//base:file", + "//base:strings", + ], +) + +cc_library( + name = "sort", + hdrs = ["sort.h"], + visibility = ["//visibility:public"], + deps = [ + "//base", ], )